ID: 32736 User updated by: bart at mediawave dot nl Reported By: bart at mediawave dot nl -Status: Bogus +Status: Open Bug Type: SQLite related Operating System: WinXP PHP Version: 5.0.4 New Comment:
Can this be changed to a feature / change request? I've been looking around on the web. As far as I can see there are no other SQL system that give results in such a way. This just makes it unnecessarily difficult to write database independent code. The only advantage I can think of for such a result is when tables that have identical fieldnames need to be joined. But SQL (and SQLite) already has aliases to solve that. Maybe there should be a new SQLite result type constant for this? Previous Comments: ------------------------------------------------------------------------ [2005-04-17 12:27:51] [EMAIL PROTECTED] Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php Sorry, but this is how SQLite works. ------------------------------------------------------------------------ [2005-04-17 12:23:04] bart at mediawave dot nl Description: ------------ With the SQLite functions: The problem occurs when selecting fields in a tablename.fieldname manner. Example: SELECT test.myfield, test.otherfield FROM test The result array will have ['tablename.fieldname'] as index. This should be just ['fieldname'] as index. Reproduce code: --------------- <?php $dbfile = 'db/test2db.db'; if (!file_exists($dbfile)) { $setup = " CREATE TABLE test (myfield varchar(50), otherfield varchar(50)); INSERT INTO test (myfield, otherfield) VALUES ('value1', 'value1'); INSERT INTO test (myfield, otherfield) VALUES ('value2', 'value2'); "; } $connectionId = sqlite_open($dbfile, 0666, $sqliteerror); if ($setup) sqlite_exec($connectionId, $setup); $sql = 'SELECT test.myfield, test.otherfield FROM test'; $resultId = sqlite_query($connectionId, $sql); while ($result = sqlite_fetch_array($resultId, SQLITE_ASSOC)) print_r($result); ?> Expected result: ---------------- Array ( [myfield] => value1 [otherfield] => value1 ) Array ( [myfield] => value2 [otherfield] => value2 ) Actual result: -------------- Array ( [test.myfield] => value1 [test.otherfield] => value1 ) Array ( [test.myfield] => value2 [test.otherfield] => value2 ) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=32736&edit=1