mirror of
https://github.com/dg/dibi.git
synced 2025-08-07 06:36:44 +02:00
SQLite & SQLite3: improved primary key detection for ROWID
This commit is contained in:
@@ -478,6 +478,19 @@ class DibiSqliteDriver extends DibiObject implements IDibiDriver, IDibiReflector
|
||||
}
|
||||
$res[$index]['primary'] = (bool) $primary;
|
||||
}
|
||||
if (!$res) { // @see http://www.sqlite.org/lang_createtable.html#rowid
|
||||
foreach ($columns as $column) {
|
||||
if ($column['vendor']['pk']) {
|
||||
$res[] = array(
|
||||
'name' => 'ROWID',
|
||||
'unique' => TRUE,
|
||||
'primary' => TRUE,
|
||||
'columns' => array($column['name']),
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return array_values($res);
|
||||
}
|
||||
|
@@ -464,6 +464,19 @@ class DibiSqlite3Driver extends DibiObject implements IDibiDriver, IDibiReflecto
|
||||
}
|
||||
$res[$index]['primary'] = (bool) $primary;
|
||||
}
|
||||
if (!$res) { // @see http://www.sqlite.org/lang_createtable.html#rowid
|
||||
foreach ($columns as $column) {
|
||||
if ($column['vendor']['pk']) {
|
||||
$res[] = array(
|
||||
'name' => 'ROWID',
|
||||
'unique' => TRUE,
|
||||
'primary' => TRUE,
|
||||
'columns' => array($column['name']),
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return array_values($res);
|
||||
}
|
||||
|
Reference in New Issue
Block a user