@@ -51,14 +51,14 @@ discard block |
||
51 | 51 | * |
52 | 52 | * @var string |
53 | 53 | */ |
54 | - protected $_rename_table = 'RENAME TABLE %s TO %s'; |
|
54 | + protected $_rename_table = 'RENAME TABLE %s TO %s'; |
|
55 | 55 | |
56 | 56 | /** |
57 | 57 | * UNSIGNED support |
58 | 58 | * |
59 | 59 | * @var array |
60 | 60 | */ |
61 | - protected $_unsigned = array( |
|
61 | + protected $_unsigned = array( |
|
62 | 62 | 'SMALLINT' => 'INTEGER', |
63 | 63 | 'INT' => 'BIGINT', |
64 | 64 | 'INTEGER' => 'BIGINT', |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | * |
72 | 72 | * @var string |
73 | 73 | */ |
74 | - protected $_default = ', '; |
|
74 | + protected $_default = ', '; |
|
75 | 75 | |
76 | 76 | // -------------------------------------------------------------------- |
77 | 77 |
@@ -154,9 +154,9 @@ discard block |
||
154 | 154 | if (is_array($this->encrypt) && is_php('5.3.7')) |
155 | 155 | { |
156 | 156 | $ssl = array(); |
157 | - empty($this->encrypt['ssl_key']) OR $ssl[PDO::MYSQL_ATTR_SSL_KEY] = $this->encrypt['ssl_key']; |
|
158 | - empty($this->encrypt['ssl_cert']) OR $ssl[PDO::MYSQL_ATTR_SSL_CERT] = $this->encrypt['ssl_cert']; |
|
159 | - empty($this->encrypt['ssl_ca']) OR $ssl[PDO::MYSQL_ATTR_SSL_CA] = $this->encrypt['ssl_ca']; |
|
157 | + empty($this->encrypt['ssl_key']) OR $ssl[PDO::MYSQL_ATTR_SSL_KEY] = $this->encrypt['ssl_key']; |
|
158 | + empty($this->encrypt['ssl_cert']) OR $ssl[PDO::MYSQL_ATTR_SSL_CERT] = $this->encrypt['ssl_cert']; |
|
159 | + empty($this->encrypt['ssl_ca']) OR $ssl[PDO::MYSQL_ATTR_SSL_CA] = $this->encrypt['ssl_ca']; |
|
160 | 160 | empty($this->encrypt['ssl_capath']) OR $ssl[PDO::MYSQL_ATTR_SSL_CAPATH] = $this->encrypt['ssl_capath']; |
161 | 161 | empty($this->encrypt['ssl_cipher']) OR $ssl[PDO::MYSQL_ATTR_SSL_CIPHER] = $this->encrypt['ssl_cipher']; |
162 | 162 | |
@@ -261,16 +261,16 @@ discard block |
||
261 | 261 | $retval = array(); |
262 | 262 | for ($i = 0, $c = count($query); $i < $c; $i++) |
263 | 263 | { |
264 | - $retval[$i] = new stdClass(); |
|
265 | - $retval[$i]->name = $query[$i]->Field; |
|
264 | + $retval[$i] = new stdClass(); |
|
265 | + $retval[$i]->name = $query[$i]->Field; |
|
266 | 266 | |
267 | 267 | sscanf($query[$i]->Type, '%[a-z](%d)', |
268 | 268 | $retval[$i]->type, |
269 | 269 | $retval[$i]->max_length |
270 | 270 | ); |
271 | 271 | |
272 | - $retval[$i]->default = $query[$i]->Default; |
|
273 | - $retval[$i]->primary_key = (int) ($query[$i]->Key === 'PRI'); |
|
272 | + $retval[$i]->default = $query[$i]->Default; |
|
273 | + $retval[$i]->primary_key = (int) ($query[$i]->Key === 'PRI'); |
|
274 | 274 | } |
275 | 275 | |
276 | 276 | return $retval; |
@@ -105,8 +105,7 @@ discard block |
||
105 | 105 | empty($this->port) OR $this->dsn .= ';port='.$this->port; |
106 | 106 | empty($this->database) OR $this->dsn .= ';dbname='.$this->database; |
107 | 107 | empty($this->char_set) OR $this->dsn .= ';charset='.$this->char_set; |
108 | - } |
|
109 | - elseif ( ! empty($this->char_set) && strpos($this->dsn, 'charset=', 6) === FALSE && is_php('5.3.6')) |
|
108 | + } elseif ( ! empty($this->char_set) && strpos($this->dsn, 'charset=', 6) === FALSE && is_php('5.3.6')) |
|
110 | 109 | { |
111 | 110 | $this->dsn .= ';charset='.$this->char_set; |
112 | 111 | } |
@@ -138,8 +137,7 @@ discard block |
||
138 | 137 | if ($this->stricton) |
139 | 138 | { |
140 | 139 | $sql = 'CONCAT(@@sql_mode, ",", "STRICT_ALL_TABLES")'; |
141 | - } |
|
142 | - else |
|
140 | + } else |
|
143 | 141 | { |
144 | 142 | $sql = 'REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE( |
145 | 143 | @@sql_mode, |
@@ -156,8 +154,7 @@ discard block |
||
156 | 154 | if (empty($this->options[PDO::MYSQL_ATTR_INIT_COMMAND])) |
157 | 155 | { |
158 | 156 | $this->options[PDO::MYSQL_ATTR_INIT_COMMAND] = 'SET SESSION sql_mode = '.$sql; |
159 | - } |
|
160 | - else |
|
157 | + } else |
|
161 | 158 | { |
162 | 159 | $this->options[PDO::MYSQL_ATTR_INIT_COMMAND] .= ', @@session.sql_mode = '.$sql; |
163 | 160 | } |
@@ -51,14 +51,14 @@ discard block |
||
51 | 51 | * |
52 | 52 | * @var string |
53 | 53 | */ |
54 | - protected $_create_database = 'CREATE DATABASE %s CHARACTER SET %s COLLATE %s'; |
|
54 | + protected $_create_database = 'CREATE DATABASE %s CHARACTER SET %s COLLATE %s'; |
|
55 | 55 | |
56 | 56 | /** |
57 | 57 | * CREATE TABLE IF statement |
58 | 58 | * |
59 | 59 | * @var string |
60 | 60 | */ |
61 | - protected $_create_table_if = 'CREATE TABLE IF NOT EXISTS'; |
|
61 | + protected $_create_table_if = 'CREATE TABLE IF NOT EXISTS'; |
|
62 | 62 | |
63 | 63 | /** |
64 | 64 | * CREATE TABLE keys flag |
@@ -68,21 +68,21 @@ discard block |
||
68 | 68 | * |
69 | 69 | * @var bool |
70 | 70 | */ |
71 | - protected $_create_table_keys = TRUE; |
|
71 | + protected $_create_table_keys = TRUE; |
|
72 | 72 | |
73 | 73 | /** |
74 | 74 | * DROP TABLE IF statement |
75 | 75 | * |
76 | 76 | * @var string |
77 | 77 | */ |
78 | - protected $_drop_table_if = 'DROP TABLE IF EXISTS'; |
|
78 | + protected $_drop_table_if = 'DROP TABLE IF EXISTS'; |
|
79 | 79 | |
80 | 80 | /** |
81 | 81 | * UNSIGNED support |
82 | 82 | * |
83 | 83 | * @var array |
84 | 84 | */ |
85 | - protected $_unsigned = array( |
|
85 | + protected $_unsigned = array( |
|
86 | 86 | 'TINYINT', |
87 | 87 | 'SMALLINT', |
88 | 88 | 'MEDIUMINT', |
@@ -162,14 +162,12 @@ discard block |
||
162 | 162 | $field[$i] = ($alter_type === 'ADD') |
163 | 163 | ? "\n\tADD ".$field[$i]['_literal'] |
164 | 164 | : "\n\tMODIFY ".$field[$i]['_literal']; |
165 | - } |
|
166 | - else |
|
165 | + } else |
|
167 | 166 | { |
168 | 167 | if ($alter_type === 'ADD') |
169 | 168 | { |
170 | 169 | $field[$i]['_literal'] = "\n\tADD "; |
171 | - } |
|
172 | - else |
|
170 | + } else |
|
173 | 171 | { |
174 | 172 | $field[$i]['_literal'] = empty($field[$i]['new_name']) ? "\n\tMODIFY " : "\n\tCHANGE "; |
175 | 173 | } |
@@ -235,8 +233,7 @@ discard block |
||
235 | 233 | continue; |
236 | 234 | } |
237 | 235 | } |
238 | - } |
|
239 | - elseif ( ! isset($this->fields[$this->keys[$i]])) |
|
236 | + } elseif ( ! isset($this->fields[$this->keys[$i]])) |
|
240 | 237 | { |
241 | 238 | unset($this->keys[$i]); |
242 | 239 | continue; |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | $retval = array(); |
210 | 210 | for ($i = 0, $c = count($query); $i < $c; $i++) |
211 | 211 | { |
212 | - $retval[$i] = new stdClass(); |
|
212 | + $retval[$i] = new stdClass(); |
|
213 | 213 | $retval[$i]->name = $query[$i]->COLUMN_NAME; |
214 | 214 | $retval[$i]->type = $query[$i]->DATA_TYPE; |
215 | 215 | |
@@ -219,14 +219,14 @@ discard block |
||
219 | 219 | { |
220 | 220 | $length = $query[$i]->DATA_LENGTH; |
221 | 221 | } |
222 | - $retval[$i]->max_length = $length; |
|
222 | + $retval[$i]->max_length = $length; |
|
223 | 223 | |
224 | 224 | $default = $query[$i]->DATA_DEFAULT; |
225 | 225 | if ($default === NULL && $query[$i]->NULLABLE === 'N') |
226 | 226 | { |
227 | 227 | $default = ''; |
228 | 228 | } |
229 | - $retval[$i]->default = $query[$i]->COLUMN_DEFAULT; |
|
229 | + $retval[$i]->default = $query[$i]->COLUMN_DEFAULT; |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | return $retval; |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | { |
270 | 270 | if ($this->qb_limit) |
271 | 271 | { |
272 | - $this->where('rownum <= ',$this->qb_limit, FALSE); |
|
272 | + $this->where('rownum <= ', $this->qb_limit, FALSE); |
|
273 | 273 | $this->qb_limit = FALSE; |
274 | 274 | } |
275 | 275 | |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | protected function _limit($sql) |
290 | 290 | { |
291 | 291 | return 'SELECT * FROM (SELECT inner_query.*, rownum rnum FROM ('.$sql.') inner_query WHERE rownum < '.($this->qb_offset + $this->qb_limit + 1).')' |
292 | - .($this->qb_offset ? ' WHERE rnum >= '.($this->qb_offset + 1): ''); |
|
292 | + .($this->qb_offset ? ' WHERE rnum >= '.($this->qb_offset + 1) : ''); |
|
293 | 293 | } |
294 | 294 | |
295 | 295 | } |
@@ -110,8 +110,7 @@ discard block |
||
110 | 110 | if (empty($this->hostname) && empty($this->port)) |
111 | 111 | { |
112 | 112 | $this->dsn .= $this->database; |
113 | - } |
|
114 | - else |
|
113 | + } else |
|
115 | 114 | { |
116 | 115 | $this->dsn .= '//'.(empty($this->hostname) ? '127.0.0.1' : $this->hostname) |
117 | 116 | .(empty($this->port) ? '' : ':'.$this->port).'/'; |
@@ -120,8 +119,7 @@ discard block |
||
120 | 119 | } |
121 | 120 | |
122 | 121 | empty($this->char_set) OR $this->dsn .= ';charset='.$this->char_set; |
123 | - } |
|
124 | - elseif ( ! empty($this->char_set) && strpos($this->dsn, 'charset=', 4) === FALSE) |
|
122 | + } elseif ( ! empty($this->char_set) && strpos($this->dsn, 'charset=', 4) === FALSE) |
|
125 | 123 | { |
126 | 124 | $this->dsn .= ';charset='.$this->char_set; |
127 | 125 | } |
@@ -165,8 +163,7 @@ discard block |
||
165 | 163 | if (strpos($table, '.') !== FALSE) |
166 | 164 | { |
167 | 165 | sscanf($table, '%[^.].%s', $owner, $table); |
168 | - } |
|
169 | - else |
|
166 | + } else |
|
170 | 167 | { |
171 | 168 | $owner = $this->username; |
172 | 169 | } |
@@ -189,8 +186,7 @@ discard block |
||
189 | 186 | if (strpos($table, '.') !== FALSE) |
190 | 187 | { |
191 | 188 | sscanf($table, '%[^.].%s', $owner, $table); |
192 | - } |
|
193 | - else |
|
189 | + } else |
|
194 | 190 | { |
195 | 191 | $owner = $this->username; |
196 | 192 | } |
@@ -51,28 +51,28 @@ |
||
51 | 51 | * |
52 | 52 | * @var string |
53 | 53 | */ |
54 | - protected $_create_database = FALSE; |
|
54 | + protected $_create_database = FALSE; |
|
55 | 55 | |
56 | 56 | /** |
57 | 57 | * DROP DATABASE statement |
58 | 58 | * |
59 | 59 | * @var string |
60 | 60 | */ |
61 | - protected $_drop_database = FALSE; |
|
61 | + protected $_drop_database = FALSE; |
|
62 | 62 | |
63 | 63 | /** |
64 | 64 | * CREATE TABLE IF statement |
65 | 65 | * |
66 | 66 | * @var string |
67 | 67 | */ |
68 | - protected $_create_table_if = 'CREATE TABLE IF NOT EXISTS'; |
|
68 | + protected $_create_table_if = 'CREATE TABLE IF NOT EXISTS'; |
|
69 | 69 | |
70 | 70 | /** |
71 | 71 | * UNSIGNED support |
72 | 72 | * |
73 | 73 | * @var bool|array |
74 | 74 | */ |
75 | - protected $_unsigned = FALSE; |
|
75 | + protected $_unsigned = FALSE; |
|
76 | 76 | |
77 | 77 | // -------------------------------------------------------------------- |
78 | 78 |
@@ -89,8 +89,7 @@ discard block |
||
89 | 89 | if ($alter_type === 'DROP') |
90 | 90 | { |
91 | 91 | return parent::_alter_table($alter_type, $table, $field); |
92 | - } |
|
93 | - elseif ($alter_type === 'CHANGE') |
|
92 | + } elseif ($alter_type === 'CHANGE') |
|
94 | 93 | { |
95 | 94 | $alter_type = 'MODIFY'; |
96 | 95 | } |
@@ -102,8 +101,7 @@ discard block |
||
102 | 101 | if ($field[$i]['_literal'] !== FALSE) |
103 | 102 | { |
104 | 103 | $field[$i] = "\n\t".$field[$i]['_literal']; |
105 | - } |
|
106 | - else |
|
104 | + } else |
|
107 | 105 | { |
108 | 106 | $field[$i]['_literal'] = "\n\t".$this->_process_column($field[$i]); |
109 | 107 |
@@ -260,7 +260,7 @@ |
||
260 | 260 | */ |
261 | 261 | protected function _limit($sql) |
262 | 262 | { |
263 | - return preg_replace('/(^\SELECT (DISTINCT)?)/i','\\1 TOP '.$this->qb_limit.' ', $sql); |
|
263 | + return preg_replace('/(^\SELECT (DISTINCT)?)/i', '\\1 TOP '.$this->qb_limit.' ', $sql); |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | } |
@@ -115,8 +115,7 @@ discard block |
||
115 | 115 | if (isset($this->DSN)) |
116 | 116 | { |
117 | 117 | $this->dsn .= 'DSN='.$this->DSN; |
118 | - } |
|
119 | - elseif ( ! empty($this->database)) |
|
118 | + } elseif ( ! empty($this->database)) |
|
120 | 119 | { |
121 | 120 | $this->dsn .= 'DSN='.$this->database; |
122 | 121 | } |
@@ -130,8 +129,7 @@ discard block |
||
130 | 129 | if (isset($this->DATABASE)) |
131 | 130 | { |
132 | 131 | $this->dsn .= 'DATABASE='.$this->DATABASE.';'; |
133 | - } |
|
134 | - elseif ( ! empty($this->database)) |
|
132 | + } elseif ( ! empty($this->database)) |
|
135 | 133 | { |
136 | 134 | $this->dsn .= 'DATABASE='.$this->database.';'; |
137 | 135 | } |
@@ -139,8 +137,7 @@ discard block |
||
139 | 137 | if (isset($this->HOSTNAME)) |
140 | 138 | { |
141 | 139 | $this->dsn .= 'HOSTNAME='.$this->HOSTNAME.';'; |
142 | - } |
|
143 | - else |
|
140 | + } else |
|
144 | 141 | { |
145 | 142 | $this->dsn .= 'HOSTNAME='.(empty($this->hostname) ? '127.0.0.1;' : $this->hostname.';'); |
146 | 143 | } |
@@ -148,8 +145,7 @@ discard block |
||
148 | 145 | if (isset($this->PORT)) |
149 | 146 | { |
150 | 147 | $this->dsn .= 'PORT='.$this->port.';'; |
151 | - } |
|
152 | - elseif ( ! empty($this->port)) |
|
148 | + } elseif ( ! empty($this->port)) |
|
153 | 149 | { |
154 | 150 | $this->dsn .= ';PORT='.$this->port.';'; |
155 | 151 | } |
@@ -51,7 +51,7 @@ |
||
51 | 51 | * |
52 | 52 | * @var bool|array |
53 | 53 | */ |
54 | - protected $_unsigned = FALSE; |
|
54 | + protected $_unsigned = FALSE; |
|
55 | 55 | |
56 | 56 | // -------------------------------------------------------------------- |
57 | 57 |
@@ -276,11 +276,11 @@ |
||
276 | 276 | $retval = array(); |
277 | 277 | for ($i = 0, $c = count($query); $i < $c; $i++) |
278 | 278 | { |
279 | - $retval[$i] = new stdClass(); |
|
279 | + $retval[$i] = new stdClass(); |
|
280 | 280 | $retval[$i]->name = $query[$i]->column_name; |
281 | 281 | $retval[$i]->type = $query[$i]->data_type; |
282 | - $retval[$i]->max_length = ($query[$i]->character_maximum_length > 0) ? $query[$i]->character_maximum_length : $query[$i]->numeric_precision; |
|
283 | - $retval[$i]->default = $query[$i]->column_default; |
|
282 | + $retval[$i]->max_length = ($query[$i]->character_maximum_length > 0) ? $query[$i]->character_maximum_length : $query[$i]->numeric_precision; |
|
283 | + $retval[$i]->default = $query[$i]->column_default; |
|
284 | 284 | } |
285 | 285 | |
286 | 286 | return $retval; |
@@ -483,7 +483,7 @@ |
||
483 | 483 | * @param string $orderby |
484 | 484 | * @param string $direction ASC, DESC or RANDOM |
485 | 485 | * @param bool $escape |
486 | - * @return object |
|
486 | + * @return CI_DB_query_builder |
|
487 | 487 | */ |
488 | 488 | public function order_by($orderby, $direction = '', $escape = NULL) |
489 | 489 | { |
@@ -51,14 +51,14 @@ |
||
51 | 51 | * |
52 | 52 | * @var string |
53 | 53 | */ |
54 | - protected $_drop_table_if = 'DROP TABLE IF EXISTS'; |
|
54 | + protected $_drop_table_if = 'DROP TABLE IF EXISTS'; |
|
55 | 55 | |
56 | 56 | /** |
57 | 57 | * UNSIGNED support |
58 | 58 | * |
59 | 59 | * @var array |
60 | 60 | */ |
61 | - protected $_unsigned = array( |
|
61 | + protected $_unsigned = array( |
|
62 | 62 | 'INT2' => 'INTEGER', |
63 | 63 | 'SMALLINT' => 'INTEGER', |
64 | 64 | 'INT' => 'BIGINT', |