reverseTableSchema() public method

public reverseTableSchema ( $table, $referenceSchema = null )
示例#1
0
 public function testGetTables()
 {
     $manager = ConnectionManager::getInstance();
     $conn = $manager->getConnection('mysql');
     $driver = $manager->getQueryDriver('mysql');
     $conn->query("DROP TABLE IF EXISTS t1");
     $conn->query("CREATE TABLE t1 (val enum('a','b','c') );");
     $parser = new MysqlTableParser($driver, $conn);
     $tables = $parser->getTables();
     $this->assertNotEmpty($tables);
     $schema = $parser->reverseTableSchema('t1');
     $this->assertNotNull($schema);
     /*
             $sql = $parser->getTableSql('foo');
             ok($sql);
     
             $columns = $parser->parseTableSql('foo');
             $this->assertNotEmpty($columns);
     
             $columns = $parser->parseTableSql('bar');
             $this->assertNotEmpty($columns);
     
             $schema = $parser->reverseTableSchema('bar');
             $this->assertNotNull($schema);
     
             $id = $schema->getColumn('id');
             $this->assertNotNull($id);
             $this->assertTrue($id->autoIncrement);
             $this->assertEquals('INTEGER',$id->type);
             $this->assertEquals('int',$id->isa);
             $this->assertTrue($id->primary);
     */
 }
 public function testGetTables()
 {
     $this->conn->query("DROP TABLE IF EXISTS t1");
     $this->conn->query("CREATE TABLE t1 (val enum('a','b','c') );");
     $parser = new MysqlTableParser($this->conn, $this->queryDriver);
     $tables = $parser->getTables();
     $this->assertNotEmpty($tables);
     $schema = $parser->reverseTableSchema('t1');
     $this->assertNotNull($schema);
 }