1414namespace CodeIgniter \Database \OCI8 ;
1515
1616use CodeIgniter \Database \BasePreparedQuery ;
17+ use CodeIgniter \Database \Exceptions \DatabaseException ;
1718use CodeIgniter \Exceptions \BadMethodCallException ;
1819use ErrorException ;
1920use OCILob ;
@@ -89,10 +90,10 @@ public function _execute(array $data): bool
8990 try {
9091 $ result = oci_execute ($ this ->statement , $ this ->db ->commitMode );
9192 } catch (ErrorException $ e ) {
92- $ this ->setDatabaseExceptionFromStatement ($ e );
93+ $ databaseException = $ this ->setDatabaseExceptionFromStatement ($ e );
9394
9495 if ($ this ->db ->DBDebug ) {
95- throw $ this -> databaseException ;
96+ throw $ databaseException ;
9697 }
9798
9899 return false ;
@@ -103,10 +104,10 @@ public function _execute(array $data): bool
103104 }
104105
105106 if ($ result === false ) {
106- $ this ->setDatabaseExceptionFromStatement ();
107+ $ databaseException = $ this ->setDatabaseExceptionFromStatement ();
107108
108109 if ($ this ->db ->DBDebug ) {
109- throw $ this -> databaseException ;
110+ throw $ databaseException ;
110111 }
111112 }
112113
@@ -138,12 +139,14 @@ protected function _close(): bool
138139 /**
139140 * Captures the native OCI statement error for shared database exception classification.
140141 */
141- private function setDatabaseExceptionFromStatement (?ErrorException $ previous = null ): void
142+ private function setDatabaseExceptionFromStatement (?ErrorException $ previous = null ): DatabaseException
142143 {
143144 $ error = oci_error ($ this ->statement );
144145 $ this ->errorCode = $ error ['code ' ] ?? 0 ;
145146 $ this ->errorString = $ error ['message ' ] ?? $ previous ?->getMessage() ?? '' ;
146147 $ this ->databaseException = $ this ->db ->createDatabaseException ($ this ->errorString , $ this ->errorCode , $ previous );
148+
149+ return $ this ->databaseException ;
147150 }
148151
149152 /**
0 commit comments