1
0
mirror of https://github.com/dg/dibi.git synced 2025-02-23 18:33:45 +01:00

DibiSqliteReflector: fixed detection of autoincrement

This commit is contained in:
David Grudl 2015-01-12 08:57:38 +01:00
parent ddbf8c779e
commit 50782c037c

View File

@ -62,7 +62,6 @@ class DibiSqliteReflector extends DibiObject implements IDibiReflector
$columns = array();
while ($row = $res->fetch(TRUE)) {
$column = $row['name'];
$pattern = "/(\"$column\"|\[$column\]|$column)\\s+[^,]+\\s+PRIMARY\\s+KEY\\s+AUTOINCREMENT/Ui";
$type = explode('(', $row['type']);
$columns[] = array(
'name' => $column,
@ -72,7 +71,7 @@ class DibiSqliteReflector extends DibiObject implements IDibiReflector
'size' => isset($type[1]) ? (int) $type[1] : NULL,
'nullable' => $row['notnull'] == '0',
'default' => $row['dflt_value'],
'autoincrement' => (bool) preg_match($pattern, $meta['sql']),
'autoincrement' => $row['pk'] && $type[0] === 'INTEGER',
'vendor' => $row,
);
}