diff --git a/src/SPC/builder/extension/pdo_sqlite.php b/src/SPC/builder/extension/pdo_sqlite.php deleted file mode 100644 index 4d6f296c..00000000 --- a/src/SPC/builder/extension/pdo_sqlite.php +++ /dev/null @@ -1,23 +0,0 @@ -configure()->make(); + UnixAutoconfExecutor::create($this) + ->appendEnv([ + 'CFLAGS' => '-DSQLITE_ENABLE_COLUMN_METADATA=1', + ]) + ->configure() + ->make(); $this->patchPkgconfPrefix(['sqlite3.pc']); } } diff --git a/src/globals/ext-tests/pdo_sqlite.php b/src/globals/ext-tests/pdo_sqlite.php new file mode 100644 index 00000000..9e5e7f14 --- /dev/null +++ b/src/globals/ext-tests/pdo_sqlite.php @@ -0,0 +1,16 @@ +exec('CREATE TABLE spc_column_metadata_test (id INTEGER)'); + +$stmt = $pdo->query('SELECT id FROM spc_column_metadata_test'); +if ($stmt === false) { + throw new RuntimeException('Failed to query SQLite metadata test table.'); +} + +$metadata = $stmt->getColumnMeta(0); +if (($metadata['table'] ?? null) !== 'spc_column_metadata_test') { + throw new RuntimeException('PDO SQLite column metadata does not include the origin table.'); +} diff --git a/src/globals/ext-tests/sqlite3.php b/src/globals/ext-tests/sqlite3.php new file mode 100644 index 00000000..c3221e35 --- /dev/null +++ b/src/globals/ext-tests/sqlite3.php @@ -0,0 +1,10 @@ +querySingle("SELECT sqlite_compileoption_used('ENABLE_COLUMN_METADATA')"); + +if ((int) $enabled !== 1) { + throw new RuntimeException('SQLite was not built with SQLITE_ENABLE_COLUMN_METADATA.'); +}