Example #1
0
 /**
  * Attach
  *
  * Attaches a given SQLite database file into this connection.
  *
  * @param string $dbFile Database file to attach
  * @param string $dbName Alias to give attached database file
  * @return void
  */
 public function attach($dbFile, $dbName)
 {
     $this->_db->query('ATTACH DATABASE "' . $dbFile . '" AS "' . $dbName . '"');
     $tableNames = $this->_db->fetchCol("SELECT name FROM " . $dbName . ".sqlite_master WHERE type = 'table' AND name NOT LIKE 'sqlite_%'");
     foreach ($tableNames as $tableName) {
         if (in_array($tableName, $this->_tableNames)) {
             continue;
         }
         $this->_tableNames[] = $tableName;
     }
     $this->_saveTableNamesCache();
 }