|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2021-06-14 08:31 UTC] cmb@php.net
-Package: SQLite
+Package: SQLite related
[2021-06-14 08:33 UTC] cmb@php.net
-Status: Open
+Status: Duplicate
-Assigned To:
+Assigned To: cmb
[2021-06-14 08:33 UTC] cmb@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 22:00:01 2025 UTC |
Description: ------------ SQLite Shell - 3.35.5 2021-04-19 18:32:05 sqlite> CREATE TABLE profile ( profile_id INTEGER PRIMARY KEY autoincrement, name VARCHAR(64), email VARCHAR(255), age INT NOT NULL DEFAULT 0, created VARCHAR(20) NOT NULL DEFAULT CURRENT_TIMESTAMP ); sqlite> -- run php example sqlite> select * from profile; profile_id name email age created ---------- -------- ----------- --- ------------------- 1 Adam Fry a@gmail.com 47 2021-06-13 14:54:08 2 Adam Fry a@gmail.com 47 2021-06-13 14:54:08 Notice it creates two identical rows. This is the issue. If I remove the returning clause, it only creates one row. Test script: --------------- // SQLite3 extension version 3.35.5 $db = new SQLite3('tests/file.db'); $result = $db->query("INSERT INTO profile (age, email, name) VALUES (47, 'a@gmail.com', 'Adam Fry') RETURNING profile_id, email"); print_r($result->fetchArray(SQLITE3_ASSOC)); $db->close(); Expected result: ---------------- When I do an insert of a single record, I would expect it to store a single row. I would expect to see this: sqlite> -- run php example sqlite> select * from profile; profile_id name email age created ---------- -------- ----------- --- ------------------- 1 Adam Fry a@gmail.com 47 2021-06-13 14:54:08