Run PDO SQLite Query On In-Memory Database On Github Actions

291 Views Asked by At

I use PHPUnit to test by PDO wrapper. One of my tests is an integration test that proves that the abstraction layer produces the right syntax, or binds PDOStatement in the right way, etc. For this, I use an in-memory SQLite database, and declare ext-pdo_sqlite as a dev-dependency of my project.

When Github Actions runs a build, dependencies all get installed, hinting that pdo_sqlite is present on the system. This is further confirmed by the fact that the connection succeeds. However, when I run an insert query to set up my database, I get the following error:

PDOException: SQLSTATE[HY000]: General error: 1 no such column: TRUE

The query looks like this:

INSERT INTO `persons` (`id`, `name`, `dob`, `weight`, `is_dev`, `teeth`) VALUES (NULL, 'Anton', '1987-11-03', 71.3, TRUE, 31)

Table creation is done with PDO like this:

$pdo->exec("CREATE TABLE `$tableName` (`id` int(6) PRIMARY KEY, `name` varchar(255), `dob` datetime, `weight` float(5), `is_dev` bool, `teeth` int(2))");

This only manifests on CI, and local tests pass fine - even on the same PHP version as CI.

Any ideas? Am I just missing something in the syntax? Could it be that GH Actions has only a dummy implementation of SQLite or something?

Note: This is an open source project, and you can see everything, including the failing build, in dhii/pdo-query#1.

0

There are 0 best solutions below