@@ -63,6 +63,7 @@ public function connect(
6363 ?int $ port = null ,
6464 ): ?bool {
6565 $ this ->conn = new \Sqlite3 ($ host );
66+ $ this ->conn ->enableExceptions (true );
6667
6768 return true ;
6869 }
@@ -190,7 +191,11 @@ public function query(string $query, int $offset = 0, int $rowcount = 0): \SQLit
190191 $ query .= sprintf (' LIMIT %d,%d ' , $ offset , $ rowcount );
191192 }
192193
193- $ result = @$ this ->conn ->query ($ query );
194+ try {
195+ $ result = $ this ->conn ->query ($ query );
196+ } catch (\SQLite3Exception ) {
197+ $ result = false ;
198+ }
194199
195200 if (!$ result ) {
196201 $ this ->sqlLog .= $ this ->error ();
@@ -212,7 +217,12 @@ public function queryPrepared(string $query, array $params): \SQLite3Result|bool
212217 return false ;
213218 }
214219
215- $ statement = @$ this ->conn ->prepare ($ query );
220+ try {
221+ $ statement = $ this ->conn ->prepare ($ query );
222+ } catch (\SQLite3Exception ) {
223+ $ statement = false ;
224+ }
225+
216226 if (!$ statement instanceof \SQLite3Stmt) {
217227 $ this ->sqlLog .= $ this ->error ();
218228
@@ -225,7 +235,12 @@ public function queryPrepared(string $query, array $params): \SQLite3Result|bool
225235 ++$ position ;
226236 }
227237
228- $ result = @$ statement ->execute ();
238+ try {
239+ $ result = $ statement ->execute ();
240+ } catch (\SQLite3Exception ) {
241+ $ result = false ;
242+ }
243+
229244 if ($ result === false ) {
230245 $ this ->sqlLog .= $ this ->error ();
231246 }
0 commit comments