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
512 stars 108 forks source link

V2.4 fix sqlite driver get foreign keys method #293

Closed krajcikondra closed 2 years ago

krajcikondra commented 2 years ago

Hi,

When I import data from files to sqlite3 database I got following error:

src/Database/Drivers/SqliteDriver.php:229
Trying to access array offset on value of type null

One thing is interesting. My colleague on OSX process import successfully without error.

nette/database v2.4.11
sqlite3 version: 3.27.2
OS: Linux

When I dump $keys[$row[‚id‘]] before line 229 I get:

{
  "name": 0,
  "local": "key",
  "table": "cache",
  "foreign": null,
  "onDelete": "CASCADE",
  "onUpdate": "NO ACTION"
}

Code dont assume foreign is null.

https://forum.nette.org/cs/35537-nette-database-a-sqlite3-trying-to-access-array-offset-on-value-of-type-null#p221775