summaryrefslogtreecommitdiffstats
path: root/system/database/DB_forge.php
diff options
context:
space:
mode:
authorBarry Mieny <barry@mieny.com>2010-10-04 16:33:58 +0200
committerBarry Mieny <barry@mieny.com>2010-10-04 16:33:58 +0200
commitdd6719738936be31cdaa1758ca86d5eb14dcab3d (patch)
treeb5ef66e31b2d0f4f2c1cbccc367bde92c156e1f9 /system/database/DB_forge.php
parent3351fbc56cea19ec3dd603836beb0a420b1ded65 (diff)
Cleanup of stray spaces and tabs
Diffstat (limited to 'system/database/DB_forge.php')
-rw-r--r--system/database/DB_forge.php72
1 files changed, 36 insertions, 36 deletions
diff --git a/system/database/DB_forge.php b/system/database/DB_forge.php
index 8be65e0d6..74aed8610 100644
--- a/system/database/DB_forge.php
+++ b/system/database/DB_forge.php
@@ -24,9 +24,9 @@
*/
class CI_DB_forge {
- var $fields = array();
+ var $fields = array();
var $keys = array();
- var $primary_keys = array();
+ var $primary_keys = array();
var $db_char_set = '';
/**
@@ -34,7 +34,7 @@ class CI_DB_forge {
*
* Grabs the CI super object instance so we can access it.
*
- */
+ */
function CI_DB_forge()
{
// Assign the main database object to $this->db
@@ -55,12 +55,12 @@ class CI_DB_forge {
function create_database($db_name)
{
$sql = $this->_create_database($db_name);
-
+
if (is_bool($sql))
{
return $sql;
}
-
+
return $this->db->query($sql);
}
@@ -76,12 +76,12 @@ class CI_DB_forge {
function drop_database($db_name)
{
$sql = $this->_drop_database($db_name);
-
+
if (is_bool($sql))
{
return $sql;
}
-
+
return $this->db->query($sql);
}
@@ -103,15 +103,15 @@ class CI_DB_forge {
{
$this->add_key($one, $primary);
}
-
+
return;
}
-
+
if ($key == '')
{
show_error('Key information is required for that operation.');
}
-
+
if ($primary === TRUE)
{
$this->primary_keys[] = $key;
@@ -137,7 +137,7 @@ class CI_DB_forge {
{
show_error('Field information is required.');
}
-
+
if (is_string($field))
{
if ($field == 'id')
@@ -157,16 +157,16 @@ class CI_DB_forge {
{
show_error('Field information is required for that operation.');
}
-
+
$this->fields[] = $field;
}
}
-
+
if (is_array($field))
{
$this->fields = array_merge($this->fields, $field);
}
-
+
}
// --------------------------------------------------------------------
@@ -179,19 +179,19 @@ class CI_DB_forge {
* @return bool
*/
function create_table($table = '', $if_not_exists = FALSE)
- {
+ {
if ($table == '')
{
show_error('A table name is required for that operation.');
}
-
+
if (count($this->fields) == 0)
- {
+ {
show_error('Field information is required.');
}
$sql = $this->_create_table($this->db->dbprefix.$table, $this->fields, $this->primary_keys, $this->keys, $if_not_exists);
-
+
$this->_reset();
return $this->db->query($sql);
}
@@ -208,12 +208,12 @@ class CI_DB_forge {
function drop_table($table_name)
{
$sql = $this->_drop_table($this->db->dbprefix.$table_name);
-
+
if (is_bool($sql))
{
return $sql;
}
-
+
return $this->db->query($sql);
}
@@ -233,7 +233,7 @@ class CI_DB_forge {
{
show_error('A table name is required for that operation.');
}
-
+
$sql = $this->_rename_table($table_name, $new_table_name);
return $this->db->query($sql);
}
@@ -259,25 +259,25 @@ class CI_DB_forge {
// add field info into field array, but we can only do one at a time
// so we cycle through
- foreach ($field as $k => $v)
- {
- $this->add_field(array($k => $field[$k]));
+ foreach ($field as $k => $v)
+ {
+ $this->add_field(array($k => $field[$k]));
if (count($this->fields) == 0)
- {
+ {
show_error('Field information is required.');
}
-
+
$sql = $this->_alter_table('ADD', $this->db->dbprefix.$table, $this->fields, $after_field);
$this->_reset();
-
+
if ($this->db->query($sql) === FALSE)
{
return FALSE;
}
}
-
+
return TRUE;
}
@@ -294,7 +294,7 @@ class CI_DB_forge {
*/
function drop_column($table = '', $column_name = '')
{
-
+
if ($table == '')
{
show_error('A table name is required for that operation.');
@@ -306,7 +306,7 @@ class CI_DB_forge {
}
$sql = $this->_alter_table('DROP', $this->db->dbprefix.$table, $column_name);
-
+
return $this->db->query($sql);
}
@@ -336,20 +336,20 @@ class CI_DB_forge {
$this->add_field(array($k => $field[$k]));
if (count($this->fields) == 0)
- {
+ {
show_error('Field information is required.');
}
-
+
$sql = $this->_alter_table('CHANGE', $this->db->dbprefix.$table, $this->fields);
$this->_reset();
-
+
if ($this->db->query($sql) === FALSE)
{
return FALSE;
}
}
-
+
return TRUE;
}
@@ -365,9 +365,9 @@ class CI_DB_forge {
*/
function _reset()
{
- $this->fields = array();
+ $this->fields = array();
$this->keys = array();
- $this->primary_keys = array();
+ $this->primary_keys = array();
}
}