Explorar el Código

ZF-8292 - Bugfix in Postgres TRUNCATE command

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@19104 44c647ce-9c0f-0410-b52a-842ac1e357ba
beberlei hace 16 años
padre
commit
8064987280
Se han modificado 1 ficheros con 6 adiciones y 2 borrados
  1. 6 2
      library/Zend/Test/PHPUnit/Db/Operation/Truncate.php

+ 6 - 2
library/Zend/Test/PHPUnit/Db/Operation/Truncate.php

@@ -93,16 +93,20 @@ class Zend_Test_PHPUnit_Db_Operation_Truncate implements PHPUnit_Extensions_Data
         if($db instanceof Zend_Db_Adapter_Pdo_Sqlite) {
         if($db instanceof Zend_Db_Adapter_Pdo_Sqlite) {
             $db->query('DELETE FROM '.$tableName);
             $db->query('DELETE FROM '.$tableName);
         } else if($db instanceof Zend_Db_Adapter_Db2) {
         } else if($db instanceof Zend_Db_Adapter_Db2) {
-            if(strstr(PHP_OS, "WIN")) {
+            /*if(strstr(PHP_OS, "WIN")) {
                 $file = tempnam(sys_get_temp_dir(), "zendtestdbibm_");
                 $file = tempnam(sys_get_temp_dir(), "zendtestdbibm_");
                 file_put_contents($file, "");
                 file_put_contents($file, "");
                 $db->query('IMPORT FROM '.$file.' OF DEL REPLACE INTO '.$tableName);
                 $db->query('IMPORT FROM '.$file.' OF DEL REPLACE INTO '.$tableName);
                 unlink($file);
                 unlink($file);
             } else {
             } else {
                 $db->query('IMPORT FROM /dev/null OF DEL REPLACE INTO '.$tableName);
                 $db->query('IMPORT FROM /dev/null OF DEL REPLACE INTO '.$tableName);
-            }
+            }*/
+            require_once "Zend/Exception.php";
+            throw Zend_Exception("IBM Db2 TRUNCATE not supported.");
         } else if($this->_isMssqlOrOracle($db)) {
         } else if($this->_isMssqlOrOracle($db)) {
             $db->query('TRUNCATE TABLE '.$tableName);
             $db->query('TRUNCATE TABLE '.$tableName);
+        } else if($db instanceof Zend_Db_Adapter_Pdo_Pgsql) {
+            $db->query('TRUNCATE '.$tableName.' CASCADE');
         } else {
         } else {
             $db->query('TRUNCATE '.$tableName);
             $db->query('TRUNCATE '.$tableName);
         }
         }