summaryrefslogtreecommitdiffstats
path: root/system/database/drivers/postgre/postgre_forge.php
diff options
context:
space:
mode:
Diffstat (limited to 'system/database/drivers/postgre/postgre_forge.php')
-rw-r--r--system/database/drivers/postgre/postgre_forge.php85
1 files changed, 14 insertions, 71 deletions
diff --git a/system/database/drivers/postgre/postgre_forge.php b/system/database/drivers/postgre/postgre_forge.php
index 4a7348aa6..8b214ebe6 100644
--- a/system/database/drivers/postgre/postgre_forge.php
+++ b/system/database/drivers/postgre/postgre_forge.php
@@ -1,13 +1,13 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* CodeIgniter
*
- * An open source application development framework for PHP 5.1.6 or newer
+ * An open source application development framework for PHP 5.2.4 or newer
*
* NOTICE OF LICENSE
- *
+ *
* Licensed under the Open Software License version 3.0
- *
+ *
* This source file is subject to the Open Software License (OSL 3.0) that is
* bundled with this package in the files license.txt / license.rst. It is
* also available through the world wide web at this URL:
@@ -25,8 +25,6 @@
* @filesource
*/
-// ------------------------------------------------------------------------
-
/**
* Postgre Forge Class
*
@@ -36,46 +34,20 @@
*/
class CI_DB_postgre_forge extends CI_DB_forge {
- /**
- * Create database
- *
- * @access private
- * @param string the database name
- * @return bool
- */
- function _create_database($name)
- {
- return "CREATE DATABASE ".$name;
- }
+ protected $_drop_table = 'DROP TABLE IF EXISTS %s CASCADE';
- // --------------------------------------------------------------------
-
- /**
- * Drop database
- *
- * @access private
- * @param string the database name
- * @return bool
- */
- function _drop_database($name)
- {
- return "DROP DATABASE ".$name;
- }
-
- // --------------------------------------------------------------------
-
/**
* Process Fields
*
* @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;
- foreach ($fields as $field=>$attributes)
+ foreach ($fields as $field => $attributes)
{
// Numeric field names aren't allowed in databases, so if the key is
// numeric, we know it was assigned by PHP and the developer manually
@@ -168,7 +140,7 @@ class CI_DB_postgre_forge extends CI_DB_forge {
$sql .= ',';
}
}
-
+
return $sql;
}
@@ -177,15 +149,14 @@ 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)
* @param mixed key(s)
- * @param boolean should 'IF NOT EXISTS' be added to the SQL
+ * @param bool 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 ';
@@ -198,8 +169,7 @@ class CI_DB_postgre_forge extends CI_DB_forge {
}
}
- $sql .= $this->db->_escape_identifiers($table)." (";
- $sql .= $this->_process_fields($fields, $primary_keys);
+ $sql .= $this->db->escape_identifiers($table).' ('.$this->_process_fields($fields, $primary_keys);
if (count($primary_keys) > 0)
{
@@ -240,22 +210,11 @@ class CI_DB_postgre_forge extends CI_DB_forge {
// --------------------------------------------------------------------
/**
- * Drop Table
- */
- function _drop_table($table)
- {
- return "DROP TABLE IF EXISTS ".$this->db->_escape_identifiers($table)." CASCADE";
- }
-
- // --------------------------------------------------------------------
-
- /**
* Alter table query
*
* 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
@@ -263,9 +222,9 @@ class CI_DB_postgre_forge extends CI_DB_forge {
* @param string the default value
* @param boolean should 'NOT NULL' be added
* @param string the field after which we should add the new field
- * @return object
+ * @return string
*/
- 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.' ';
@@ -285,23 +244,7 @@ class CI_DB_postgre_forge extends CI_DB_forge {
return $sql;
}
- // --------------------------------------------------------------------
-
- /**
- * Rename a table
- *
- * 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)
- {
- 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