summaryrefslogtreecommitdiffstats
path: root/system/database/drivers/postgre
diff options
context:
space:
mode:
Diffstat (limited to 'system/database/drivers/postgre')
-rw-r--r--system/database/drivers/postgre/postgre_driver.php83
-rw-r--r--system/database/drivers/postgre/postgre_forge.php24
-rw-r--r--system/database/drivers/postgre/postgre_result.php25
-rw-r--r--system/database/drivers/postgre/postgre_utility.php4
4 files changed, 86 insertions, 50 deletions
diff --git a/system/database/drivers/postgre/postgre_driver.php b/system/database/drivers/postgre/postgre_driver.php
index 6ef83726a..fad9539ff 100644
--- a/system/database/drivers/postgre/postgre_driver.php
+++ b/system/database/drivers/postgre/postgre_driver.php
@@ -42,28 +42,29 @@
*/
class CI_DB_postgre_driver extends CI_DB {
- public $dbdriver = 'postgre';
+ var $dbdriver = 'postgre';
- protected $_escape_char = '"';
+ var $_escape_char = '"';
// clause and character used for LIKE escape sequences
- protected $_like_escape_str = " ESCAPE '%s' ";
- protected $_like_escape_chr = '!';
+ var $_like_escape_str = " ESCAPE '%s' ";
+ var $_like_escape_chr = '!';
/**
* The syntax to count rows is slightly different across different
* database engines, so this string appears in each driver and is
* used for the count_all() and count_all_results() functions.
*/
- protected $_count_string = "SELECT COUNT(*) AS ";
- protected $_random_keyword = ' RANDOM()'; // database specific random keyword
+ var $_count_string = "SELECT COUNT(*) AS ";
+ var $_random_keyword = ' RANDOM()'; // database specific random keyword
/**
* Connection String
*
+ * @access private
* @return string
*/
- protected function _connect_string()
+ function _connect_string()
{
$components = array(
'hostname' => 'host',
@@ -89,9 +90,10 @@ class CI_DB_postgre_driver extends CI_DB {
/**
* Non-persistent database connection
*
+ * @access private called by the base class
* @return resource
*/
- protected function db_connect()
+ function db_connect()
{
return @pg_connect($this->_connect_string());
}
@@ -101,9 +103,10 @@ class CI_DB_postgre_driver extends CI_DB {
/**
* Persistent database connection
*
+ * @access private called by the base class
* @return resource
*/
- protected function db_pconnect()
+ function db_pconnect()
{
return @pg_pconnect($this->_connect_string());
}
@@ -116,9 +119,10 @@ class CI_DB_postgre_driver extends CI_DB {
* Keep / reestablish the db connection if no queries have been
* sent for a length of time exceeding the server's idle timeout
*
+ * @access public
* @return void
*/
- public function reconnect()
+ function reconnect()
{
if (pg_ping($this->conn_id) === FALSE)
{
@@ -131,9 +135,10 @@ class CI_DB_postgre_driver extends CI_DB {
/**
* Select the database
*
+ * @access private called by the base class
* @return resource
*/
- protected function db_select()
+ function db_select()
{
// Not needed for Postgre so we'll return TRUE
return TRUE;
@@ -186,10 +191,11 @@ class CI_DB_postgre_driver extends CI_DB {
/**
* Execute the query
*
+ * @access private called by the base class
* @param string an SQL query
* @return resource
*/
- protected function _execute($sql)
+ function _execute($sql)
{
return @pg_query($this->conn_id, $sql);
}
@@ -258,11 +264,12 @@ class CI_DB_postgre_driver extends CI_DB {
/**
* Escape String
*
+ * @access public
* @param string
* @param bool whether or not the string will be used in a LIKE condition
* @return string
*/
- public function escape_str($str, $like = FALSE)
+ function escape_str($str, $like = FALSE)
{
if (is_array($str))
{
@@ -292,9 +299,10 @@ class CI_DB_postgre_driver extends CI_DB {
/**
* Affected Rows
*
+ * @access public
* @return integer
*/
- public function affected_rows()
+ function affected_rows()
{
return @pg_affected_rows($this->result_id);
}
@@ -304,9 +312,10 @@ class CI_DB_postgre_driver extends CI_DB {
/**
* Insert ID
*
+ * @access public
* @return integer
*/
- public function insert_id()
+ function insert_id()
{
$v = $this->version();
@@ -346,10 +355,11 @@ class CI_DB_postgre_driver extends CI_DB {
* Generates a platform-specific query string that counts all records in
* the specified database
*
+ * @access public
* @param string
* @return string
*/
- public function count_all($table = '')
+ function count_all($table = '')
{
if ($table == '')
{
@@ -374,10 +384,11 @@ class CI_DB_postgre_driver extends CI_DB {
*
* Generates a platform-specific query string so that the table names can be fetched
*
+ * @access private
* @param boolean
* @return string
*/
- protected function _list_tables($prefix_limit = FALSE)
+ function _list_tables($prefix_limit = FALSE)
{
$sql = "SELECT table_name FROM information_schema.tables WHERE table_schema = 'public'";
@@ -396,10 +407,11 @@ class CI_DB_postgre_driver extends CI_DB {
*
* Generates a platform-specific query string so that the column names can be fetched
*
+ * @access public
* @param string the table name
* @return string
*/
- public function _list_columns($table = '')
+ function _list_columns($table = '')
{
return "SELECT column_name FROM information_schema.columns WHERE table_name ='".$table."'";
}
@@ -411,10 +423,11 @@ class CI_DB_postgre_driver extends CI_DB {
*
* Generates a platform-specific query so that the column data can be retrieved
*
+ * @access public
* @param string the table name
* @return object
*/
- public function _field_data($table)
+ function _field_data($table)
{
return "SELECT * FROM ".$table." LIMIT 1";
}
@@ -441,10 +454,11 @@ class CI_DB_postgre_driver extends CI_DB {
*
* This function escapes column and table names
*
+ * @access private
* @param string
* @return string
*/
- protected function _escape_identifiers($item)
+ function _escape_identifiers($item)
{
if ($this->_escape_char == '')
{
@@ -483,10 +497,11 @@ class CI_DB_postgre_driver extends CI_DB {
* This function implicitly groups FROM tables so there is no confusion
* about operator precedence in harmony with SQL standards
*
+ * @access public
* @param type
* @return type
*/
- public function _from_tables($tables)
+ function _from_tables($tables)
{
if ( ! is_array($tables))
{
@@ -503,12 +518,13 @@ class CI_DB_postgre_driver extends CI_DB {
*
* Generates a platform-specific insert string from the supplied data
*
+ * @access public
* @param string the table name
* @param array the insert keys
* @param array the insert values
* @return string
*/
- public function _insert($table, $keys, $values)
+ function _insert($table, $keys, $values)
{
return "INSERT INTO ".$table." (".implode(', ', $keys).") VALUES (".implode(', ', $values).")";
}
@@ -520,12 +536,13 @@ class CI_DB_postgre_driver extends CI_DB {
*
* Generates a platform-specific insert string from the supplied data
*
+ * @access public
* @param string the table name
* @param array the insert keys
* @param array the insert values
* @return string
*/
- public function _insert_batch($table, $keys, $values)
+ function _insert_batch($table, $keys, $values)
{
return "INSERT INTO ".$table." (".implode(', ', $keys).") VALUES ".implode(', ', $values);
}
@@ -537,6 +554,7 @@ class CI_DB_postgre_driver extends CI_DB {
*
* Generates a platform-specific update string from the supplied data
*
+ * @access public
* @param string the table name
* @param array the update data
* @param array the where clause
@@ -544,7 +562,7 @@ class CI_DB_postgre_driver extends CI_DB {
* @param array the limit clause
* @return string
*/
- public function _update($table, $values, $where, $orderby = array(), $limit = FALSE)
+ function _update($table, $values, $where, $orderby = array(), $limit = FALSE)
{
foreach ($values as $key => $val)
{
@@ -567,10 +585,11 @@ class CI_DB_postgre_driver extends CI_DB {
* If the database does not support the truncate() command
* This function maps to "DELETE FROM table"
*
+ * @access public
* @param string the table name
* @return string
*/
- public function _truncate($table)
+ function _truncate($table)
{
return "TRUNCATE ".$table;
}
@@ -582,12 +601,13 @@ class CI_DB_postgre_driver extends CI_DB {
*
* Generates a platform-specific delete string from the supplied data
*
+ * @access public
* @param string the table name
* @param array the where clause
* @param string the limit clause
* @return string
*/
- public function _delete($table, $where = array(), $like = array(), $limit = FALSE)
+ function _delete($table, $where = array(), $like = array(), $limit = FALSE)
{
$conditions = '';
@@ -612,12 +632,13 @@ class CI_DB_postgre_driver extends CI_DB {
*
* 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
*/
- public function _limit($sql, $limit, $offset)
+ function _limit($sql, $limit, $offset)
{
$sql .= "LIMIT ".$limit;
@@ -634,14 +655,18 @@ class CI_DB_postgre_driver extends CI_DB {
/**
* Close DB Connection
*
+ * @access public
* @param resource
* @return void
*/
- public function _close($conn_id)
+ function _close($conn_id)
{
@pg_close($conn_id);
}
+
+
}
+
/* End of file postgre_driver.php */
-/* Location: ./system/database/drivers/postgre/postgre_driver.php */ \ No newline at end of file
+/* Location: ./system/database/drivers/postgre/postgre_driver.php */
diff --git a/system/database/drivers/postgre/postgre_forge.php b/system/database/drivers/postgre/postgre_forge.php
index 2aa6ee82a..577100544 100644
--- a/system/database/drivers/postgre/postgre_forge.php
+++ b/system/database/drivers/postgre/postgre_forge.php
@@ -39,10 +39,11 @@ class CI_DB_postgre_forge extends CI_DB_forge {
/**
* Create database
*
+ * @access private
* @param string the database name
* @return bool
*/
- protected function _create_database($name)
+ function _create_database($name)
{
return "CREATE DATABASE ".$name;
}
@@ -52,10 +53,11 @@ class CI_DB_postgre_forge extends CI_DB_forge {
/**
* Drop database
*
+ * @access private
* @param string the database name
* @return bool
*/
- protected function _drop_database($name)
+ function _drop_database($name)
{
return "DROP DATABASE ".$name;
}
@@ -68,7 +70,7 @@ class CI_DB_postgre_forge extends CI_DB_forge {
* @param mixed the fields
* @return string
*/
- protected function _process_fields($fields, $primary_keys=array())
+ function _process_fields($fields, $primary_keys=array())
{
$sql = '';
$current_field_count = 0;
@@ -175,6 +177,7 @@ class CI_DB_postgre_forge extends CI_DB_forge {
/**
* Create Table
*
+ * @access private
* @param string the table name
* @param array the fields
* @param mixed primary key(s)
@@ -182,7 +185,7 @@ class CI_DB_postgre_forge extends CI_DB_forge {
* @param boolean should 'IF NOT EXISTS' be added to the SQL
* @return bool
*/
- protected function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists)
+ function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists)
{
$sql = 'CREATE TABLE ';
@@ -238,11 +241,8 @@ class CI_DB_postgre_forge extends CI_DB_forge {
/**
* Drop Table
- *
- * @param string the table name
- * @return string
*/
- protected function _drop_table($table)
+ function _drop_table($table)
{
return "DROP TABLE IF EXISTS ".$this->db->_escape_identifiers($table)." CASCADE";
}
@@ -255,6 +255,7 @@ class CI_DB_postgre_forge extends CI_DB_forge {
* Generates a platform-specific query so that a table can be altered
* Called by add_column(), drop_column(), and column_alter(),
*
+ * @access private
* @param string the ALTER type (ADD, DROP, CHANGE)
* @param string the column name
* @param string the table name
@@ -264,7 +265,7 @@ class CI_DB_postgre_forge extends CI_DB_forge {
* @param string the field after which we should add the new field
* @return object
*/
- protected function _alter_table($alter_type, $table, $fields, $after_field = '')
+ function _alter_table($alter_type, $table, $fields, $after_field = '')
{
$sql = 'ALTER TABLE '.$this->db->protect_identifiers($table).' '.$alter_type.' ';
@@ -291,15 +292,16 @@ class CI_DB_postgre_forge extends CI_DB_forge {
*
* Generates a platform-specific query so that a table can be renamed
*
+ * @access private
* @param string the old table name
* @param string the new table name
* @return string
*/
- protected function _rename_table($table_name, $new_table_name)
+ function _rename_table($table_name, $new_table_name)
{
return 'ALTER TABLE '.$this->db->protect_identifiers($table_name).' RENAME TO '.$this->db->protect_identifiers($new_table_name);
}
}
/* End of file postgre_forge.php */
-/* Location: ./system/database/drivers/postgre/postgre_forge.php */ \ No newline at end of file
+/* Location: ./system/database/drivers/postgre/postgre_forge.php */
diff --git a/system/database/drivers/postgre/postgre_result.php b/system/database/drivers/postgre/postgre_result.php
index b27afaedb..12d7547c5 100644
--- a/system/database/drivers/postgre/postgre_result.php
+++ b/system/database/drivers/postgre/postgre_result.php
@@ -41,9 +41,10 @@ class CI_DB_postgre_result extends CI_DB_result {
/**
* Number of rows in the result set
*
+ * @access public
* @return integer
*/
- public function num_rows()
+ function num_rows()
{
return @pg_num_rows($this->result_id);
}
@@ -53,9 +54,10 @@ class CI_DB_postgre_result extends CI_DB_result {
/**
* Number of fields in the result set
*
+ * @access public
* @return integer
*/
- public function num_fields()
+ function num_fields()
{
return @pg_num_fields($this->result_id);
}
@@ -67,9 +69,10 @@ class CI_DB_postgre_result extends CI_DB_result {
*
* Generates an array of column names
*
+ * @access public
* @return array
*/
- public function list_fields()
+ function list_fields()
{
$field_names = array();
for ($i = 0; $i < $this->num_fields(); $i++)
@@ -87,9 +90,10 @@ class CI_DB_postgre_result extends CI_DB_result {
*
* Generates an array of objects containing field meta-data
*
+ * @access public
* @return array
*/
- public function field_data()
+ function field_data()
{
$retval = array();
for ($i = 0; $i < $this->num_fields(); $i++)
@@ -114,7 +118,7 @@ class CI_DB_postgre_result extends CI_DB_result {
*
* @return null
*/
- public function free_result()
+ function free_result()
{
if (is_resource($this->result_id))
{
@@ -132,9 +136,10 @@ class CI_DB_postgre_result extends CI_DB_result {
* this internally before fetching results to make sure the
* result set starts at zero
*
+ * @access private
* @return array
*/
- protected function _data_seek($n = 0)
+ function _data_seek($n = 0)
{
return pg_result_seek($this->result_id, $n);
}
@@ -146,9 +151,10 @@ class CI_DB_postgre_result extends CI_DB_result {
*
* Returns the result set as an array
*
+ * @access private
* @return array
*/
- protected function _fetch_assoc()
+ function _fetch_assoc()
{
return pg_fetch_assoc($this->result_id);
}
@@ -160,13 +166,16 @@ class CI_DB_postgre_result extends CI_DB_result {
*
* Returns the result set as an object
*
+ * @access private
* @return object
*/
- protected function _fetch_object()
+ function _fetch_object()
{
return pg_fetch_object($this->result_id);
}
+
}
+
/* End of file postgre_result.php */
/* Location: ./system/database/drivers/postgre/postgre_result.php */ \ No newline at end of file
diff --git a/system/database/drivers/postgre/postgre_utility.php b/system/database/drivers/postgre/postgre_utility.php
index cf29201ff..e31a6db8f 100644
--- a/system/database/drivers/postgre/postgre_utility.php
+++ b/system/database/drivers/postgre/postgre_utility.php
@@ -78,7 +78,7 @@ class CI_DB_postgre_utility extends CI_DB_utility {
* @param array Preferences
* @return mixed
*/
- public function _backup($params = array())
+ function _backup($params = array())
{
// Currently unsupported
return $this->db->display_error('db_unsuported_feature');
@@ -86,4 +86,4 @@ class CI_DB_postgre_utility extends CI_DB_utility {
}
/* End of file postgre_utility.php */
-/* Location: ./system/database/drivers/postgre/postgre_utility.php */ \ No newline at end of file
+/* Location: ./system/database/drivers/postgre/postgre_utility.php */