diff options
author | Christian Schneider | 2021-01-25 16:15:29 +0100 |
---|---|---|
committer | Christian Schneider | 2021-01-25 16:15:29 +0100 |
commit | edfc5b21d8df6a4209172b9288405d4c5aff4059 (patch) | |
tree | 7b1297bc3386f0f85cc5427ebed8a9b126f2e949 /it_dbi_postgres.class | |
parent | a39d9275bf2fb694560eef64d0afebecf141bc28 (diff) | |
download | itools-edfc5b21d8df6a4209172b9288405d4c5aff4059.tar.gz itools-edfc5b21d8df6a4209172b9288405d4c5aff4059.tar.bz2 itools-edfc5b21d8df6a4209172b9288405d4c5aff4059.zip |
Fix generating errors on SQL syntax errors, add tests for it
Diffstat (limited to 'it_dbi_postgres.class')
-rw-r--r-- | it_dbi_postgres.class | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/it_dbi_postgres.class b/it_dbi_postgres.class index 1161632..bce0fd9 100644 --- a/it_dbi_postgres.class +++ b/it_dbi_postgres.class @@ -110,11 +110,10 @@ function _query($query, $p) if (!($result = pg_query($this->_link, $query)) && $p['safety']) { - /* TODO - $errno = mysqli_errno($this->_link); - if (($p['safety'] < 2) && ($errno == 1062)) # Duplicate entry - return false; + if (($p['safety'] < 2) && it::match('duplicate key value', pg_last_error($this->_link))) # Duplicate entry + return null; + /* TODO if ($errno == 2006) # mysql server has gone away: retry { it::log('sqllog', "it_dbi(): reconnecting mysqli_connect {$p['server']}, {$p['db']}"); |