#27547 [Bgs]: Sqlite column names change, but PRAGMA short_column_names=ON not working
| From: | col at mportal dot hu | Date: | Wed, 10 Mar 2004 14:23:24 +0000 |
| Subject: | #27547 [Bgs]: Sqlite column names change, but PRAGMA short_column_names=ON not working | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-56234@lists.php.net to get a copy of this message | ||
ID: 27547
User updated by: col at mportal dot hu
Reported By: col at mportal dot hu
Status: Bogus
Bug Type: SQLite related
Operating System: linux, windows
PHP Version: 4.3.4
New Comment:
Thanx, but this problem exists in bundled 2.8.11 too. I just found this
pragma option workin in sqlite console, but not in php. The problem not
the "PRAGMA short_column_names=ON". The problem is the name of
returning columns, and the short_column_names option in sqlite which
changed, and can not be set from php.
Probably a php.ini setting (or else, if it's not working from the
query) could help this bug, in feature.
Previous Comments:
------------------------------------------------------------------------
[2004-03-10 09:08:18] iliaa@php.net
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions.
Thank you for your interest in PHP.
Bundled sqlite library is version 2.8.11, if you want to
have latest features like "PRAGMA short_column_names" use
external sqlite library.
------------------------------------------------------------------------
[2004-03-10 07:51:28] col at mportal dot hu
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"
}
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=27547&edit=1