summaryrefslogtreecommitdiffstats
path: root/system/database/drivers/postgre
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/postgre
parent46563d570944d6c5af8b4f46ba1eeca111eabaa4 (diff)
Diffstat (limited to 'system/database/drivers/postgre')
-rw-r--r--system/database/drivers/postgre/postgre_driver.php117
1 files changed, 59 insertions, 58 deletions
diff --git a/system/database/drivers/postgre/postgre_driver.php b/system/database/drivers/postgre/postgre_driver.php
index 92767c42b..03817188f 100644
--- a/system/database/drivers/postgre/postgre_driver.php
+++ b/system/database/drivers/postgre/postgre_driver.php
@@ -279,10 +279,10 @@ class CI_DB_postgre_driver extends CI_DB {
/**
* The error message string
*
- * @access public
+ * @access private
* @return string
*/
- function error_message()
+ function _error_message()
{
return pg_last_error($this->conn_id);
}
@@ -292,10 +292,10 @@ class CI_DB_postgre_driver extends CI_DB {
/**
* The error message number
*
- * @access public
+ * @access private
* @return integer
*/
- function error_number()
+ function _error_number()
{
return '';
}
@@ -308,11 +308,11 @@ class CI_DB_postgre_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, '.'))
{
@@ -325,24 +325,6 @@ class CI_DB_postgre_driver extends CI_DB {
// --------------------------------------------------------------------
/**
- * 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();
- }
-
- // --------------------------------------------------------------------
-
- /**
* Insert statement
*
* Generates a platform-specific insert string from the supplied data
@@ -355,7 +337,7 @@ class CI_DB_postgre_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).")";
}
// --------------------------------------------------------------------
@@ -378,7 +360,7 @@ class CI_DB_postgre_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);
}
// --------------------------------------------------------------------
@@ -395,9 +377,48 @@ class CI_DB_postgre_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)
+ {
+ $sql .= "LIMIT ".$limit;
+ if ($offset > 0)
+ {
+ $sql .= " OFFSET ".$offset;
+ }
+
+ return $sql;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Close DB Connection
+ *
+ * @access public
+ * @param resource
+ * @return void
+ */
+ function _close($conn_id)
+ {
+ pg_close($conn_id);
+ }
+
// --------------------------------------------------------------------
/**
@@ -437,48 +458,28 @@ class CI_DB_postgre_driver extends CI_DB {
*/
function _show_columns($table = '')
{
- return "SELECT column_name FROM information_schema.columns WHERE table_name ='".$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)
- {
- $sql .= "LIMIT ".$limit;
-
- if ($offset > 0)
- {
- $sql .= " OFFSET ".$offset;
- }
-
- return $sql;
+ return "SELECT column_name FROM information_schema.columns WHERE table_name ='".$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)
{
- pg_close($conn_id);
+ $sql = "SELECT * FROM ".$this->_escape_table($table)." LIMIT 1";
+ $query = $this->query($sql);
+ return $query->field_data();
}
+
}
?> \ No newline at end of file