/**
  * @param ConnectionInterface $connection
  * @param atring              $schema
  * @param string              $prefix
  */
 public function __construct(ConnectionInterface $connection, $schema, $prefix = '')
 {
     $this->connection = $connection;
     $this->prefix = $prefix;
     $result = $this->connection->select("SELECT * FROM sqlite_master WHERE name = '{$this->table}' AND type = 'table'");
     if (0 == count($result)) {
         // Create the caches table
         $this->connection->statement($schema);
     }
 }
Example #2
0
 /**
  * Truncate all records
  * @return void
  */
 public function truncate()
 {
     if ($this->fireEvent('truncating') === false) {
         return false;
     }
     $this->connection->statement("SET foreign_key_checks=0");
     $this->table()->truncate();
     $this->connection->statement("SET foreign_key_checks=1");
     $this->fireEvent('truncated');
 }
Example #3
0
 /**
  * Truncate all records
  * @return void
  */
 public function truncate()
 {
     if ($this->fireEvent('truncating') === false) {
         return false;
     }
     // This SET statement fails with sqlite
     try {
         $this->connection->statement("SET foreign_key_checks=0");
     } catch (Exception $e) {
         // do nothing
     }
     $this->table()->truncate();
     try {
         $this->connection->statement("SET foreign_key_checks=1");
     } catch (Exception $e) {
         // do nothing
     }
     $this->fireEvent('truncated');
 }