@@ -104,8 +104,7 @@ discard block |
||
104 | 104 | empty($this->database) OR $this->dsn .= ';dbname='.$this->database; |
105 | 105 | empty($this->char_set) OR $this->dsn .= ';charset='.$this->char_set; |
106 | 106 | empty($this->appname) OR $this->dsn .= ';appname='.$this->appname; |
107 | - } |
|
108 | - else |
|
107 | + } else |
|
109 | 108 | { |
110 | 109 | if ( ! empty($this->char_set) && strpos($this->dsn, 'charset=', 6) === FALSE) |
111 | 110 | { |
@@ -282,8 +281,7 @@ discard block |
||
282 | 281 | if (count($this->qb_select) === 0) |
283 | 282 | { |
284 | 283 | $select = '*'; // Inevitable |
285 | - } |
|
286 | - else |
|
284 | + } else |
|
287 | 285 | { |
288 | 286 | // Use only field names and their aliases, everything else is out of our scope. |
289 | 287 | $select = array(); |
@@ -341,11 +341,11 @@ discard block |
||
341 | 341 | $retval = array(); |
342 | 342 | for ($i = 0, $c = count($query); $i < $c; $i++) |
343 | 343 | { |
344 | - $retval[$i] = new stdClass(); |
|
344 | + $retval[$i] = new stdClass(); |
|
345 | 345 | $retval[$i]->name = $query[$i]->COLUMN_NAME; |
346 | 346 | $retval[$i]->type = $query[$i]->DATA_TYPE; |
347 | - $retval[$i]->max_length = ($query[$i]->CHARACTER_MAXIMUM_LENGTH > 0) ? $query[$i]->CHARACTER_MAXIMUM_LENGTH : $query[$i]->NUMERIC_PRECISION; |
|
348 | - $retval[$i]->default = $query[$i]->COLUMN_DEFAULT; |
|
347 | + $retval[$i]->max_length = ($query[$i]->CHARACTER_MAXIMUM_LENGTH > 0) ? $query[$i]->CHARACTER_MAXIMUM_LENGTH : $query[$i]->NUMERIC_PRECISION; |
|
348 | + $retval[$i]->default = $query[$i]->COLUMN_DEFAULT; |
|
349 | 349 | } |
350 | 350 | |
351 | 351 | return $retval; |
@@ -501,7 +501,7 @@ discard block |
||
501 | 501 | ."\nWHERE ".$this->escape_identifiers('CI_rownum').' BETWEEN '.($this->qb_offset + 1).' AND '.$limit; |
502 | 502 | } |
503 | 503 | |
504 | - return preg_replace('/(^\SELECT (DISTINCT)?)/i','\\1 TOP '.$limit.' ', $sql); |
|
504 | + return preg_replace('/(^\SELECT (DISTINCT)?)/i', '\\1 TOP '.$limit.' ', $sql); |
|
505 | 505 | } |
506 | 506 | |
507 | 507 | // -------------------------------------------------------------------- |
@@ -89,16 +89,14 @@ discard block |
||
89 | 89 | if ( ! empty($this->database)) |
90 | 90 | { |
91 | 91 | $this->dsn .= 'dbname='.$this->database; |
92 | - } |
|
93 | - elseif ( ! empty($this->hostname)) |
|
92 | + } elseif ( ! empty($this->hostname)) |
|
94 | 93 | { |
95 | 94 | $this->dsn .= 'dbname='.$this->hostname; |
96 | 95 | } |
97 | 96 | |
98 | 97 | empty($this->char_set) OR $this->dsn .= ';charset='.$this->char_set; |
99 | 98 | empty($this->role) OR $this->dsn .= ';role='.$this->role; |
100 | - } |
|
101 | - elseif ( ! empty($this->char_set) && strpos($this->dsn, 'charset=', 9) === FALSE) |
|
99 | + } elseif ( ! empty($this->char_set) && strpos($this->dsn, 'charset=', 9) === FALSE) |
|
102 | 100 | { |
103 | 101 | $this->dsn .= ';charset='.$this->char_set; |
104 | 102 | } |
@@ -250,8 +248,7 @@ discard block |
||
250 | 248 | { |
251 | 249 | $select = 'FIRST '.$this->qb_limit |
252 | 250 | .($this->qb_offset > 0 ? ' SKIP '.$this->qb_offset : ''); |
253 | - } |
|
254 | - else |
|
251 | + } else |
|
255 | 252 | { |
256 | 253 | $select = 'ROWS ' |
257 | 254 | .($this->qb_offset > 0 ? $this->qb_offset.' TO '.($this->qb_limit + $this->qb_offset) : $this->qb_limit); |
@@ -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' |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | * |
70 | 70 | * @var string |
71 | 71 | */ |
72 | - protected $_default = FALSE; |
|
72 | + protected $_default = FALSE; |
|
73 | 73 | |
74 | 74 | // -------------------------------------------------------------------- |
75 | 75 |
@@ -92,8 +92,7 @@ discard block |
||
92 | 92 | if (isset($this->DSN)) |
93 | 93 | { |
94 | 94 | $this->dsn .= 'DSN='.$this->DSN; |
95 | - } |
|
96 | - elseif ( ! empty($this->database)) |
|
95 | + } elseif ( ! empty($this->database)) |
|
97 | 96 | { |
98 | 97 | $this->dsn .= 'DSN='.$this->database; |
99 | 98 | } |
@@ -104,8 +103,7 @@ discard block |
||
104 | 103 | if (isset($this->host)) |
105 | 104 | { |
106 | 105 | $this->dsn .= 'host='.$this->host; |
107 | - } |
|
108 | - else |
|
106 | + } else |
|
109 | 107 | { |
110 | 108 | $this->dsn .= 'host='.(empty($this->hostname) ? '127.0.0.1' : $this->hostname); |
111 | 109 | } |
@@ -113,8 +111,7 @@ discard block |
||
113 | 111 | if (isset($this->service)) |
114 | 112 | { |
115 | 113 | $this->dsn .= '; service='.$this->service; |
116 | - } |
|
117 | - elseif ( ! empty($this->port)) |
|
114 | + } elseif ( ! empty($this->port)) |
|
118 | 115 | { |
119 | 116 | $this->dsn .= '; service='.$this->port; |
120 | 117 | } |
@@ -166,8 +163,7 @@ discard block |
||
166 | 163 | if (strpos($table, '.') !== FALSE) |
167 | 164 | { |
168 | 165 | sscanf($table, '%[^.].%s', $owner, $table); |
169 | - } |
|
170 | - else |
|
166 | + } else |
|
171 | 167 | { |
172 | 168 | $owner = $this->username; |
173 | 169 | } |
@@ -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 (empty($this->options[PDO::MYSQL_ATTR_INIT_COMMAND])) |
139 | 138 | { |
140 | 139 | $this->options[PDO::MYSQL_ATTR_INIT_COMMAND] = 'SET SESSION sql_mode="STRICT_ALL_TABLES"'; |
141 | - } |
|
142 | - else |
|
140 | + } else |
|
143 | 141 | { |
144 | 142 | $this->options[PDO::MYSQL_ATTR_INIT_COMMAND] .= ', @@session.sql_mode = "STRICT_ALL_TABLES"'; |
145 | 143 | } |
@@ -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 |