Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 0 additions & 25 deletions src/Package/Extension/pdo_sqlite.php

This file was deleted.

7 changes: 6 additions & 1 deletion src/Package/Library/sqlite.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ class sqlite
#[BuildFor('Linux')]
public function buildUnix(LibraryPackage $lib): void
{
UnixAutoconfExecutor::create($lib)->configure()->make();
UnixAutoconfExecutor::create($lib)
->appendEnv([
'CFLAGS' => '-DSQLITE_ENABLE_COLUMN_METADATA=1',
])
->configure()
->make();
$lib->patchPkgconfPrefix(['sqlite3.pc']);
}

Expand Down
16 changes: 16 additions & 0 deletions src/globals/ext-tests/pdo_sqlite.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

declare(strict_types=1);

$pdo = new PDO('sqlite::memory:');
$pdo->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.');
}
10 changes: 10 additions & 0 deletions src/globals/ext-tests/sqlite3.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

declare(strict_types=1);

$sqlite = new SQLite3(':memory:');
$enabled = $sqlite->querySingle("SELECT sqlite_compileoption_used('ENABLE_COLUMN_METADATA')");

if ((int) $enabled !== 1) {
throw new RuntimeException('SQLite was not built with SQLITE_ENABLE_COLUMN_METADATA.');
}
Loading