|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-03-10 09:08 UTC] iliaa@php.net
[2004-03-10 09:23 UTC] col at mportal dot hu
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 00:00:01 2025 UTC |
Description: ------------ In sqlite then return of the column names changed in new versions (aktual: 2.8.13) The return type (short name or long name) can be set with: PRAGMA short_column_names=ON; It works fine from sqlite console, but not from php. And php has no any ini setting, to change this variable. Setting this from query before select query, has no affect. Reproduce code: --------------- $db = sqlite_open('mydb.db',0666, $sqliteerror); sqlite_query($db,"create table t1(id1 int,n1 varchar(5)"); sqlite_query($db,"create table t2(id2 int,n2 varchar(5)"); sqlite_query($db,"insert into t1(id1,n1) values (1,'N1')"); sqlite_query($db,"insert into t2(id2,n2) values (1,'N2')"); sqlite_query($db, 'PRAGMA short_column_names=ON'); /** select *, or select t1.id1, t2.id2, t1.n1, t2.n2, or select t1.*, t2.* is the same effect */ $result=sqlite_query($db,'select * from t1,t2 where t1.id=t2.id'); echo "<pre>",var_dump(sqlite_fetch_array($result,SQLITE_ASSOC)),"<pre>"; Expected result: ---------------- array(4) { ["id1"]=> string(1) "1" ["n1"]=> string(1) "N1" ["id2"]=> string(1) "1" ["n2"]=> string(2) "N2" } Actual result: -------------- array(4) { ["t1.id1"]=> string(1) "1" ["t1.n1"]=> string(1) "N1" ["t2.id2"]=> string(1) "1" ["t2.n2"]=> string(2) "N2" }