Ver código fonte

ZF-11640: SQLite backend fails using ":memory:" database
- there is no need to close the db connection after VACUUM

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@24347 44c647ce-9c0f-0410-b52a-842ac1e357ba

mabe 14 anos atrás
pai
commit
d389e787b6

+ 0 - 1
library/Zend/Cache/Backend/Sqlite.php

@@ -530,7 +530,6 @@ class Zend_Cache_Backend_Sqlite extends Zend_Cache_Backend implements Zend_Cache
             $rand = rand(1, $this->_options['automatic_vacuum_factor']);
             if ($rand == 1) {
                 $this->_query('VACUUM');
-                @sqlite_close($this->_getConnection());
             }
         }
     }

+ 20 - 0
tests/Zend/Cache/SqliteBackendTest.php

@@ -101,12 +101,32 @@ class Zend_Cache_sqliteBackendTest extends Zend_Cache_CommonExtendedBackendTest
             'automatic_vacuum_factor' => 1
         ));
         parent::setUp();
+
         $this->assertTrue($this->_instance->remove('bar'));
         $this->assertFalse($this->_instance->test('bar'));
         $this->assertFalse($this->_instance->remove('barbar'));
         $this->assertFalse($this->_instance->test('barbar'));
     }
 
+    /**
+     * @group ZF-11640
+     */
+    public function testRemoveCorrectCallWithVacuumOnMemoryDb()
+    {
+        $this->_instance = new Zend_Cache_Backend_Sqlite(array(
+            'cache_db_complete_path'  => ':memory:',
+            'automatic_vacuum_factor' => 1
+        ));
+        parent::setUp();
+
+        $this->assertGreaterThan(0, $this->_instance->test('bar2'));
+
+        $this->assertTrue($this->_instance->remove('bar'));
+        $this->assertFalse($this->_instance->test('bar'));
+
+        $this->assertGreaterThan(0, $this->_instance->test('bar2'));
+    }
+
 }