Req #65798 [Opn->Csd]: last error msg and constraint name
| From: | cmb@php.net | Date: | Tue, 31 Jan 2017 11:33:27 +0000 |
| Subject: | Req #65798 [Opn->Csd]: last error msg and constraint name | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-207067@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=65798&edit=1
ID: 65798
Updated by: cmb@php.net
Reported by: babiocop at yahoo dot com
Summary: last error msg and constraint name
-Status: Open
+Status: Closed
Type: Feature/Change Request
Package: SQLite related
Operating System: win7 x64
PHP Version: 5.4.20
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
The requested behavior is already implemented as of PHP 5.4.42
(actually, it likely depends on the SQLite3 version), see
<https://3v4l.org/ErHCu>.
Previous Comments:
------------------------------------------------------------------------
[2013-10-01 10:21:40] babiocop at yahoo dot com
Description:
------------
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
sqlite>
---
From manual page: http://www.php.net/sqlite3.lasterrormsg#refsect1-sqlite3.lasterrormsg-returnvalues
---
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))');
$db->exec('INSERT INTO test VALUES (NULL,NULL,NULL)');
echo $db->lasterrormsg();
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=65798&edit=1