@@ -281,7 +281,7 @@ public function connect()
281
281
$ this ->_mysqli = new mysqli ($ this ->host , $ this ->username , $ this ->password , $ this ->db , $ this ->port );
282
282
283
283
if ($ this ->_mysqli ->connect_error ) {
284
- throw new Exception ('Connect Error ' . $ this ->_mysqli ->connect_errno . ': ' . $ this ->_mysqli ->connect_error );
284
+ throw new Exception ('Connect Error ' . $ this ->_mysqli ->connect_errno . ': ' . $ this ->_mysqli ->connect_error , $ this -> _mysqli -> connect_errno );
285
285
}
286
286
287
287
if ($ this ->charset ) {
@@ -408,7 +408,7 @@ private function queryUnprepared($query)
408
408
409
409
// Failed?
410
410
if (!$ stmt ){
411
- throw new Exception ("Unprepared Query Failed, ERRNO: " .$ this ->mysqli ()->errno ." ( " .$ this ->mysqli ()->error .") " );
411
+ throw new Exception ("Unprepared Query Failed, ERRNO: " .$ this ->mysqli ()->errno ." ( " .$ this ->mysqli ()->error .") " , $ this -> mysqli ()-> errno );
412
412
};
413
413
414
414
// return stmt for future use
@@ -1136,6 +1136,7 @@ public function lock($table)
1136
1136
1137
1137
// Exceute the query unprepared because LOCK only works with unprepared statements.
1138
1138
$ result = $ this ->queryUnprepared ($ this ->_query );
1139
+ $ errno = $ this ->mysqli ()->errno ;
1139
1140
1140
1141
// Reset the query
1141
1142
$ this ->reset ();
@@ -1148,7 +1149,7 @@ public function lock($table)
1148
1149
}
1149
1150
// Something went wrong
1150
1151
else {
1151
- throw new Exception ("Locking of table " .$ table ." failed " );
1152
+ throw new Exception ("Locking of table " .$ table ." failed " , $ errno );
1152
1153
}
1153
1154
1154
1155
// Return the success value
@@ -1169,6 +1170,7 @@ public function unlock()
1169
1170
1170
1171
// Exceute the query unprepared because UNLOCK and LOCK only works with unprepared statements.
1171
1172
$ result = $ this ->queryUnprepared ($ this ->_query );
1173
+ $ errno = $ this ->mysqli ()->errno ;
1172
1174
1173
1175
// Reset the query
1174
1176
$ this ->reset ();
@@ -1180,7 +1182,7 @@ public function unlock()
1180
1182
}
1181
1183
// Something went wrong
1182
1184
else {
1183
- throw new Exception ("Unlocking of tables failed " );
1185
+ throw new Exception ("Unlocking of tables failed " , $ errno );
1184
1186
}
1185
1187
1186
1188
@@ -1770,8 +1772,9 @@ protected function _prepareQuery()
1770
1772
{
1771
1773
if (!$ stmt = $ this ->mysqli ()->prepare ($ this ->_query )) {
1772
1774
$ msg = $ this ->mysqli ()->error . " query: " . $ this ->_query ;
1775
+ $ num = $ this ->mysqli ()->errno ;
1773
1776
$ this ->reset ();
1774
- throw new Exception ($ msg );
1777
+ throw new Exception ($ msg, $ num );
1775
1778
}
1776
1779
1777
1780
if ($ this ->traceEnabled ) {
@@ -2284,4 +2287,4 @@ private function conditionToSql($operator, $val) {
2284
2287
}
2285
2288
}
2286
2289
2287
- // END class
2290
+ // END class
0 commit comments