From 6ab9ffc0d8c4022ad9dc1027631fe0859cd7cae7 Mon Sep 17 00:00:00 2001 From: Guillermo Dev Date: Fri, 30 Nov 2018 16:06:51 +0100 Subject: [PATCH] inserted execute without throwing errors --- src/Db/Connection.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/Db/Connection.php b/src/Db/Connection.php index 19a8d00..acf2a51 100644 --- a/src/Db/Connection.php +++ b/src/Db/Connection.php @@ -23,6 +23,22 @@ class Connection return new OdbcResultset(self::getReq()->getResultSet($sql, $values, $fetchMode)); } + /** + * Replaces de old execute($sql, $throwErrors=false) + * + * @param $query + * @return OdbcResultSet|resource|string + */ + public static function executeDontThrow($sql, $values, $fetchMode = \PDO::FETCH_ASSOC) + { + try { + $res = $this->execute($sql, $values, $fetchMode); + } catch (SqlException $e) { + $res = false; + } + return $res; + } + /** * @return PDO connection */