[ self::CREATE_PERSON, self::INSERT_JEPHTE, ], ]); self::assertSame("clain", $sqlite->get("select nom, age from person")); self::assertSame([ "nom" => "clain", "age" => 50, ], $sqlite->get("select nom, age from person", null, true)); $sqlite->exec(self::INSERT_JEAN); self::assertSame("payet", $sqlite->get("select nom, age from person where nom = 'payet'")); self::assertSame([ "nom" => "payet", "age" => 32, ], $sqlite->get("select nom, age from person where nom = 'payet'", null, true)); self::assertSame([ ["key" => "0", "value" => self::CREATE_PERSON, "done" => 1], ["key" => "1", "value" => self::INSERT_JEPHTE, "done" => 1], ], iterator_to_array($sqlite->all("select key, value, done from _migration"))); } function testInsert() { $sqlite = new Sqlite(":memory:", [ "migrate" => "create table mapping (i integer, s varchar)" ]); $sqlite->exec(["insert into mapping", "values" => ["i" => 1, "s" => "un"]]); $sqlite->exec(["insert mapping", "values" => ["i" => 2, "s" => "deux"]]); $sqlite->exec(["insert into", "into" => "mapping", "values" => ["i" => 3, "s" => "trois"]]); $sqlite->exec(["insert", "into" => "mapping", "values" => ["i" => 4, "s" => "quatre"]]); $sqlite->exec(["insert into mapping(i)", "values" => ["i" => 5, "s" => "cinq"]]); $sqlite->exec(["insert into (i)", "into" => "mapping", "values" => ["i" => 6, "s" => "six"]]); $sqlite->exec(["insert into mapping(i) values ()", "values" => ["i" => 7, "s" => "sept"]]); $sqlite->exec(["insert into mapping(i) values (8)", "values" => ["i" => 42, "s" => "whatever"]]); $sqlite->exec(["insert into mapping(i, s) values (9, 'neuf')", "values" => ["i" => 43, "s" => "garbage"]]); $sqlite->exec(["insert into mapping", "cols" => ["i"], "values" => ["i" => 10, "s" => "dix"]]); self::assertSame([ ["i" => 1, "s" => "un"], ["i" => 2, "s" => "deux"], ["i" => 3, "s" => "trois"], ["i" => 4, "s" => "quatre"], ["i" => 5, "s" => null/*"cinq"*/], ["i" => 6, "s" => null/*"six"*/], ["i" => 7, "s" => null/*"sept"*/], ["i" => 8, "s" => null/*"huit"*/], ["i" => 9, "s" => "neuf"], ["i" => 10, "s" => null/*"dix"*/], ], iterator_to_array($sqlite->all("select * from mapping"))); } }