Andrey Andreev | 24276a3 | 2012-01-08 02:44:38 +0200 | [diff] [blame] | 1 | <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 2 | /** |
Derek Jones | f4a4bd8 | 2011-10-20 12:18:42 -0500 | [diff] [blame] | 3 | * CodeIgniter |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 4 | * |
Greg Aker | 741de1c | 2010-11-10 14:52:57 -0600 | [diff] [blame] | 5 | * An open source application development framework for PHP 5.1.6 or newer |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 6 | * |
Derek Jones | f4a4bd8 | 2011-10-20 12:18:42 -0500 | [diff] [blame] | 7 | * NOTICE OF LICENSE |
Andrey Andreev | 24276a3 | 2012-01-08 02:44:38 +0200 | [diff] [blame] | 8 | * |
Derek Jones | f4a4bd8 | 2011-10-20 12:18:42 -0500 | [diff] [blame] | 9 | * Licensed under the Open Software License version 3.0 |
Andrey Andreev | 24276a3 | 2012-01-08 02:44:38 +0200 | [diff] [blame] | 10 | * |
Derek Jones | f4a4bd8 | 2011-10-20 12:18:42 -0500 | [diff] [blame] | 11 | * This source file is subject to the Open Software License (OSL 3.0) that is |
| 12 | * bundled with this package in the files license.txt / license.rst. It is |
| 13 | * also available through the world wide web at this URL: |
| 14 | * http://opensource.org/licenses/OSL-3.0 |
| 15 | * If you did not receive a copy of the license and are unable to obtain it |
| 16 | * through the world wide web, please send an email to |
| 17 | * licensing@ellislab.com so we can send you a copy immediately. |
| 18 | * |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 19 | * @package CodeIgniter |
Derek Jones | f4a4bd8 | 2011-10-20 12:18:42 -0500 | [diff] [blame] | 20 | * @author EllisLab Dev Team |
Greg Aker | 0defe5d | 2012-01-01 18:46:41 -0600 | [diff] [blame] | 21 | * @copyright Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/) |
Derek Jones | f4a4bd8 | 2011-10-20 12:18:42 -0500 | [diff] [blame] | 22 | * @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 23 | * @link http://codeigniter.com |
| 24 | * @since Version 1.0 |
| 25 | * @filesource |
| 26 | */ |
| 27 | |
| 28 | // ------------------------------------------------------------------------ |
| 29 | |
| 30 | /** |
| 31 | * Database Utility Class |
| 32 | * |
| 33 | * @category Database |
Derek Jones | f4a4bd8 | 2011-10-20 12:18:42 -0500 | [diff] [blame] | 34 | * @author EllisLab Dev Team |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 35 | * @link http://codeigniter.com/user_guide/database/ |
| 36 | */ |
| 37 | class CI_DB_forge { |
| 38 | |
Andrey Andreev | 24276a3 | 2012-01-08 02:44:38 +0200 | [diff] [blame] | 39 | public $fields = array(); |
| 40 | public $keys = array(); |
| 41 | public $primary_keys = array(); |
| 42 | public $db_char_set = ''; |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 43 | |
Andrey Andreev | 24276a3 | 2012-01-08 02:44:38 +0200 | [diff] [blame] | 44 | public function __construct() |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 45 | { |
| 46 | // Assign the main database object to $this->db |
| 47 | $CI =& get_instance(); |
| 48 | $this->db =& $CI->db; |
Andrey Andreev | 24276a3 | 2012-01-08 02:44:38 +0200 | [diff] [blame] | 49 | log_message('debug', 'Database Forge Class Initialized'); |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 50 | } |
| 51 | |
| 52 | // -------------------------------------------------------------------- |
| 53 | |
| 54 | /** |
| 55 | * Create database |
| 56 | * |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 57 | * @param string the database name |
| 58 | * @return bool |
| 59 | */ |
Andrey Andreev | 24276a3 | 2012-01-08 02:44:38 +0200 | [diff] [blame] | 60 | public function create_database($db_name) |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 61 | { |
| 62 | $sql = $this->_create_database($db_name); |
Andrey Andreev | 24276a3 | 2012-01-08 02:44:38 +0200 | [diff] [blame] | 63 | return is_bool($sql) ? $sql : $this->db->query($sql); |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 64 | } |
| 65 | |
| 66 | // -------------------------------------------------------------------- |
| 67 | |
| 68 | /** |
| 69 | * Drop database |
| 70 | * |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 71 | * @param string the database name |
| 72 | * @return bool |
| 73 | */ |
Andrey Andreev | 24276a3 | 2012-01-08 02:44:38 +0200 | [diff] [blame] | 74 | public function drop_database($db_name) |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 75 | { |
| 76 | $sql = $this->_drop_database($db_name); |
Andrey Andreev | 24276a3 | 2012-01-08 02:44:38 +0200 | [diff] [blame] | 77 | return is_bool($sql) ? $sql : $this->db->query($sql); |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 78 | } |
| 79 | |
| 80 | // -------------------------------------------------------------------- |
| 81 | |
| 82 | /** |
| 83 | * Add Key |
| 84 | * |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 85 | * @param string key |
| 86 | * @param string type |
Phil Sturgeon | a7de97e | 2011-12-31 18:41:08 +0000 | [diff] [blame] | 87 | * @return object |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 88 | */ |
Phil Sturgeon | a7de97e | 2011-12-31 18:41:08 +0000 | [diff] [blame] | 89 | public function add_key($key = '', $primary = FALSE) |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 90 | { |
| 91 | if (is_array($key)) |
| 92 | { |
Pascal Kriete | c3a4a8d | 2011-02-14 13:40:08 -0500 | [diff] [blame] | 93 | foreach ($key as $one) |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 94 | { |
| 95 | $this->add_key($one, $primary); |
| 96 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 97 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 98 | return; |
| 99 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 100 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 101 | if ($key == '') |
| 102 | { |
| 103 | show_error('Key information is required for that operation.'); |
| 104 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 105 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 106 | if ($primary === TRUE) |
| 107 | { |
| 108 | $this->primary_keys[] = $key; |
| 109 | } |
| 110 | else |
| 111 | { |
| 112 | $this->keys[] = $key; |
| 113 | } |
Phil Sturgeon | a7de97e | 2011-12-31 18:41:08 +0000 | [diff] [blame] | 114 | |
| 115 | return $this; |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 116 | } |
| 117 | |
| 118 | // -------------------------------------------------------------------- |
| 119 | |
| 120 | /** |
| 121 | * Add Field |
| 122 | * |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 123 | * @param string collation |
Phil Sturgeon | a7de97e | 2011-12-31 18:41:08 +0000 | [diff] [blame] | 124 | * @return object |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 125 | */ |
Phil Sturgeon | a7de97e | 2011-12-31 18:41:08 +0000 | [diff] [blame] | 126 | public function add_field($field = '') |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 127 | { |
| 128 | if ($field == '') |
| 129 | { |
| 130 | show_error('Field information is required.'); |
| 131 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 132 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 133 | if (is_string($field)) |
| 134 | { |
Andrey Andreev | 24276a3 | 2012-01-08 02:44:38 +0200 | [diff] [blame] | 135 | if ($field === 'id') |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 136 | { |
| 137 | $this->add_field(array( |
Phil Sturgeon | a7de97e | 2011-12-31 18:41:08 +0000 | [diff] [blame] | 138 | 'id' => array( |
| 139 | 'type' => 'INT', |
| 140 | 'constraint' => 9, |
| 141 | 'auto_increment' => TRUE |
| 142 | ) |
| 143 | )); |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 144 | $this->add_key('id', TRUE); |
| 145 | } |
| 146 | else |
| 147 | { |
| 148 | if (strpos($field, ' ') === FALSE) |
| 149 | { |
| 150 | show_error('Field information is required for that operation.'); |
| 151 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 152 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 153 | $this->fields[] = $field; |
| 154 | } |
| 155 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 156 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 157 | if (is_array($field)) |
| 158 | { |
| 159 | $this->fields = array_merge($this->fields, $field); |
| 160 | } |
Andrey Andreev | 24276a3 | 2012-01-08 02:44:38 +0200 | [diff] [blame] | 161 | |
Phil Sturgeon | a7de97e | 2011-12-31 18:41:08 +0000 | [diff] [blame] | 162 | return $this; |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 163 | } |
| 164 | |
| 165 | // -------------------------------------------------------------------- |
| 166 | |
| 167 | /** |
| 168 | * Create Table |
| 169 | * |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 170 | * @param string the table name |
| 171 | * @return bool |
| 172 | */ |
Phil Sturgeon | a7de97e | 2011-12-31 18:41:08 +0000 | [diff] [blame] | 173 | public function create_table($table = '', $if_not_exists = FALSE) |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 174 | { |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 175 | if ($table == '') |
| 176 | { |
| 177 | show_error('A table name is required for that operation.'); |
| 178 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 179 | |
Andrey Andreev | 24276a3 | 2012-01-08 02:44:38 +0200 | [diff] [blame] | 180 | if (count($this->fields) === 0) |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 181 | { |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 182 | show_error('Field information is required.'); |
| 183 | } |
| 184 | |
| 185 | $sql = $this->_create_table($this->db->dbprefix.$table, $this->fields, $this->primary_keys, $this->keys, $if_not_exists); |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 186 | $this->_reset(); |
Andrey Andreev | 24276a3 | 2012-01-08 02:44:38 +0200 | [diff] [blame] | 187 | return is_bool($sql) ? $sql : $this->db->query($sql); |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 188 | } |
| 189 | |
| 190 | // -------------------------------------------------------------------- |
| 191 | |
| 192 | /** |
| 193 | * Drop Table |
| 194 | * |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 195 | * @param string the table name |
| 196 | * @return bool |
| 197 | */ |
Phil Sturgeon | a7de97e | 2011-12-31 18:41:08 +0000 | [diff] [blame] | 198 | public function drop_table($table_name) |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 199 | { |
| 200 | $sql = $this->_drop_table($this->db->dbprefix.$table_name); |
Andrey Andreev | 24276a3 | 2012-01-08 02:44:38 +0200 | [diff] [blame] | 201 | return is_bool($sql) ? $sql : $this->db->query($sql); |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 202 | } |
| 203 | |
| 204 | // -------------------------------------------------------------------- |
| 205 | |
| 206 | /** |
| 207 | * Rename Table |
| 208 | * |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 209 | * @param string the old table name |
| 210 | * @param string the new table name |
| 211 | * @return bool |
| 212 | */ |
Phil Sturgeon | a7de97e | 2011-12-31 18:41:08 +0000 | [diff] [blame] | 213 | public function rename_table($table_name, $new_table_name) |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 214 | { |
| 215 | if ($table_name == '' OR $new_table_name == '') |
| 216 | { |
| 217 | show_error('A table name is required for that operation.'); |
| 218 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 219 | |
Andrey Andreev | 24276a3 | 2012-01-08 02:44:38 +0200 | [diff] [blame] | 220 | return $this->db->query($this->_rename_table($this->db->dbprefix.$table_name, $this->db->dbprefix.$new_table_name)); |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 221 | } |
| 222 | |
| 223 | // -------------------------------------------------------------------- |
| 224 | |
| 225 | /** |
| 226 | * Column Add |
| 227 | * |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 228 | * @param string the table name |
| 229 | * @param string the column name |
| 230 | * @param string the column definition |
| 231 | * @return bool |
| 232 | */ |
Phil Sturgeon | a7de97e | 2011-12-31 18:41:08 +0000 | [diff] [blame] | 233 | public function add_column($table = '', $field = array(), $after_field = '') |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 234 | { |
| 235 | if ($table == '') |
| 236 | { |
| 237 | show_error('A table name is required for that operation.'); |
| 238 | } |
| 239 | |
| 240 | // add field info into field array, but we can only do one at a time |
Robin Sowell | 8a54ef2 | 2009-03-04 14:49:53 +0000 | [diff] [blame] | 241 | // so we cycle through |
Andrey Andreev | 24276a3 | 2012-01-08 02:44:38 +0200 | [diff] [blame] | 242 | foreach (array_keys($field) as $k) |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 243 | { |
| 244 | $this->add_field(array($k => $field[$k])); |
Robin Sowell | 8a54ef2 | 2009-03-04 14:49:53 +0000 | [diff] [blame] | 245 | |
| 246 | if (count($this->fields) == 0) |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 247 | { |
Robin Sowell | 8a54ef2 | 2009-03-04 14:49:53 +0000 | [diff] [blame] | 248 | show_error('Field information is required.'); |
| 249 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 250 | |
Robin Sowell | 8a54ef2 | 2009-03-04 14:49:53 +0000 | [diff] [blame] | 251 | $sql = $this->_alter_table('ADD', $this->db->dbprefix.$table, $this->fields, $after_field); |
Robin Sowell | 8a54ef2 | 2009-03-04 14:49:53 +0000 | [diff] [blame] | 252 | $this->_reset(); |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 253 | |
Robin Sowell | 8a54ef2 | 2009-03-04 14:49:53 +0000 | [diff] [blame] | 254 | if ($this->db->query($sql) === FALSE) |
| 255 | { |
| 256 | return FALSE; |
| 257 | } |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 258 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 259 | |
Robin Sowell | 8a54ef2 | 2009-03-04 14:49:53 +0000 | [diff] [blame] | 260 | return TRUE; |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 261 | } |
| 262 | |
| 263 | // -------------------------------------------------------------------- |
| 264 | |
| 265 | /** |
| 266 | * Column Drop |
| 267 | * |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 268 | * @param string the table name |
| 269 | * @param string the column name |
| 270 | * @return bool |
| 271 | */ |
Phil Sturgeon | a7de97e | 2011-12-31 18:41:08 +0000 | [diff] [blame] | 272 | public function drop_column($table = '', $column_name = '') |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 273 | { |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 274 | if ($table == '') |
| 275 | { |
| 276 | show_error('A table name is required for that operation.'); |
| 277 | } |
| 278 | |
| 279 | if ($column_name == '') |
| 280 | { |
| 281 | show_error('A column name is required for that operation.'); |
| 282 | } |
| 283 | |
Andrey Andreev | 24276a3 | 2012-01-08 02:44:38 +0200 | [diff] [blame] | 284 | return $this->db->query($this->_alter_table('DROP', $this->db->dbprefix.$table, $column_name)); |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 285 | } |
| 286 | |
| 287 | // -------------------------------------------------------------------- |
| 288 | |
| 289 | /** |
| 290 | * Column Modify |
| 291 | * |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 292 | * @param string the table name |
| 293 | * @param string the column name |
| 294 | * @param string the column definition |
| 295 | * @return bool |
| 296 | */ |
Phil Sturgeon | a7de97e | 2011-12-31 18:41:08 +0000 | [diff] [blame] | 297 | public function modify_column($table = '', $field = array()) |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 298 | { |
| 299 | if ($table == '') |
| 300 | { |
| 301 | show_error('A table name is required for that operation.'); |
| 302 | } |
| 303 | |
| 304 | // add field info into field array, but we can only do one at a time |
Robin Sowell | 8a54ef2 | 2009-03-04 14:49:53 +0000 | [diff] [blame] | 305 | // so we cycle through |
Andrey Andreev | 24276a3 | 2012-01-08 02:44:38 +0200 | [diff] [blame] | 306 | foreach (array_keys($field) as $k) |
Robin Sowell | 8a54ef2 | 2009-03-04 14:49:53 +0000 | [diff] [blame] | 307 | { |
Phil Sturgeon | a58ecae | 2010-12-15 10:32:10 +0000 | [diff] [blame] | 308 | // If no name provided, use the current name |
| 309 | if ( ! isset($field[$k]['name'])) |
| 310 | { |
| 311 | $field[$k]['name'] = $k; |
| 312 | } |
| 313 | |
Robin Sowell | 8a54ef2 | 2009-03-04 14:49:53 +0000 | [diff] [blame] | 314 | $this->add_field(array($k => $field[$k])); |
Andrey Andreev | 24276a3 | 2012-01-08 02:44:38 +0200 | [diff] [blame] | 315 | if (count($this->fields) === 0) |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 316 | { |
Robin Sowell | 8a54ef2 | 2009-03-04 14:49:53 +0000 | [diff] [blame] | 317 | show_error('Field information is required.'); |
| 318 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 319 | |
Robin Sowell | 8a54ef2 | 2009-03-04 14:49:53 +0000 | [diff] [blame] | 320 | $sql = $this->_alter_table('CHANGE', $this->db->dbprefix.$table, $this->fields); |
Robin Sowell | 8a54ef2 | 2009-03-04 14:49:53 +0000 | [diff] [blame] | 321 | $this->_reset(); |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 322 | |
Robin Sowell | 8a54ef2 | 2009-03-04 14:49:53 +0000 | [diff] [blame] | 323 | if ($this->db->query($sql) === FALSE) |
| 324 | { |
| 325 | return FALSE; |
| 326 | } |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 327 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 328 | |
Robin Sowell | 8a54ef2 | 2009-03-04 14:49:53 +0000 | [diff] [blame] | 329 | return TRUE; |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 330 | } |
| 331 | |
| 332 | // -------------------------------------------------------------------- |
| 333 | |
| 334 | /** |
| 335 | * Reset |
| 336 | * |
| 337 | * Resets table creation vars |
| 338 | * |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 339 | * @return void |
| 340 | */ |
Phil Sturgeon | a7de97e | 2011-12-31 18:41:08 +0000 | [diff] [blame] | 341 | protected function _reset() |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 342 | { |
Andrey Andreev | 24276a3 | 2012-01-08 02:44:38 +0200 | [diff] [blame] | 343 | $this->fields = $this->keys = $this->primary_keys = array(); |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 344 | } |
| 345 | |
| 346 | } |
| 347 | |
| 348 | /* End of file DB_forge.php */ |
Andrey Andreev | 24276a3 | 2012-01-08 02:44:38 +0200 | [diff] [blame] | 349 | /* Location: ./system/database/DB_forge.php */ |