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
16d88ae2
Commit
16d88ae2
authored
Aug 04, 2015
by
Alexander Butenko
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #284 from avbdr/master
fixes
parents
20db85d5
bd30f30d
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
93 additions
and
111 deletions
+93
-111
MysqliDb.php
MysqliDb.php
+81
-109
mysqliDbTests.php
tests/mysqliDbTests.php
+12
-2
No files found.
MysqliDb.php
View file @
16d88ae2
This diff is collapsed.
Click to expand it.
tests/mysqliDbTests.php
View file @
16d88ae2
...
...
@@ -11,7 +11,7 @@ $db = new Mysqlidb($mysqli);
$db
=
new
Mysqlidb
(
Array
(
'host'
=>
'localhost'
,
'username'
=>
'root'
,
'username'
=>
'root'
,
'password'
=>
''
,
'db'
=>
'testdb'
,
'prefix'
=>
$prefix
,
...
...
@@ -102,6 +102,7 @@ $data = Array (
function
createTable
(
$name
,
$data
)
{
global
$db
;
//$q = "CREATE TABLE $name (id INT(9) UNSIGNED PRIMARY KEY NOT NULL";
$db
->
rawQuery
(
"DROP TABLE IF EXISTS
$name
"
);
$q
=
"CREATE TABLE
$name
(id INT(9) UNSIGNED PRIMARY KEY AUTO_INCREMENT"
;
foreach
(
$data
as
$k
=>
$v
)
{
$q
.=
",
$k
$v
"
;
...
...
@@ -192,6 +193,15 @@ $updateColumns = Array ("updatedAt");
$insertLastId
=
"id"
;
$db
->
onDuplicate
(
$updateColumns
,
"id"
);
$db
->
insert
(
"users"
,
$user
);
$nUser
=
$db
->
where
(
'login'
,
'user3'
)
->
get
(
'users'
);
if
(
$db
->
count
!=
1
)
{
echo
"onDuplicate update failed. "
;
exit
;
}
if
(
$nUser
[
0
][
'createdAt'
]
==
$nUser
[
0
][
'updatedAt'
])
{
echo
"onDuplicate2 update failed. "
;
exit
;
}
// order by field
$db
->
orderBy
(
"login"
,
"asc"
,
Array
(
"user3"
,
"user2"
,
"user1"
));
...
...
@@ -380,7 +390,7 @@ if ($db->totalCount != 3) {
$db
->
delete
(
"users"
);
$db
->
get
(
"users"
);
if
(
$db
->
count
!=
0
)
{
echo
"Invalid users count after delete"
;
echo
"Invalid users count after delete"
;
exit
;
}
$db
->
delete
(
"products"
);
...
...
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