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
64b5a57b
Commit
64b5a57b
authored
Jul 13, 2016
by
Alexander Butenko
Committed by
GitHub
Jul 13, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #501 from Ettemlevest/master
Adding error number to exception
parents
0f0ca575
3221f248
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
6 deletions
+9
-6
MysqliDb.php
MysqliDb.php
+9
-6
No files found.
MysqliDb.php
View file @
64b5a57b
...
...
@@ -281,7 +281,7 @@ class MysqliDb
$this
->
_mysqli
=
new
mysqli
(
$this
->
host
,
$this
->
username
,
$this
->
password
,
$this
->
db
,
$this
->
port
);
if
(
$this
->
_mysqli
->
connect_error
)
{
throw
new
Exception
(
'Connect Error '
.
$this
->
_mysqli
->
connect_errno
.
': '
.
$this
->
_mysqli
->
connect_error
);
throw
new
Exception
(
'Connect Error '
.
$this
->
_mysqli
->
connect_errno
.
': '
.
$this
->
_mysqli
->
connect_error
,
$this
->
_mysqli
->
connect_errno
);
}
if
(
$this
->
charset
)
{
...
...
@@ -408,7 +408,7 @@ class MysqliDb
// Failed?
if
(
!
$stmt
){
throw
new
Exception
(
"Unprepared Query Failed, ERRNO: "
.
$this
->
mysqli
()
->
errno
.
" ("
.
$this
->
mysqli
()
->
error
.
")"
);
throw
new
Exception
(
"Unprepared Query Failed, ERRNO: "
.
$this
->
mysqli
()
->
errno
.
" ("
.
$this
->
mysqli
()
->
error
.
")"
,
$this
->
mysqli
()
->
errno
);
};
// return stmt for future use
...
...
@@ -1136,6 +1136,7 @@ class MysqliDb
// Exceute the query unprepared because LOCK only works with unprepared statements.
$result
=
$this
->
queryUnprepared
(
$this
->
_query
);
$errno
=
$this
->
mysqli
()
->
errno
;
// Reset the query
$this
->
reset
();
...
...
@@ -1148,7 +1149,7 @@ class MysqliDb
}
// Something went wrong
else
{
throw
new
Exception
(
"Locking of table "
.
$table
.
" failed"
);
throw
new
Exception
(
"Locking of table "
.
$table
.
" failed"
,
$errno
);
}
// Return the success value
...
...
@@ -1169,6 +1170,7 @@ class MysqliDb
// Exceute the query unprepared because UNLOCK and LOCK only works with unprepared statements.
$result
=
$this
->
queryUnprepared
(
$this
->
_query
);
$errno
=
$this
->
mysqli
()
->
errno
;
// Reset the query
$this
->
reset
();
...
...
@@ -1180,7 +1182,7 @@ class MysqliDb
}
// Something went wrong
else
{
throw
new
Exception
(
"Unlocking of tables failed"
);
throw
new
Exception
(
"Unlocking of tables failed"
,
$errno
);
}
...
...
@@ -1770,8 +1772,9 @@ class MysqliDb
{
if
(
!
$stmt
=
$this
->
mysqli
()
->
prepare
(
$this
->
_query
))
{
$msg
=
$this
->
mysqli
()
->
error
.
" query: "
.
$this
->
_query
;
$num
=
$this
->
mysqli
()
->
errno
;
$this
->
reset
();
throw
new
Exception
(
$msg
);
throw
new
Exception
(
$msg
,
$num
);
}
if
(
$this
->
traceEnabled
)
{
...
...
@@ -2284,4 +2287,4 @@ class MysqliDb
}
}
// END class
\ No newline at end of file
// END class
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