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
...
@@ -821,20 +821,20 @@ class MysqliDb
}
}
foreach
(
$this
->
_updateColumns
as
$column
)
{
foreach
(
$this
->
_updateColumns
as
$column
)
{
$this
->
_query
.=
"`"
.
$column
.
"` = "
;
$this
->
_query
.=
"`"
.
$column
.
"` = "
;
// Simple value
// Simple value
if
(
!
is_array
(
$tableData
[
$column
]))
{
if
(
!
is_array
(
$tableData
[
$column
]))
{
$this
->
_bindParam
(
$tableData
[
$column
]);
$this
->
_bindParam
(
$tableData
[
$column
]);
$this
->
_query
.=
'?, '
;
$this
->
_query
.=
'?, '
;
continue
;
continue
;
}
}
// Function value
// Function value
$arr
=
$tableData
[
$column
];
$arr
=
$tableData
[
$column
];
$key
=
key
(
$arr
);
$key
=
key
(
$arr
);
$val
=
$arr
[
$key
];
$val
=
$arr
[
$key
];
switch
(
$key
)
{
switch
(
$key
)
{
case
'[I]'
:
case
'[I]'
:
$this
->
_query
.=
$column
.
$val
.
", "
;
$this
->
_query
.=
$column
.
$val
.
", "
;
break
;
break
;
...
@@ -851,7 +851,7 @@ class MysqliDb
...
@@ -851,7 +851,7 @@ class MysqliDb
break
;
break
;
default
:
default
:
die
(
"Wrong operation"
);
die
(
"Wrong operation"
);
}
}
}
}
$this
->
_query
=
rtrim
(
$this
->
_query
,
', '
);
$this
->
_query
=
rtrim
(
$this
->
_query
,
', '
);
}
}
...
...
tests/mysqliDbTests.php
View file @
d61612df
...
@@ -32,7 +32,7 @@ $tables = Array (
...
@@ -32,7 +32,7 @@ $tables = Array (
'updatedAt'
=>
'datetime'
,
'updatedAt'
=>
'datetime'
,
'expires'
=>
'datetime'
,
'expires'
=>
'datetime'
,
'loginCount'
=>
'int(10) default 0'
,
'loginCount'
=>
'int(10) default 0'
,
'unique key'
=>
'login (login)'
'unique key'
=>
'login (login)'
),
),
'products'
=>
Array
(
'products'
=>
Array
(
'customerId'
=>
'int(10) not null'
,
'customerId'
=>
'int(10) not null'
,
...
@@ -178,16 +178,16 @@ if ($db->count != 3) {
...
@@ -178,16 +178,16 @@ if ($db->count != 3) {
// insert with on duplicate key update
// insert with on duplicate key update
$user
=
Array
(
'login'
=>
'user3'
,
$user
=
Array
(
'login'
=>
'user3'
,
'active'
=>
true
,
'active'
=>
true
,
'customerId'
=>
11
,
'customerId'
=>
11
,
'firstName'
=>
'Pete'
,
'firstName'
=>
'Pete'
,
'lastName'
=>
'D'
,
'lastName'
=>
'D'
,
'password'
=>
$db
->
func
(
'SHA1(?)'
,
Array
(
"secretpassword2+salt"
)),
'password'
=>
$db
->
func
(
'SHA1(?)'
,
Array
(
"secretpassword2+salt"
)),
'createdAt'
=>
$db
->
now
(),
'createdAt'
=>
$db
->
now
(),
'updatedAt'
=>
$db
->
now
(),
'updatedAt'
=>
$db
->
now
(),
'expires'
=>
$db
->
now
(
'+1Y'
),
'expires'
=>
$db
->
now
(
'+1Y'
),
'loginCount'
=>
$db
->
inc
(
3
)
'loginCount'
=>
$db
->
inc
(
3
)
);
);
$updateColumns
=
Array
(
"updatedAt"
);
$updateColumns
=
Array
(
"updatedAt"
);
$insertLastId
=
"id"
;
$insertLastId
=
"id"
;
$db
->
onDuplicate
(
$updateColumns
,
"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