mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-09 18:05:36 +08:00
Build Unix SQLite with SQLITE_ENABLE_COLUMN_METADATA so the metadata APIs are available on macOS and Linux. Remove the pdo_sqlite configure override that forced PHP to treat sqlite3_column_table_name() as unavailable, and add sanity checks for both SQLite compile options and PDO column metadata.
17 lines
507 B
PHP
17 lines
507 B
PHP
<?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.');
|
|
}
|