| 
        php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             
             [2011-01-06 01:09 UTC] scottmac@php.net
  [2011-01-06 01:11 UTC] scottmac@php.net
 
-Status:      Open
+Status:      Closed
-Assigned To:
+Assigned To: scottmac
  [2011-01-06 01:11 UTC] scottmac@php.net
  | 
    |||||||||||||||||||||||||||||||||||||
            
                 
                Copyright © 2001-2025 The PHP GroupAll rights reserved.  | 
        Last updated: Tue Nov 04 00:00:01 2025 UTC | 
Description: ------------ The SQLite3Result::columnType() method returns SQLITE3_NULL (5) if not looping over results. This is done because the data type is unknown. But this leads to confusion, because SQLITE3_NULL is a legitimate answer in some cases when inside the loop. It would be clearer if PHP returned NULL or FALSE instead. Test script: --------------- $db = new SQLite3(':memory:'); $db->exec('CREATE TABLE test (whatever INTEGER)'); $db->exec('INSERT INTO test (whatever) VALUES (1)'); $result = $db->query('SELECT * FROM test'); while ($row = $result->fetchArray(SQLITE3_NUM)) { var_dump($result->columnType(0)); // int(1) [SQLITE3_INTEGER] } // Seems returning null or false is more appropriate. var_dump($result->columnType(0)); // int(5) [SQLITE3_NULL] $result->finalize(); $db->close(); echo "Done\n"; Expected result: ---------------- int(1) bool(false) Done Actual result: -------------- int(1) int(5) Done