summaryrefslogtreecommitdiffstats
path: root/system/database/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'system/database/drivers')
-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, 50 insertions, 86 deletions
diff --git a/system/database/drivers/postgre/postgre_driver.php b/system/database/drivers/postgre/postgre_driver.php
index fad9539ff..6ef83726a 100644
--- a/system/database/drivers/postgre/postgre_driver.php
+++ b/system/database/drivers/postgre/postgre_driver.php
@@ -42,29 +42,28 @@
*/
class CI_DB_postgre_driver extends CI_DB {
- var $dbdriver = 'postgre';
+ public $dbdriver = 'postgre';
- var $_escape_char = '"';
+ protected $_escape_char = '"';
// clause and character used for LIKE escape sequences
- var $_like_escape_str = " ESCAPE '%s' ";
- var $_like_escape_chr = '!';
+ protected $_like_escape_str = " ESCAPE '%s' ";
+ protected $_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.
*/
- var $_count_string = "SELECT COUNT(*) AS ";
- var $_random_keyword = ' RANDOM()'; // database specific random keyword
+ protected $_count_string = "SELECT COUNT(*) AS ";
+ protected $_random_keyword = ' RANDOM()'; // database specific random keyword
/**
* Connection String
*
- * @access private
* @return string
*/
- function _connect_string()
+ protected function _connect_string()
{
$components = array(
'hostname' => 'host',
@@ -90,10 +89,9 @@ class CI_DB_postgre_driver extends CI_DB {
/**
* Non-persistent database connection
*
- * @access private called by the base class
* @return resource
*/
- function db_connect()
+ protected function db_connect()
{
return @pg_connect($this->_connect_string());
}
@@ -103,10 +101,9 @@ class CI_DB_postgre_driver extends CI_DB {
/**
* Persistent database connection
*
- * @access private called by the base class
* @return resource
*/
- function db_pconnect()
+ protected function db_pconnect()
{
return @pg_pconnect($this->_connect_string());
}
@@ -119,10 +116,9 @@ 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
*/
- function reconnect()
+ public function reconnect()
{
if (pg_ping($this->conn_id) === FALSE)
{
@@ -135,10 +131,9 @@ class CI_DB_postgre_driver extends CI_DB {
/**
* Select the database
*
- * @access private called by the base class
* @return resource
*/
- function db_select()
+ protected function db_select()
{
// Not needed for Postgre so we'll return TRUE
return TRUE;
@@ -191,11 +186,10 @@ 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
*/
- function _execute($sql)
+ protected function _execute($sql)
{
return @pg_query($this->conn_id, $sql);
}
@@ -264,12 +258,11 @@ 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
*/
- function escape_str($str, $like = FALSE)
+ public function escape_str($str, $like = FALSE)
{
if (is_array($str))
{
@@ -299,10 +292,9 @@ class CI_DB_postgre_driver extends CI_DB {
/**
* Affected Rows
*
- * @access public
* @return integer
*/
- function affected_rows()
+ public function affected_rows()
{
return @pg_affected_rows($this->result_id);
}
@@ -312,10 +304,9 @@ class CI_DB_postgre_driver extends CI_DB {
/**
* Insert ID
*
- * @access public
* @return integer
*/
- function insert_id()
+ public function insert_id()
{
$v = $this->version();
@@ -355,11 +346,10 @@ 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
*/
- function count_all($table = '')
+ public function count_all($table = '')
{
if ($table == '')
{
@@ -384,11 +374,10 @@ 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
*/
- function _list_tables($prefix_limit = FALSE)
+ protected function _list_tables($prefix_limit = FALSE)
{
$sql = "SELECT table_name FROM information_schema.tables WHERE table_schema = 'public'";
@@ -407,11 +396,10 @@ 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
*/
- function _list_columns($table = '')
+ public function _list_columns($table = '')
{
return "SELECT column_name FROM information_schema.columns WHERE table_name ='".$table."'";
}
@@ -423,11 +411,10 @@ 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
*/
- function _field_data($table)
+ public function _field_data($table)
{
return "SELECT * FROM ".$table." LIMIT 1";
}
@@ -454,11 +441,10 @@ class CI_DB_postgre_driver extends CI_DB {
*
* This function escapes column and table names
*
- * @access private
* @param string
* @return string
*/
- function _escape_identifiers($item)
+ protected function _escape_identifiers($item)
{
if ($this->_escape_char == '')
{
@@ -497,11 +483,10 @@ 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
*/
- function _from_tables($tables)
+ public function _from_tables($tables)
{
if ( ! is_array($tables))
{
@@ -518,13 +503,12 @@ 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
*/
- function _insert($table, $keys, $values)
+ public function _insert($table, $keys, $values)
{
return "INSERT INTO ".$table." (".implode(', ', $keys).") VALUES (".implode(', ', $values).")";
}
@@ -536,13 +520,12 @@ 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
*/
- function _insert_batch($table, $keys, $values)
+ public function _insert_batch($table, $keys, $values)
{
return "INSERT INTO ".$table." (".implode(', ', $keys).") VALUES ".implode(', ', $values);
}
@@ -554,7 +537,6 @@ 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
@@ -562,7 +544,7 @@ class CI_DB_postgre_driver extends CI_DB {
* @param array the limit clause
* @return string
*/
- function _update($table, $values, $where, $orderby = array(), $limit = FALSE)
+ public function _update($table, $values, $where, $orderby = array(), $limit = FALSE)
{
foreach ($values as $key => $val)
{
@@ -585,11 +567,10 @@ 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
*/
- function _truncate($table)
+ public function _truncate($table)
{
return "TRUNCATE ".$table;
}
@@ -601,13 +582,12 @@ 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
*/
- function _delete($table, $where = array(), $like = array(), $limit = FALSE)
+ public function _delete($table, $where = array(), $like = array(), $limit = FALSE)
{
$conditions = '';
@@ -632,13 +612,12 @@ 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
*/
- function _limit($sql, $limit, $offset)
+ public function _limit($sql, $limit, $offset)
{
$sql .= "LIMIT ".$limit;
@@ -655,18 +634,14 @@ class CI_DB_postgre_driver extends CI_DB {
/**
* Close DB Connection
*
- * @access public
* @param resource
* @return void
*/
- function _close($conn_id)
+ public function _close($conn_id)
{
@pg_close($conn_id);
}
-
-
}
-
/* End of file postgre_driver.php */
-/* Location: ./system/database/drivers/postgre/postgre_driver.php */
+/* Location: ./system/database/drivers/postgre/postgre_driver.php */ \ No newline at end of file
diff --git a/system/database/drivers/postgre/postgre_forge.php b/system/database/drivers/postgre/postgre_forge.php
index 577100544..2aa6ee82a 100644
--- a/system/database/drivers/postgre/postgre_forge.php
+++ b/system/database/drivers/postgre/postgre_forge.php
@@ -39,11 +39,10 @@ class CI_DB_postgre_forge extends CI_DB_forge {
/**
* Create database
*
- * @access private
* @param string the database name
* @return bool
*/
- function _create_database($name)
+ protected function _create_database($name)
{
return "CREATE DATABASE ".$name;
}
@@ -53,11 +52,10 @@ class CI_DB_postgre_forge extends CI_DB_forge {
/**
* Drop database
*
- * @access private
* @param string the database name
* @return bool
*/
- function _drop_database($name)
+ protected function _drop_database($name)
{
return "DROP DATABASE ".$name;
}
@@ -70,7 +68,7 @@ class CI_DB_postgre_forge extends CI_DB_forge {
* @param mixed the fields
* @return string
*/
- function _process_fields($fields, $primary_keys=array())
+ protected function _process_fields($fields, $primary_keys=array())
{
$sql = '';
$current_field_count = 0;
@@ -177,7 +175,6 @@ 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)
@@ -185,7 +182,7 @@ class CI_DB_postgre_forge extends CI_DB_forge {
* @param boolean should 'IF NOT EXISTS' be added to the SQL
* @return bool
*/
- function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists)
+ protected function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists)
{
$sql = 'CREATE TABLE ';
@@ -241,8 +238,11 @@ class CI_DB_postgre_forge extends CI_DB_forge {
/**
* Drop Table
+ *
+ * @param string the table name
+ * @return string
*/
- function _drop_table($table)
+ protected function _drop_table($table)
{
return "DROP TABLE IF EXISTS ".$this->db->_escape_identifiers($table)." CASCADE";
}
@@ -255,7 +255,6 @@ 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
@@ -265,7 +264,7 @@ class CI_DB_postgre_forge extends CI_DB_forge {
* @param string the field after which we should add the new field
* @return object
*/
- function _alter_table($alter_type, $table, $fields, $after_field = '')
+ protected function _alter_table($alter_type, $table, $fields, $after_field = '')
{
$sql = 'ALTER TABLE '.$this->db->protect_identifiers($table).' '.$alter_type.' ';
@@ -292,16 +291,15 @@ 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
*/
- function _rename_table($table_name, $new_table_name)
+ protected 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 */
+/* Location: ./system/database/drivers/postgre/postgre_forge.php */ \ No newline at end of file
diff --git a/system/database/drivers/postgre/postgre_result.php b/system/database/drivers/postgre/postgre_result.php
index 12d7547c5..b27afaedb 100644
--- a/system/database/drivers/postgre/postgre_result.php
+++ b/system/database/drivers/postgre/postgre_result.php
@@ -41,10 +41,9 @@ class CI_DB_postgre_result extends CI_DB_result {
/**
* Number of rows in the result set
*
- * @access public
* @return integer
*/
- function num_rows()
+ public function num_rows()
{
return @pg_num_rows($this->result_id);
}
@@ -54,10 +53,9 @@ class CI_DB_postgre_result extends CI_DB_result {
/**
* Number of fields in the result set
*
- * @access public
* @return integer
*/
- function num_fields()
+ public function num_fields()
{
return @pg_num_fields($this->result_id);
}
@@ -69,10 +67,9 @@ class CI_DB_postgre_result extends CI_DB_result {
*
* Generates an array of column names
*
- * @access public
* @return array
*/
- function list_fields()
+ public function list_fields()
{
$field_names = array();
for ($i = 0; $i < $this->num_fields(); $i++)
@@ -90,10 +87,9 @@ class CI_DB_postgre_result extends CI_DB_result {
*
* Generates an array of objects containing field meta-data
*
- * @access public
* @return array
*/
- function field_data()
+ public function field_data()
{
$retval = array();
for ($i = 0; $i < $this->num_fields(); $i++)
@@ -118,7 +114,7 @@ class CI_DB_postgre_result extends CI_DB_result {
*
* @return null
*/
- function free_result()
+ public function free_result()
{
if (is_resource($this->result_id))
{
@@ -136,10 +132,9 @@ 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
*/
- function _data_seek($n = 0)
+ protected function _data_seek($n = 0)
{
return pg_result_seek($this->result_id, $n);
}
@@ -151,10 +146,9 @@ class CI_DB_postgre_result extends CI_DB_result {
*
* Returns the result set as an array
*
- * @access private
* @return array
*/
- function _fetch_assoc()
+ protected function _fetch_assoc()
{
return pg_fetch_assoc($this->result_id);
}
@@ -166,16 +160,13 @@ class CI_DB_postgre_result extends CI_DB_result {
*
* Returns the result set as an object
*
- * @access private
* @return object
*/
- function _fetch_object()
+ protected 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 e31a6db8f..cf29201ff 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
*/
- function _backup($params = array())
+ public 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 */
+/* Location: ./system/database/drivers/postgre/postgre_utility.php */ \ No newline at end of file