php.net |  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: babiocop at yahoo dot com
New email:
PHP Version: OS:

 

 [2013-10-01 10:21 UTC] 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();


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-01-31 11:33 UTC] cmb@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: cmb
 [2017-01-31 11:33 UTC] cmb@php.net
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>.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri May 02 01:01:29 2025 UTC