Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
PHP-MySQLi-Database-Class
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
PHP-MySQLi-Database-Class
Commits
79f9aeaf
Commit
79f9aeaf
authored
May 12, 2014
by
Alexander Butenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added boolean variables support
parent
a0757e27
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
0 deletions
+20
-0
MysqliDb.php
MysqliDb.php
+1
-0
tests.php
tests.php
+19
-0
No files found.
MysqliDb.php
View file @
79f9aeaf
...
...
@@ -444,6 +444,7 @@ class MysqliDb
return
's'
;
break
;
case
'boolean'
:
case
'integer'
:
return
'i'
;
break
;
...
...
tests.php
View file @
79f9aeaf
...
...
@@ -8,6 +8,7 @@ if(!$db) die("Database error");
$tables
=
Array
(
'users'
=>
Array
(
'login'
=>
'char(10) not null'
,
'active'
=>
'bool default 0'
,
'customerId'
=>
'int(10) not null'
,
'firstName'
=>
'char(10) not null'
,
'lastName'
=>
'char(10)'
,
...
...
@@ -43,6 +44,7 @@ $data = Array (
'loginCount'
=>
$db
->
inc
(
2
)
),
Array
(
'login'
=>
'user3'
,
'active'
=>
true
,
'customerId'
=>
11
,
'firstName'
=>
'Pete'
,
'lastName'
=>
'D'
,
...
...
@@ -111,6 +113,23 @@ if ($db->count != 3) {
echo
"Invalid total insert count"
;
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
//$db->where("createdAt", Array (">" => $db->interval("-1h")));
//$users = $db->get("users");
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment