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
d61612df
Commit
d61612df
authored
Aug 04, 2015
by
rongzhj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
re-formatted code
parent
75030a1e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
26 deletions
+26
-26
MysqliDb.php
MysqliDb.php
+15
-15
mysqliDbTests.php
tests/mysqliDbTests.php
+11
-11
No files found.
MysqliDb.php
View file @
d61612df
...
...
@@ -821,20 +821,20 @@ class MysqliDb
}
foreach
(
$this
->
_updateColumns
as
$column
)
{
$this
->
_query
.=
"`"
.
$column
.
"` = "
;
// Simple value
if
(
!
is_array
(
$tableData
[
$column
]))
{
$this
->
_bindParam
(
$tableData
[
$column
]);
$this
->
_query
.=
'?, '
;
continue
;
}
// Function value
$arr
=
$tableData
[
$column
];
$key
=
key
(
$arr
);
$val
=
$arr
[
$key
];
switch
(
$key
)
{
$this
->
_query
.=
"`"
.
$column
.
"` = "
;
// Simple value
if
(
!
is_array
(
$tableData
[
$column
]))
{
$this
->
_bindParam
(
$tableData
[
$column
]);
$this
->
_query
.=
'?, '
;
continue
;
}
// Function value
$arr
=
$tableData
[
$column
];
$key
=
key
(
$arr
);
$val
=
$arr
[
$key
];
switch
(
$key
)
{
case
'[I]'
:
$this
->
_query
.=
$column
.
$val
.
", "
;
break
;
...
...
@@ -851,7 +851,7 @@ class MysqliDb
break
;
default
:
die
(
"Wrong operation"
);
}
}
}
$this
->
_query
=
rtrim
(
$this
->
_query
,
', '
);
}
...
...
tests/mysqliDbTests.php
View file @
d61612df
...
...
@@ -32,7 +32,7 @@ $tables = Array (
'updatedAt'
=>
'datetime'
,
'expires'
=>
'datetime'
,
'loginCount'
=>
'int(10) default 0'
,
'unique key'
=>
'login (login)'
'unique key'
=>
'login (login)'
),
'products'
=>
Array
(
'customerId'
=>
'int(10) not null'
,
...
...
@@ -178,16 +178,16 @@ if ($db->count != 3) {
// insert with on duplicate key update
$user
=
Array
(
'login'
=>
'user3'
,
'active'
=>
true
,
'customerId'
=>
11
,
'firstName'
=>
'Pete'
,
'lastName'
=>
'D'
,
'password'
=>
$db
->
func
(
'SHA1(?)'
,
Array
(
"secretpassword2+salt"
)),
'createdAt'
=>
$db
->
now
(),
'updatedAt'
=>
$db
->
now
(),
'expires'
=>
$db
->
now
(
'+1Y'
),
'loginCount'
=>
$db
->
inc
(
3
)
);
'active'
=>
true
,
'customerId'
=>
11
,
'firstName'
=>
'Pete'
,
'lastName'
=>
'D'
,
'password'
=>
$db
->
func
(
'SHA1(?)'
,
Array
(
"secretpassword2+salt"
)),
'createdAt'
=>
$db
->
now
(),
'updatedAt'
=>
$db
->
now
(),
'expires'
=>
$db
->
now
(
'+1Y'
),
'loginCount'
=>
$db
->
inc
(
3
)
);
$updateColumns
=
Array
(
"updatedAt"
);
$insertLastId
=
"id"
;
$db
->
onDuplicate
(
$updateColumns
,
"id"
);
...
...
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