diff options
| author | Lester Caine <lester@lsces.co.uk> | 2026-06-02 12:40:50 +0100 |
|---|---|---|
| committer | Lester Caine <lester@lsces.co.uk> | 2026-06-02 12:40:50 +0100 |
| commit | 18298475db4d82203c2944b037eed391d0d59ee2 (patch) | |
| tree | 6af8905cbb75df22388f948614dbc6e48bfa2025 /adodb-datadict.inc.php | |
| parent | e8be3b8d6fcc7ec5037f261a9af07d5663ac5f37 (diff) | |
| download | adodb-18298475db4d82203c2944b037eed391d0d59ee2.tar.gz adodb-18298475db4d82203c2944b037eed391d0d59ee2.tar.bz2 adodb-18298475db4d82203c2944b037eed391d0d59ee2.zip | |
Fix LOCALTIMESTAMP/CURRENT_TIMESTAMP schema default handling for Firebird 4+
CURRENT_TIMESTAMP returns TIMESTAMP WITH TIME ZONE in Firebird 4+, which
PHP PDO cannot handle without a valid session timezone, causing SQLSTATE 22009.
- adodb-firebird.inc.php: sysTimeStamp changed to LOCALTIMESTAMP so DEFTIMESTAMP
generates a timezone-naive default (propagates to pdo_firebird via adodb-pdo.inc.php)
- adodb-datadict.inc.php: extend space-padding escape hatch to D/T columns so SQL
keywords can be passed through verbatim as DEFAULT values
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'adodb-datadict.inc.php')
| -rw-r--r-- | adodb-datadict.inc.php | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/adodb-datadict.inc.php b/adodb-datadict.inc.php index 29f2120c..f04ddc82 100644 --- a/adodb-datadict.inc.php +++ b/adodb-datadict.inc.php @@ -828,14 +828,16 @@ class ADODB_DataDict { ( substr($fdefault,0,1) != "'" && !is_numeric($fdefault))) { if (($ty == 'D' || $ty == 'T') && strtolower($fdefault) != 'null') { - // convert default date into database-aware code - if ($ty == 'T') - { - $fdefault = $this->connection->dbTimeStamp($fdefault); - } - else - { - $fdefault = $this->connection->dbDate($fdefault); + // space-padded value = SQL keyword/expression, pass through verbatim + if (strlen($fdefault) > 1 && $fdefault[0] == ' ' && $fdefault[-1] == ' ') { + $fdefault = trim($fdefault); + } else { + // convert default date into database-aware code + if ($ty == 'T') { + $fdefault = $this->connection->dbTimeStamp($fdefault); + } else { + $fdefault = $this->connection->dbDate($fdefault); + } } } else |
