private function GetBasicFieldInfo($table, $field, &$fullName, &$defaultValue, &$isPrimary, &$isUnique, &$isNullable)
    {
        $sql = new Sql\Builder($this);
        $tbl = $sql->Table('information_schema.columns', array('TABLE_SCHEMA', 'TABLE_NAME', 'COLUMN_NAME', 'COLUMN_DEFAULT', 'IS_NULLABLE', 'COLUMN_TYPE', 'COLUMN_KEY'));

        $cond = $sql->Equals($tbl->Field('TABLE_SCHEMA'), $sql->Value($this->dbName))
                ->And_($sql->Equals($tbl->Field('TABLE_NAME'), $sql->Value($table)))
                ->And_($sql->Equals($tbl->Field('COLUMN_NAME'), $sql->Value($field)));

        $what = $sql->SelectList($tbl->Field('IS_NULLABLE'));
        $what->Add($tbl->Field('COLUMN_TYPE'));
        $what->Add($tbl->Field('COLUMN_KEY'));
        $what->Add($tbl->Field('COLUMN_DEFAULT'));

        $sel = $sql->Select(true, $what, $tbl, $cond);
        $reader = $this->ExecuteQuery((string) $sel);
        if ($reader->Read())
        {
            $fullName = $reader->ByName('COLUMN_TYPE');
            $defaultValue = $reader->ByName('COLUMN_DEFAULT');
            $key = $reader->ByName('COLUMN_KEY');
            $isUnique = ($key == 'UNI');
            $isPrimary = ($key == 'PRI');
            $isNullable = $reader->ByName('IS_NULLABLE') == 'YES';
            return true;
        }
        return false;
    }
private function GetBasicFieldInfo($table, $field, &$fullName, &$defaultValue, &$isPrimary, &$isUnique, &$isNullable)
    {
        $sql = new Sql\Builder($this);
        $tbl = $sql->Table('information_schema.columns', array('TABLE_SCHEMA', 'TABLE_NAME', 'COLUMN_NAME', 'COLUMN_DEFAULT', 'IS_NULLABLE', 'COLUMN_TYPE', 'COLUMN_KEY'));

        $cond = $sql->Equals($tbl->Field('TABLE_SCHEMA'), $sql->Value($this->dbName))
                ->And_($sql->Equals($tbl->Field('TABLE_NAME'), $sql->Value($table)))
                ->And_($sql->Equals($tbl->Field('COLUMN_NAME'), $sql->Value($field)));

        $what = $sql->SelectList($tbl->Field('IS_NULLABLE'));
        $what->Add($tbl->Field('COLUMN_TYPE'));
        $what->Add($tbl->Field('COLUMN_KEY'));
        $what->Add($tbl->Field('COLUMN_DEFAULT'));

        $sel = $sql->Select(true, $what, $tbl, $cond);
        $reader = $this->ExecuteQuery((string) $sel);
        if ($reader->Read())
        {
            $fullName = $reader->ByName('COLUMN_TYPE');
            $defaultValue = $reader->ByName('COLUMN_DEFAULT');
            $key = $reader->ByName('COLUMN_KEY');
            $isUnique = ($key == 'UNI');
            $isPrimary = ($key == 'PRI');
            $isNullable = $reader->ByName('IS_NULLABLE') == 'YES';
            return true;
        }
        return false;
    }
private function GetBasicFieldInfo ( $ table , $ field , & $ fullName , & $ defaultValue , & $ isPrimary , & $ isUnique , & $ isNullable ) { $ sql = new Sql \ Builder ( $ this ) ; $ tbl = $ sql -> Table ( 'information_schema.columns' , array ( 'TABLE_SCHEMA' , 'TABLE_NAME' , 'COLUMN_NAME' , 'COLUMN_DEFAULT' , 'IS_NULLABLE' , 'COLUMN_TYPE' , 'COLUMN_KEY' ) ) ; $ cond = $ sql -> Equals ( $ tbl -> Field ( 'TABLE_SCHEMA' ) , $ sql -> Value ( $ this -> dbName ) ) -> And_ ( $ sql -> Equals ( $ tbl -> Field ( 'TABLE_NAME' ) , $ sql -> Value ( $ table ) ) ) -> And_ ( $ sql -> Equals ( $ tbl -> Field ( 'COLUMN_NAME' ) , $ sql -> Value ( $ field ) ) ) ; $ what = $ sql -> SelectList ( $ tbl -> Field ( 'IS_NULLABLE' ) ) ; $ what -> Add ( $ tbl -> Field ( 'COLUMN_TYPE' ) ) ; $ what -> Add ( $ tbl -> Field ( 'COLUMN_KEY' ) ) ; $ what -> Add ( $ tbl -> Field ( 'COLUMN_DEFAULT' ) ) ; $ sel = $ sql -> Select ( true , $ what , $ tbl , $ cond ) ; $ reader = $ this -> ExecuteQuery ( ( string ) $ sel ) ; if ( $ reader -> Read ( ) ) { $ fullName = $ reader -> ByName ( 'COLUMN_TYPE' ) ; $ defaultValue = $ reader -> ByName ( 'COLUMN_DEFAULT' ) ; $ key = $ reader -> ByName ( 'COLUMN_KEY' ) ; $ isUnique = ( $ key == 'UNI' ) ; $ isPrimary = ( $ key == 'PRI' ) ; $ isNullable = $ reader -> ByName ( 'IS_NULLABLE' ) == 'YES' ; return true ; } return false ; }
Gets basic field info from the information_schema database
@param string $table The table name as input parameter
@param string &$field The field name as input parameter
@param string &$fullName The full name as output paramter
@param string &$defaultValue The default value as output paramter
@param boolean &$isPrimary The "is primary field" flag as output parameter
@param boolean &$isUnique The "is unique field" flag as output parameter
@param boolean &$isNullable The "is nullable field" flag as output parameter
@return boolean Returns true if field info could be determined
Gets basic field info from the information_schema database