Пример #1
1
 protected function copyAll(Driver $src, Driver $dst)
 {
     foreach ($src->getDatabaseNames() as $db) {
         if ($db != 'test') {
             continue;
         }
         $dst->createDatabase($db);
         foreach ($src->getSchemaNames($db) as $schema) {
             $dst->createSchema($db, $schema);
             foreach ($src->getTableNames($db, $schema) as $table) {
                 $dst->setTable($db, $schema, $src->getTable($db, $schema, $table));
             }
         }
     }
 }
Пример #2
0
 public function testCreate()
 {
     $drv = new MySQLDriver(['pdo' => $this->getPDOPassthrough(null, 1)]);
     $this->assertTrue($drv->createDatabase('ignored'));
     $this->assertTrue($drv->createSchema('ignored', 'ignored'));
     $drv = new MySQLDriver(['pdo' => $this->getPDOPassthrough(null, false)]);
     $this->assertFalse($drv->createDatabase('ignored'));
     $this->assertFalse($drv->createSchema('ignored', 'ignored'));
     $drv = new MySQLDriver(['pdo' => $this->getPDOPassthrough(null, new PDOException())]);
     $this->assertFalse($drv->createDatabase('ignored'));
     $this->assertFalse($drv->createSchema('ignored', 'ignored'));
 }