[Solar-svn] Revision 2942

pmjones at solarphp.com pmjones at solarphp.com
Wed Nov 14 10:37:07 CST 2007


Solar_Sql_Adapter: [CHG] Method query() now intercepts and wraps PDO exceptions when preparing the query.


Modified: trunk/Solar/Sql/Adapter.php
===================================================================
--- trunk/Solar/Sql/Adapter.php	2007-11-14 16:35:39 UTC (rev 2941)
+++ trunk/Solar/Sql/Adapter.php	2007-11-14 16:37:07 UTC (rev 2942)
@@ -500,7 +500,23 @@
         $before = microtime(true);
         
         // prepare the statment
-        $obj = $this->_pdo->prepare($stmt);
+        try {
+            $obj = $this->_pdo->prepare($stmt);
+        } catch (PDOException $e) {
+            throw $this->_exception(
+                'ERR_PREPARE_FAILED',
+                array(
+                    'pdo_code'  => $e->getCode(),
+                    'pdo_text'  => $e->getMessage(),
+                    'host'      => $this->_config['host'],
+                    'port'      => $this->_config['port'],
+                    'user'      => $this->_config['user'],
+                    'name'      => $this->_config['name'],
+                    'stmt'      => $stmt,
+                    'pdo_trace' => $e->getTraceAsString(),
+                )
+            );
+        }
         
         // was data passed for binding?
         if ($data) {




More information about the Solar-svn mailing list