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
dad6618e
Commit
dad6618e
authored
Aug 17, 2015
by
Alexander Butenko
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #299 from avbdr/master
fixes
parents
8eea785a
71d38c2e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
17 deletions
+13
-17
MysqliDb.php
MysqliDb.php
+12
-17
dbObject.php
dbObject.php
+1
-0
No files found.
MysqliDb.php
View file @
dad6618e
...
@@ -9,6 +9,7 @@
...
@@ -9,6 +9,7 @@
* @author Alexander V. Butenko <a.butenka@gmail.com>
* @author Alexander V. Butenko <a.butenka@gmail.com>
* @copyright Copyright (c) 2010
* @copyright Copyright (c) 2010
* @license http://opensource.org/licenses/gpl-3.0.html GNU Public License
* @license http://opensource.org/licenses/gpl-3.0.html GNU Public License
* @link http://github.com/joshcam/PHP-MySQLi-Database-Class
* @version 2.2
* @version 2.2
**/
**/
class
MysqliDb
class
MysqliDb
...
@@ -307,7 +308,7 @@ class MysqliDb
...
@@ -307,7 +308,7 @@ class MysqliDb
$this
->
_query
=
$query
;
$this
->
_query
=
$query
;
$stmt
=
$this
->
_prepareQuery
();
$stmt
=
$this
->
_prepareQuery
();
if
(
is_array
(
$bindParams
)
===
true
)
{
if
(
is_array
(
$bindParams
)
===
true
)
{
foreach
(
$bindParams
as
$prop
=>
$val
)
{
foreach
(
$bindParams
as
$prop
=>
$val
)
{
$params
[
0
]
.=
$this
->
_determineType
(
$val
);
$params
[
0
]
.=
$this
->
_determineType
(
$val
);
array_push
(
$params
,
$bindParams
[
$prop
]);
array_push
(
$params
,
$bindParams
[
$prop
]);
...
@@ -915,9 +916,8 @@ class MysqliDb
...
@@ -915,9 +916,8 @@ class MysqliDb
// if $meta is false yet sqlstate is true, there's no sql error but the query is
// if $meta is false yet sqlstate is true, there's no sql error but the query is
// most likely an update/insert/delete which doesn't produce any results
// most likely an update/insert/delete which doesn't produce any results
if
(
!
$meta
&&
$stmt
->
sqlstate
)
{
if
(
!
$meta
&&
$stmt
->
sqlstate
)
return
array
();
return
array
();
}
$row
=
array
();
$row
=
array
();
while
(
$field
=
$meta
->
fetch_field
())
{
while
(
$field
=
$meta
->
fetch_field
())
{
...
@@ -975,9 +975,8 @@ class MysqliDb
...
@@ -975,9 +975,8 @@ class MysqliDb
$totalCount
=
$stmt
->
fetch_row
();
$totalCount
=
$stmt
->
fetch_row
();
$this
->
totalCount
=
$totalCount
[
0
];
$this
->
totalCount
=
$totalCount
[
0
];
}
}
if
(
$this
->
returnType
==
'Json'
)
{
if
(
$this
->
returnType
==
'Json'
)
return
json_encode
(
$results
);
return
json_encode
(
$results
);
}
return
$results
;
return
$results
;
}
}
...
@@ -1188,9 +1187,8 @@ class MysqliDb
...
@@ -1188,9 +1187,8 @@ class MysqliDb
*/
*/
protected
function
_prepareQuery
()
protected
function
_prepareQuery
()
{
{
if
(
!
$stmt
=
$this
->
mysqli
()
->
prepare
(
$this
->
_query
))
{
if
(
!
$stmt
=
$this
->
mysqli
()
->
prepare
(
$this
->
_query
))
throw
new
Exception
(
"Problem preparing query (
$this->_query
) "
.
$this
->
mysqli
()
->
error
);
throw
new
Exception
(
"Problem preparing query (
$this->_query
) "
.
$this
->
mysqli
()
->
error
);
}
if
(
$this
->
traceEnabled
)
if
(
$this
->
traceEnabled
)
$this
->
traceStartQ
=
microtime
(
true
);
$this
->
traceStartQ
=
microtime
(
true
);
...
@@ -1218,11 +1216,10 @@ class MysqliDb
...
@@ -1218,11 +1216,10 @@ class MysqliDb
//Reference in the function arguments are required for HHVM to work
//Reference in the function arguments are required for HHVM to work
//https://github.com/facebook/hhvm/issues/5155
//https://github.com/facebook/hhvm/issues/5155
//Referenced data array is required by mysqli since PHP 5.3+
//Referenced data array is required by mysqli since PHP 5.3+
if
(
strnatcmp
(
phpversion
(),
'5.3'
)
>=
0
)
{
if
(
strnatcmp
(
phpversion
(),
'5.3'
)
>=
0
)
{
$refs
=
array
();
$refs
=
array
();
foreach
(
$arr
as
$key
=>
$value
)
{
foreach
(
$arr
as
$key
=>
$value
)
$refs
[
$key
]
=
&
$arr
[
$key
];
$refs
[
$key
]
=
&
$arr
[
$key
];
}
return
$refs
;
return
$refs
;
}
}
return
$arr
;
return
$arr
;
...
@@ -1340,9 +1337,8 @@ class MysqliDb
...
@@ -1340,9 +1337,8 @@ class MysqliDb
* @param int increment by int or float. 1 by default
* @param int increment by int or float. 1 by default
*/
*/
public
function
inc
(
$num
=
1
)
{
public
function
inc
(
$num
=
1
)
{
if
(
!
is_numeric
(
$num
)){
if
(
!
is_numeric
(
$num
))
throw
new
Exception
(
'Argument supplied to inc must be a number'
);
throw
new
Exception
(
'Argument supplied to inc must be a number'
);
}
return
Array
(
"[I]"
=>
"+"
.
$num
);
return
Array
(
"[I]"
=>
"+"
.
$num
);
}
}
...
@@ -1351,9 +1347,8 @@ class MysqliDb
...
@@ -1351,9 +1347,8 @@ class MysqliDb
* @param int increment by int or float. 1 by default
* @param int increment by int or float. 1 by default
*/
*/
public
function
dec
(
$num
=
1
)
{
public
function
dec
(
$num
=
1
)
{
if
(
!
is_numeric
(
$num
)){
if
(
!
is_numeric
(
$num
))
throw
new
Exception
(
'Argument supplied to dec must be a number'
);
throw
new
Exception
(
'Argument supplied to dec must be a number'
);
}
return
Array
(
"[I]"
=>
"-"
.
$num
);
return
Array
(
"[I]"
=>
"-"
.
$num
);
}
}
...
...
dbObject.php
View file @
dad6618e
...
@@ -7,6 +7,7 @@
...
@@ -7,6 +7,7 @@
* @author Alexander V. Butenko <a.butenka@gmail.com>
* @author Alexander V. Butenko <a.butenka@gmail.com>
* @copyright Copyright (c) 2015
* @copyright Copyright (c) 2015
* @license http://opensource.org/licenses/gpl-3.0.html GNU Public License
* @license http://opensource.org/licenses/gpl-3.0.html GNU Public License
* @link http://github.com/joshcam/PHP-MySQLi-Database-Class
* @version 2.2
* @version 2.2
*
*
* @method int count ()
* @method int count ()
...
...
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