private function describeTable($name, $schema)
    {
        $data = $this->connector->getQueryAsSingleRow(
                'SELECT t.table_schema AS table_schema, t.table_name AS table_name, t.engine AS engine,
                        t.auto_increment AS auto_increment, t.table_collation AS table_collation,
                        t.table_comment AS table_comment, cs.character_set_name AS table_charset,
                        t.create_options AS create_options
                   FROM information_schema.tables t, information_schema.character_sets cs
                  WHERE t.table_schema=\'%schema$s\'
                    AND t.table_name = \'%table$s\'
                    AND t.table_collation = cs.default_collate_name',
                array(
                    'schema' => $schema,
                    'table' => $name
                )
        );

        if (is_array($data)) {
            $fields = $this->describeTableFields($name, $schema);
            $table['schema'] = $data['table_schema'];
            $table['name'] = $data['table_name'];
            $table['engine'] = $data['engine'];
            $table['type'] = CMySQLConnector::TYPE_TABLE;
            $table['autoincrement'] = $this->validateAutoIncrement($data['auto_increment'], $fields);
            $table['charset'] = $data['table_charset'];
            $table['collation'] = $data['table_collation'];
            $table['create_options'] = $data['create_options'];
            $table['comment'] = $data['table_comment'];
            $table['fields'] = $fields;
            $table['constraints'] = $this->describeTableConstraints($name, $table['fields'], $schema);
            $descriptor = new CMySQLDescriptor($this->connector, $table);
        } else {
            $descriptor = null;
        }

        return $descriptor;
    }
private function describeTable($name, $schema)
    {
        $data = $this->connector->getQueryAsSingleRow(
                'SELECT t.table_schema AS table_schema, t.table_name AS table_name, t.engine AS engine,
                        t.auto_increment AS auto_increment, t.table_collation AS table_collation,
                        t.table_comment AS table_comment, cs.character_set_name AS table_charset,
                        t.create_options AS create_options
                   FROM information_schema.tables t, information_schema.character_sets cs
                  WHERE t.table_schema=\'%schema$s\'
                    AND t.table_name = \'%table$s\'
                    AND t.table_collation = cs.default_collate_name',
                array(
                    'schema' => $schema,
                    'table' => $name
                )
        );

        if (is_array($data)) {
            $fields = $this->describeTableFields($name, $schema);
            $table['schema'] = $data['table_schema'];
            $table['name'] = $data['table_name'];
            $table['engine'] = $data['engine'];
            $table['type'] = CMySQLConnector::TYPE_TABLE;
            $table['autoincrement'] = $this->validateAutoIncrement($data['auto_increment'], $fields);
            $table['charset'] = $data['table_charset'];
            $table['collation'] = $data['table_collation'];
            $table['create_options'] = $data['create_options'];
            $table['comment'] = $data['table_comment'];
            $table['fields'] = $fields;
            $table['constraints'] = $this->describeTableConstraints($name, $table['fields'], $schema);
            $descriptor = new CMySQLDescriptor($this->connector, $table);
        } else {
            $descriptor = null;
        }

        return $descriptor;
    }
private function describeTable ( $ name , $ schema ) { $ data = $ this -> connector -> getQueryAsSingleRow ( 'SELECT t.table_schema AS table_schema, t.table_name AS table_name, t.engine AS engine,
                        t.auto_increment AS auto_increment, t.table_collation AS table_collation,
                        t.table_comment AS table_comment, cs.character_set_name AS table_charset,
                        t.create_options AS create_options
                   FROM information_schema.tables t, information_schema.character_sets cs
                  WHERE t.table_schema=\'%schema$s\'
                    AND t.table_name = \'%table$s\'
                    AND t.table_collation = cs.default_collate_name' , array ( 'schema' => $ schema , 'table' => $ name ) ) ; if ( is_array ( $ data ) ) { $ fields = $ this -> describeTableFields ( $ name , $ schema ) ; $ table [ 'schema' ] = $ data [ 'table_schema' ] ; $ table [ 'name' ] = $ data [ 'table_name' ] ; $ table [ 'engine' ] = $ data [ 'engine' ] ; $ table [ 'type' ] = CMySQLConnector :: TYPE_TABLE ; $ table [ 'autoincrement' ] = $ this -> validateAutoIncrement ( $ data [ 'auto_increment' ] , $ fields ) ; $ table [ 'charset' ] = $ data [ 'table_charset' ] ; $ table [ 'collation' ] = $ data [ 'table_collation' ] ; $ table [ 'create_options' ] = $ data [ 'create_options' ] ; $ table [ 'comment' ] = $ data [ 'table_comment' ] ; $ table [ 'fields' ] = $ fields ; $ table [ 'constraints' ] = $ this -> describeTableConstraints ( $ name , $ table [ 'fields' ] , $ schema ) ; $ descriptor = new CMySQLDescriptor ( $ this -> connector , $ table ) ; } else { $ descriptor = null ; } return $ descriptor ; }
Creates the descriptor from an existent MySQL table.
@param string $name Table name.
@param string $schema Table schema.
@return CMySQLDescriptor Returns a descriptor instance or null if no descriptor available.
Creates the descriptor from an existent MySQL table .