Commit 79f9aeaf authored by Alexander Butenko's avatar Alexander Butenko

Added boolean variables support

parent a0757e27
...@@ -444,6 +444,7 @@ class MysqliDb ...@@ -444,6 +444,7 @@ class MysqliDb
return 's'; return 's';
break; break;
case 'boolean':
case 'integer': case 'integer':
return 'i'; return 'i';
break; break;
......
...@@ -8,6 +8,7 @@ if(!$db) die("Database error"); ...@@ -8,6 +8,7 @@ if(!$db) die("Database error");
$tables = Array ( $tables = Array (
'users' => Array ( 'users' => Array (
'login' => 'char(10) not null', 'login' => 'char(10) not null',
'active' => 'bool default 0',
'customerId' => 'int(10) not null', 'customerId' => 'int(10) not null',
'firstName' => 'char(10) not null', 'firstName' => 'char(10) not null',
'lastName' => 'char(10)', 'lastName' => 'char(10)',
...@@ -43,6 +44,7 @@ $data = Array ( ...@@ -43,6 +44,7 @@ $data = Array (
'loginCount' => $db->inc(2) 'loginCount' => $db->inc(2)
), ),
Array ('login' => 'user3', Array ('login' => 'user3',
'active' => true,
'customerId' => 11, 'customerId' => 11,
'firstName' => 'Pete', 'firstName' => 'Pete',
'lastName' => 'D', 'lastName' => 'D',
...@@ -111,6 +113,23 @@ if ($db->count != 3) { ...@@ -111,6 +113,23 @@ if ($db->count != 3) {
echo "Invalid total insert count"; echo "Invalid total insert count";
exit; exit;
} }
$db->where ("active", true);
$users = $db->get("users");
if ($db->count != 1) {
echo "Invalid total insert count with boolean";
exit;
}
$db->where ("active", false);
$db->update("users", Array ("active" => $db->not()));
$db->where ("active", true);
$users = $db->get("users");
if ($db->count != 3) {
echo "Invalid total insert count with boolean";
exit;
}
// TODO // TODO
//$db->where("createdAt", Array (">" => $db->interval("-1h"))); //$db->where("createdAt", Array (">" => $db->interval("-1h")));
//$users = $db->get("users"); //$users = $db->get("users");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment