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/index.html2
-rw-r--r--system/database/drivers/postgre/postgre_driver.php25
-rw-r--r--system/database/drivers/postgre/postgre_forge.php8
-rw-r--r--system/database/drivers/postgre/postgre_result.php4
-rw-r--r--system/database/drivers/postgre/postgre_utility.php2
5 files changed, 16 insertions, 25 deletions
diff --git a/system/database/drivers/postgre/index.html b/system/database/drivers/postgre/index.html
index b702fbc39..bcb7cae34 100644
--- a/system/database/drivers/postgre/index.html
+++ b/system/database/drivers/postgre/index.html
@@ -1,5 +1,5 @@
<!DOCTYPE html>
-<html>
+<html lang="en">
<head>
<title>403 Forbidden</title>
</head>
diff --git a/system/database/drivers/postgre/postgre_driver.php b/system/database/drivers/postgre/postgre_driver.php
index 19a09490c..22638f901 100644
--- a/system/database/drivers/postgre/postgre_driver.php
+++ b/system/database/drivers/postgre/postgre_driver.php
@@ -48,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Drivers
* @category Database
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*/
class CI_DB_postgre_driver extends CI_DB {
@@ -78,22 +78,12 @@ class CI_DB_postgre_driver extends CI_DB {
// --------------------------------------------------------------------
/**
- * Class constructor
+ * Build DSN
*
- * Creates a DSN string to be used for db_connect() and db_pconnect()
- *
- * @param array $params
* @return void
*/
- public function __construct($params)
+ protected function _build_dsn()
{
- parent::__construct($params);
-
- if ( ! empty($this->dsn))
- {
- return;
- }
-
$this->dsn === '' OR $this->dsn = '';
if (strpos($this->hostname, '/') !== FALSE)
@@ -145,10 +135,11 @@ class CI_DB_postgre_driver extends CI_DB {
* Database connection
*
* @param bool $persistent
- * @return resource
+ * @return resource|object
*/
public function db_connect($persistent = FALSE)
{
+ empty($this->dsn) && $this->_build_dsn();
$this->conn_id = ($persistent === TRUE)
? pg_pconnect($this->dsn)
: pg_connect($this->dsn);
@@ -229,7 +220,7 @@ class CI_DB_postgre_driver extends CI_DB {
* Execute the query
*
* @param string $sql an SQL query
- * @return resource
+ * @return resource|object
*/
protected function _execute($sql)
{
@@ -422,7 +413,7 @@ class CI_DB_postgre_driver extends CI_DB {
{
return 'SELECT "column_name"
FROM "information_schema"."columns"
- WHERE LOWER("table_name") = '.$this->escape(strtolower($table));
+ WHERE "table_schema" = \''.$this->schema.'\' AND LOWER("table_name") = '.$this->escape(strtolower($table));
}
// --------------------------------------------------------------------
@@ -437,7 +428,7 @@ class CI_DB_postgre_driver extends CI_DB {
{
$sql = 'SELECT "column_name", "data_type", "character_maximum_length", "numeric_precision", "column_default"
FROM "information_schema"."columns"
- WHERE LOWER("table_name") = '.$this->escape(strtolower($table));
+ WHERE "table_schema" = \''.$this->schema.'\' AND LOWER("table_name") = '.$this->escape(strtolower($table));
if (($query = $this->query($sql)) === FALSE)
{
diff --git a/system/database/drivers/postgre/postgre_forge.php b/system/database/drivers/postgre/postgre_forge.php
index 353ddac99..6f214c665 100644
--- a/system/database/drivers/postgre/postgre_forge.php
+++ b/system/database/drivers/postgre/postgre_forge.php
@@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Drivers
* @category Database
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*/
class CI_DB_postgre_forge extends CI_DB_forge {
@@ -101,7 +101,7 @@ class CI_DB_postgre_forge extends CI_DB_forge {
* @return string|string[]
*/
protected function _alter_table($alter_type, $table, $field)
- {
+ {
if (in_array($alter_type, array('DROP', 'ADD'), TRUE))
{
return parent::_alter_table($alter_type, $table, $field);
@@ -125,7 +125,7 @@ class CI_DB_postgre_forge extends CI_DB_forge {
if ( ! empty($field[$i]['default']))
{
$sqls[] = $sql.' ALTER COLUMN '.$this->db->escape_identifiers($field[$i]['name'])
- .' SET DEFAULT '.$field[$i]['default'];
+ .' SET '.$field[$i]['default'];
}
if (isset($field[$i]['null']))
@@ -149,7 +149,7 @@ class CI_DB_postgre_forge extends CI_DB_forge {
}
return $sqls;
- }
+ }
// --------------------------------------------------------------------
diff --git a/system/database/drivers/postgre/postgre_result.php b/system/database/drivers/postgre/postgre_result.php
index b0054ddae..d977a60e3 100644
--- a/system/database/drivers/postgre/postgre_result.php
+++ b/system/database/drivers/postgre/postgre_result.php
@@ -46,7 +46,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Drivers
* @category Database
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*/
class CI_DB_postgre_result extends CI_DB_result {
@@ -126,7 +126,7 @@ class CI_DB_postgre_result extends CI_DB_result {
*/
public function free_result()
{
- if (is_resource($this->result_id))
+ if ($this->result_id !== FALSE)
{
pg_free_result($this->result_id);
$this->result_id = FALSE;
diff --git a/system/database/drivers/postgre/postgre_utility.php b/system/database/drivers/postgre/postgre_utility.php
index 450aa36e4..e6e7b28ba 100644
--- a/system/database/drivers/postgre/postgre_utility.php
+++ b/system/database/drivers/postgre/postgre_utility.php
@@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Drivers
* @category Database
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/database/
+ * @link https://codeigniter.com/userguide3/database/
*/
class CI_DB_postgre_utility extends CI_DB_utility {