|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #65798 last error msg and constraint name
Submitted: 2013-10-01 10:21 UTC Modified: 2017-01-31 11:33 UTC
From: babiocop at yahoo dot com Assigned: cmb (profile)
Status: Closed Package: SQLite related
PHP Version: 5.4.20 OS: win7 x64
Private report: No CVE-ID: None
 [2013-10-01 10:21 UTC] babiocop at yahoo dot com
lasterrormsg() shows only "constraint failed" but could also show constraint name like in sqlite command-line client:
sqlite> insert into test values(null,null,null);
Error: constraint val1 or val2 must be specified failed
From manual page:

Test script:
$db = new SQLite3('test.db', SQLITE3_OPEN_READWRITE);
$db->exec('CREATE TABLE test (id INTEGER NOT NULL PRIMARY KEY, val1 INTEGER val2 INTEGER, CONSTRAINT "val1 or val2 must be specified" CHECK (val1 NOT NULL OR val2 NOT NULL))');
echo $db->lasterrormsg();


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2017-01-31 11:33 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: cmb
 [2017-01-31 11:33 UTC]
The requested behavior is already implemented as of PHP 5.4.42
(actually, it likely depends on the SQLite3 version), see
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon Aug 02 13:01:24 2021 UTC