From:             col at mportal dot hu
Operating system: linux, windows
PHP version:      4.3.4
PHP Bug Type:     SQLite related
Bug description:  Sqlite column names change, but PRAGMA short_column_names=ON not 
working

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 bug report at http://bugs.php.net/?id=27547&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=27547&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=27547&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=27547&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=27547&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=27547&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=27547&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=27547&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=27547&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=27547&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=27547&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=27547&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=27547&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27547&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=27547&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=27547&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=27547&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=27547&r=float

Reply via email to