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
0890ad90
Commit
0890ad90
authored
Jan 28, 2016
by
Nagy Imre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adding support for error codes
parent
f724dff8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
0 deletions
+22
-0
MysqliDb.php
MysqliDb.php
+22
-0
No files found.
MysqliDb.php
View file @
0890ad90
...
...
@@ -106,6 +106,13 @@ class MysqliDb
*/
protected
$_stmtError
;
/**
* Variable which holds last statement error number
*
* @var int
*/
protected
$_stmtErrno
;
/**
* Database credentials
* @var string
...
...
@@ -393,6 +400,7 @@ class MysqliDb
$stmt
->
execute
();
$this
->
count
=
$stmt
->
affected_rows
;
$this
->
_stmtError
=
$stmt
->
error
;
$this
->
_stmtErrno
=
$stmt
->
errno
;
$this
->
_lastQuery
=
$this
->
replacePlaceHolders
(
$this
->
_query
,
$params
);
$res
=
$this
->
_dynamicBindResults
(
$stmt
);
$this
->
reset
();
...
...
@@ -464,6 +472,7 @@ class MysqliDb
$stmt
=
$this
->
_buildQuery
(
$numRows
);
$stmt
->
execute
();
$this
->
_stmtError
=
$stmt
->
error
;
$this
->
_stmtErrno
=
$stmt
->
errno
;
$res
=
$this
->
_dynamicBindResults
(
$stmt
);
$this
->
reset
();
...
...
@@ -555,6 +564,7 @@ class MysqliDb
$stmt
->
execute
();
$this
->
_stmtError
=
$stmt
->
error
;
$this
->
_stmtErrno
=
$stmt
->
errno
;
$res
=
$this
->
_dynamicBindResults
(
$stmt
);
$this
->
reset
();
...
...
@@ -676,6 +686,7 @@ class MysqliDb
$status
=
$stmt
->
execute
();
$this
->
reset
();
$this
->
_stmtError
=
$stmt
->
error
;
$this
->
_stmtErrno
=
$stmt
->
errno
;
$this
->
count
=
$stmt
->
affected_rows
;
return
$status
;
...
...
@@ -707,6 +718,7 @@ class MysqliDb
$stmt
=
$this
->
_buildQuery
(
$numRows
);
$stmt
->
execute
();
$this
->
_stmtError
=
$stmt
->
error
;
$this
->
_stmtErrno
=
$stmt
->
errno
;
$this
->
reset
();
return
(
$stmt
->
affected_rows
>
0
);
...
...
@@ -1037,6 +1049,7 @@ class MysqliDb
$stmt
=
$this
->
_buildQuery
(
null
,
$insertData
);
$status
=
$stmt
->
execute
();
$this
->
_stmtError
=
$stmt
->
error
;
$this
->
_stmtErrno
=
$stmt
->
errno
;
$haveOnDuplicate
=
!
empty
(
$this
->
_updateColumns
);
$this
->
reset
();
$this
->
count
=
$stmt
->
affected_rows
;
...
...
@@ -1583,6 +1596,15 @@ class MysqliDb
return
trim
(
$this
->
_stmtError
.
" "
.
$this
->
mysqli
()
->
error
);
}
/**
* Method returns mysql error number
*
* @return int
*/
public
function
getLastErrno
()
{
return
$this
->
_stmtErrno
;
}
/**
* Mostly internal method to get query and its params out of subquery object
* after get() and getAll()
...
...
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