nette / database

💾 A database layer with a familiar PDO-like API but much more powerful. Building queries, advanced joins, drivers for MySQL, PostgreSQL, SQLite, MS SQL Server and Oracle.
https://doc.nette.org/database
Other
499 stars 107 forks source link

Broken sqlite #4

Closed hrach closed 10 years ago

hrach commented 10 years ago

In php 5.5 and 5.6 is broken sqlite implementation (detection) of primary keys. Pragma returns primary keys now indexed, not "(int) bool" as earlier.

Nette\Database\Row #ca39
cid => 0
name => "book_id" (7)
type => "INTEGER" (7)
notnull => 1
dflt_value => NULL
pk => 1

Nette\Database\Row #ccdc
cid => 1
name => "tag_id" (6)
type => "INTEGER" (7)
notnull => 1
dflt_value => NULL
pk => 2 

Would be nice to detect the change which caused this :) (php bug, version of sqlite...)

hrach commented 10 years ago

Failed travis test: https://travis-ci.org/nette/database/builds/24289902

milo commented 10 years ago

SQLite 2013-03-18 (3.7.16) PHP 5.5.11

hrach commented 10 years ago

@milo I still don't see the exact change...

milo commented 10 years ago

@hrach In SQLite

Enhance the PRAGMA table_info command so that the "pk" column is an increasing integer to show the order of columns in the primary key. ... PRAGMA table_info(table-name); This pragma returns one row for each column in the named table. Columns in the result set include the column name, data type, whether or not the column can be NULL, and the default value for the column. The "pk" column in the result set is zero for columns that are not part of the primary key, and is the index of the column in the primary key for columns that are part of the primary key.

And PHP 5.5.1 has been updated to libsqlite 3.8.3.1

hrach commented 10 years ago

@milo thanks!

so this has been changed in sqlite 2013-03-18 (3.7.16).