BOOLEAN: Casting Results Example
require 'connect.inc';
$db->query("INSERT INTO t (cf, daf, bf) VALUES ('bt1', " . $p->getDateLiteralType()
. "'2005-01-01', " . $db->quoteSmart(true) . ')');
$db->query("INSERT INTO t (cf, daf, bf) VALUES ('bt2', " . $p->getDateLiteralType()
. "'2005-01-02', " . $db->quoteSmart(false) . ')');
$db->query("INSERT INTO t (cf, daf, bf) VALUES ('bt3', " . $p->getDateLiteralType()
. "'2005-01-03', " . $db->quoteSmart(null) . ')');
$res = $db->query("SELECT bf, cf FROM t WHERE cf LIKE 'bt%' ORDER BY cf");
$out = '';
while ($res->fetchInto($row)) {
$o = $p->castToBoolean($row[0]);
ob_start();
var_dump($o);
$out .= ' ' . trim(ob_get_clean());
}
echo $out;
$res->free();
$db->query("DELETE FROM t WHERE cf LIKE 'bt%'");
mysql
bool(true) bool(false) NULL |
pgsql
bool(true) bool(false) NULL |