@ 2014-06-04T08:48:39Z <?php
$connection = new PDO('sqlite::memory:');
$connection->exec('CREATE TABLE transactions (id INTEGER, amount NUMERIC, date TEXT)');
$stmt = $connection->query('SELECT * FROM transactions');
var_dump($stmt->columnCount(), $stmt->getColumnMeta(0), $stmt->getColumnMeta(1), $stmt->getColumnMeta(2));
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 8.1.0 - 8.1.28 , 8.2.0 - 8.2.18 , 8.3.0 - 8.3.6 int(3)
array(8) {
["native_type"]=>
string(4) "null"
["pdo_type"]=>
int(0)
["sqlite:decl_type"]=>
string(7) "INTEGER"
["table"]=>
string(12) "transactions"
["flags"]=>
array(0) {
}
["name"]=>
string(2) "id"
["len"]=>
int(-1)
["precision"]=>
int(0)
}
array(8) {
["native_type"]=>
string(4) "null"
["pdo_type"]=>
int(0)
["sqlite:decl_type"]=>
string(7) "NUMERIC"
["table"]=>
string(12) "transactions"
["flags"]=>
array(0) {
}
["name"]=>
string(6) "amount"
["len"]=>
int(-1)
["precision"]=>
int(0)
}
array(8) {
["native_type"]=>
string(4) "null"
["pdo_type"]=>
int(0)
["sqlite:decl_type"]=>
string(4) "TEXT"
["table"]=>
string(12) "transactions"
["flags"]=>
array(0) {
}
["name"]=>
string(4) "date"
["len"]=>
int(-1)
["precision"]=>
int(0)
}
Output for 7.3.21 - 7.3.33 , 7.4.8 - 7.4.33 , 8.0.0 - 8.0.30 int(3)
array(8) {
["native_type"]=>
string(4) "null"
["sqlite:decl_type"]=>
string(7) "INTEGER"
["table"]=>
string(12) "transactions"
["flags"]=>
array(0) {
}
["name"]=>
string(2) "id"
["len"]=>
int(-1)
["precision"]=>
int(0)
["pdo_type"]=>
int(2)
}
array(8) {
["native_type"]=>
string(4) "null"
["sqlite:decl_type"]=>
string(7) "NUMERIC"
["table"]=>
string(12) "transactions"
["flags"]=>
array(0) {
}
["name"]=>
string(6) "amount"
["len"]=>
int(-1)
["precision"]=>
int(0)
["pdo_type"]=>
int(2)
}
array(8) {
["native_type"]=>
string(4) "null"
["sqlite:decl_type"]=>
string(4) "TEXT"
["table"]=>
string(12) "transactions"
["flags"]=>
array(0) {
}
["name"]=>
string(4) "date"
["len"]=>
int(-1)
["precision"]=>
int(0)
["pdo_type"]=>
int(2)
}
Output for 5.1.0 - 5.1.3 , 5.2.0 - 5.2.17 , 5.3.0 - 5.3.29 , 5.4.0 - 5.4.45 , 5.5.0 - 5.5.38 , 5.6.0 - 5.6.40 , 7.0.0 - 7.0.33 , 7.1.0 - 7.1.33 , 7.2.0 - 7.2.33 , 7.3.0 - 7.3.19 , 7.4.0 - 7.4.7 int(3)
bool(false)
bool(false)
bool(false)
Output for 7.3.20 int(3)
array(8) {
["native_type"]=>
string(4) "null"
["sqlite:decl_type"]=>
string(7) "INTEGER"
["table"]=>
string(12) "transactions"
["flags"]=>
array(0) {
}
["name"]=>
string(2) "id"
["len"]=>
int(4294967295)
["precision"]=>
int(0)
["pdo_type"]=>
int(2)
}
array(8) {
["native_type"]=>
string(4) "null"
["sqlite:decl_type"]=>
string(7) "NUMERIC"
["table"]=>
string(12) "transactions"
["flags"]=>
array(0) {
}
["name"]=>
string(6) "amount"
["len"]=>
int(4294967295)
["precision"]=>
int(0)
["pdo_type"]=>
int(2)
}
array(8) {
["native_type"]=>
string(4) "null"
["sqlite:decl_type"]=>
string(4) "TEXT"
["table"]=>
string(12) "transactions"
["flags"]=>
array(0) {
}
["name"]=>
string(4) "date"
["len"]=>
int(4294967295)
["precision"]=>
int(0)
["pdo_type"]=>
int(2)
}
Output for 5.1.4 - 5.1.6 Fatal error: Uncaught exception 'PDOException' with message 'could not find driver' in /in/UIjOj:2
Stack trace:
#0 /in/UIjOj(2): PDO->__construct('sqlite::memory:')
#1 {main}
thrown in /in/UIjOj on line 2
Process exited with code 255 . Output for 5.0.0 - 5.0.5 Fatal error: Class 'PDO' not found in /in/UIjOj on line 2
Process exited with code 255 . Output for 4.3.2 - 4.3.11 , 4.4.0 - 4.4.9 Fatal error: Cannot instantiate non-existent class: pdo in /in/UIjOj on line 2
Process exited with code 255 . Output for 4.3.0 - 4.3.1 Fatal error: Cannot instantiate non-existent class: pdo in /in/UIjOj on line 2
preferences:dark mode live preview
280.53 ms | 401 KiB | 460 Q