public function createIfNeeded($db_name)
    {
        $this->fq_name = $db_name . $this->connection->sep() . $this->name;
        $ret = array('db'=>$db_name,'struct'=>$this->name,'error'=>0,'error_msg'=>'');
        $exists = $this->connection->tableExists($this->fq_name);
        if (!$exists && !$this->create()) {
            $ret['error'] = 1;
            $ret['error_msg'] = $this->connection->error($db_name);
            $reflect = new \ReflectionClass($this);
            $ret['query'] = $reflect->getName() . '::create()';
        }

        return $ret;
    }
public function createIfNeeded($db_name)
    {
        $this->fq_name = $db_name . $this->connection->sep() . $this->name;
        $ret = array('db'=>$db_name,'struct'=>$this->name,'error'=>0,'error_msg'=>'');
        $exists = $this->connection->tableExists($this->fq_name);
        if (!$exists && !$this->create()) {
            $ret['error'] = 1;
            $ret['error_msg'] = $this->connection->error($db_name);
            $reflect = new \ReflectionClass($this);
            $ret['query'] = $reflect->getName() . '::create()';
        }

        return $ret;
    }
public function createIfNeeded ( $ db_name ) { $ this -> fq_name = $ db_name . $ this -> connection -> sep ( ) . $ this -> name ; $ ret = array ( 'db' => $ db_name , 'struct' => $ this -> name , 'error' => 0 , 'error_msg' => '' ) ; $ exists = $ this -> connection -> tableExists ( $ this -> fq_name ) ; if ( ! $ exists && ! $ this -> create ( ) ) { $ ret [ 'error' ] = 1 ; $ ret [ 'error_msg' ] = $ this -> connection -> error ( $ db_name ) ; $ reflect = new \ ReflectionClass ( $ this ) ; $ ret [ 'query' ] = $ reflect -> getName ( ) . '::create()' ; } return $ ret ; }
Create structure only if it does not exist
@param $db_name [string] database name
@return [keyed array]
db => database name
struct => table/view name
error => [int] error code
error_msg => error details
Create structure only if it does not exist