@@ 223-230 (lines=8) @@ | ||
220 | $table->columns->$name = new stdClass(); |
|
221 | $table->columns->$name->null = (bool)stripos( $line, ' NOT NULL ' ); |
|
222 | $table->columns->$name->type = $m[2]; |
|
223 | if ( isset($m[3]) ) { |
|
224 | if ( substr( $m[3], 0, 1 ) == '(' ) |
|
225 | $table->columns->$name->length = substr( $m[3], 1, -1 ); |
|
226 | else |
|
227 | $table->columns->$name->length = $m[3]; |
|
228 | } else { |
|
229 | $table->columns->$name->length = null; |
|
230 | } |
|
231 | if ( preg_match( '/ character set (\S+)/i', $line, $m ) ) { |
|
232 | $table->columns->$name->charset = $m[1]; |
|
233 | } else { |
|
@@ 241-248 (lines=8) @@ | ||
238 | } else { |
|
239 | $table->columns->$name->collate = ''; |
|
240 | } |
|
241 | if ( preg_match( '/ DEFAULT (.+),$/i', $line, $m ) ) { |
|
242 | if ( substr( $m[1], 0, 1 ) == "'" ) |
|
243 | $table->columns->$name->default = substr( $m[1], 1, -1 ); |
|
244 | else |
|
245 | $table->columns->$name->default = $m[1]; |
|
246 | } else { |
|
247 | $table->columns->$name->default = null; |
|
248 | } |
|
249 | $table->columns->$name->line = $line; |
|
250 | } |
|
251 | $pk = preg_grep( '/^PRIMARY\s+KEY\s+/i', $sql ); |