|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull Requests
Pull requests:
HistoryAllCommentsChangesGit/SVN commits
[2021-09-15 10:06 UTC] cmb@php.net
-Package: PDO SQLite
+Package: PDO Core
[2021-09-15 10:06 UTC] cmb@php.net
[2021-09-15 10:07 UTC] cmb@php.net
[2023-04-07 18:33 UTC] moroccantour1 at gmail dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 08:00:01 2025 UTC |
Description: ------------ As of SQLite 3.25.0, ALTER TABLE RENAME COLUMN queries are supported. However, already prepared statements ignore such changes, and report the old column names when fetching. ext/sqlite3 behaves like expected. Test script: --------------- <?php $db = new PDO('sqlite::memory:'); $db->exec("CREATE TABLE user (id INTEGER PRIMARY KEY NOT NULL, foo VARCHAR(255) NOT NULL)"); $db->exec("INSERT INTO user (id, foo) VALUES (10, 'test')"); $stmt = $db->prepare("SELECT * FROM user WHERE id = :id"); $stmt->execute(['id' => 10]); print_r($stmt->fetch(PDO::FETCH_ASSOC)); $db->exec("ALTER TABLE user RENAME COLUMN foo TO bar"); $res = $stmt->execute(['id' => 10]); print_r($stmt->fetch(PDO::FETCH_ASSOC)); Expected result: ---------------- Array ( [id] => 10 [foo] => test ) Array ( [id] => 10 [bar] => test ) Actual result: -------------- Array ( [id] => 10 [foo] => test ) Array ( [id] => 10 [foo] => test )