summaryrefslogtreecommitdiffstats
path: root/system/database/drivers/mysql/mysql_driver.php
diff options
context:
space:
mode:
authoradmin <devnull@localhost>2006-09-24 22:14:38 +0200
committeradmin <devnull@localhost>2006-09-24 22:14:38 +0200
commitbb1d439a981023415569549d8b8c4987fa5b9b51 (patch)
tree098a08d4aa1fd20093e213f7e13ea4a8806ad0d6 /system/database/drivers/mysql/mysql_driver.php
parent46563d570944d6c5af8b4f46ba1eeca111eabaa4 (diff)
Diffstat (limited to 'system/database/drivers/mysql/mysql_driver.php')
-rw-r--r--system/database/drivers/mysql/mysql_driver.php124
1 files changed, 62 insertions, 62 deletions
diff --git a/system/database/drivers/mysql/mysql_driver.php b/system/database/drivers/mysql/mysql_driver.php
index 8aa82da72..fc7f6780b 100644
--- a/system/database/drivers/mysql/mysql_driver.php
+++ b/system/database/drivers/mysql/mysql_driver.php
@@ -269,10 +269,10 @@ class CI_DB_mysql_driver extends CI_DB {
/**
* The error message string
*
- * @access public
+ * @access private
* @return string
*/
- function error_message()
+ function _error_message()
{
return mysql_error($this->conn_id);
}
@@ -282,10 +282,10 @@ class CI_DB_mysql_driver extends CI_DB {
/**
* The error message number
*
- * @access public
+ * @access private
* @return integer
*/
- function error_number()
+ function _error_number()
{
return mysql_errno($this->conn_id);
}
@@ -298,11 +298,11 @@ class CI_DB_mysql_driver extends CI_DB {
* This function adds backticks if the table name has a period
* in it. Some DBs will get cranky unless periods are escaped
*
- * @access public
+ * @access private
* @param string the table name
* @return string
*/
- function escape_table($table)
+ function _escape_table($table)
{
if (stristr($table, '.'))
{
@@ -311,25 +311,7 @@ class CI_DB_mysql_driver extends CI_DB {
return $table;
}
-
- // --------------------------------------------------------------------
-
- /**
- * Field data query
- *
- * Generates a platform-specific query so that the column data can be retrieved
- *
- * @access public
- * @param string the table name
- * @return object
- */
- function _field_data($table)
- {
- $sql = "SELECT * FROM ".$this->escape_table($table)." LIMIT 1";
- $query = $this->query($sql);
- return $query->field_data();
- }
-
+
// --------------------------------------------------------------------
/**
@@ -345,7 +327,7 @@ class CI_DB_mysql_driver extends CI_DB {
*/
function _insert($table, $keys, $values)
{
- return "INSERT INTO ".$this->escape_table($table)." (".implode(', ', $keys).") VALUES (".implode(', ', $values).")";
+ return "INSERT INTO ".$this->_escape_table($table)." (".implode(', ', $keys).") VALUES (".implode(', ', $values).")";
}
// --------------------------------------------------------------------
@@ -368,7 +350,7 @@ class CI_DB_mysql_driver extends CI_DB {
$valstr[] = $key." = ".$val;
}
- return "UPDATE ".$this->escape_table($table)." SET ".implode(', ', $valstr)." WHERE ".implode(" ", $where);
+ return "UPDATE ".$this->_escape_table($table)." SET ".implode(', ', $valstr)." WHERE ".implode(" ", $where);
}
// --------------------------------------------------------------------
@@ -385,9 +367,50 @@ class CI_DB_mysql_driver extends CI_DB {
*/
function _delete($table, $where)
{
- return "DELETE FROM ".$this->escape_table($table)." WHERE ".implode(" ", $where);
+ return "DELETE FROM ".$this->_escape_table($table)." WHERE ".implode(" ", $where);
}
-
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Limit string
+ *
+ * Generates a platform-specific LIMIT clause
+ *
+ * @access public
+ * @param string the sql query string
+ * @param integer the number of rows to limit the query to
+ * @param integer the offset value
+ * @return string
+ */
+ function _limit($sql, $limit, $offset)
+ {
+ if ($offset == 0)
+ {
+ $offset = '';
+ }
+ else
+ {
+ $offset .= ", ";
+ }
+
+ return $sql."LIMIT ".$offset.$limit;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Close DB Connection
+ *
+ * @access public
+ * @param resource
+ * @return void
+ */
+ function _close($conn_id)
+ {
+ mysql_close($conn_id);
+ }
+
// --------------------------------------------------------------------
/**
@@ -429,48 +452,25 @@ class CI_DB_mysql_driver extends CI_DB {
*/
function _show_columns($table = '')
{
- return "SHOW COLUMNS FROM ".$this->escape_table($table);
- }
-
- // --------------------------------------------------------------------
-
- /**
- * Limit string
- *
- * Generates a platform-specific LIMIT clause
- *
- * @access public
- * @param string the sql query string
- * @param integer the number of rows to limit the query to
- * @param integer the offset value
- * @return string
- */
- function _limit($sql, $limit, $offset)
- {
- if ($offset == 0)
- {
- $offset = '';
- }
- else
- {
- $offset .= ", ";
- }
-
- return $sql."LIMIT ".$offset.$limit;
+ return "SHOW COLUMNS FROM ".$this->_escape_table($table);
}
// --------------------------------------------------------------------
/**
- * Close DB Connection
+ * Field data query
+ *
+ * Generates a platform-specific query so that the column data can be retrieved
*
* @access public
- * @param resource
- * @return void
+ * @param string the table name
+ * @return object
*/
- function _close($conn_id)
+ function _field_data($table)
{
- mysql_close($conn_id);
+ $sql = "SELECT * FROM ".$this->_escape_table($table)." LIMIT 1";
+ $query = $this->query($sql);
+ return $query->field_data();
}
}