public function tableDefinition($table_name,$which_connection='')
    {
        if ($which_connection == '') {
            $which_connection=$this->default_db;
        }

        /**
          Check whether the definition is in cache
        */
        if (isset($this->structure_cache[$which_connection]) && isset($this->structure_cache[$which_connection][$table_name])) {
            return $this->structure_cache[$which_connection][$table_name];
        }

        $conn = $this->connections[$which_connection];
        $cols = $conn->MetaColumns($table_name);

        if (is_array($cols)) {
            $return = array_reduce($cols,
                function ($carry, $c) {
                    if (is_object($c)) {
                        $carry[$c->name] = $c->type;
                    }
                    return $carry;
                },
                array()
            );
            return $return;
        }

        return false;
    }
public function tableDefinition($table_name,$which_connection='')
    {
        if ($which_connection == '') {
            $which_connection=$this->default_db;
        }

        /**
          Check whether the definition is in cache
        */
        if (isset($this->structure_cache[$which_connection]) && isset($this->structure_cache[$which_connection][$table_name])) {
            return $this->structure_cache[$which_connection][$table_name];
        }

        $conn = $this->connections[$which_connection];
        $cols = $conn->MetaColumns($table_name);

        if (is_array($cols)) {
            $return = array_reduce($cols,
                function ($carry, $c) {
                    if (is_object($c)) {
                        $carry[$c->name] = $c->type;
                    }
                    return $carry;
                },
                array()
            );
            return $return;
        }

        return false;
    }
public function tableDefinition ( $ table_name , $ which_connection = '' ) { if ( $ which_connection == '' ) { $ which_connection = $ this -> default_db ; } /**
          Check whether the definition is in cache
        */ if ( isset ( $ this -> structure_cache [ $ which_connection ] ) && isset ( $ this -> structure_cache [ $ which_connection ] [ $ table_name ] ) ) { return $ this -> structure_cache [ $ which_connection ] [ $ table_name ] ; } $ conn = $ this -> connections [ $ which_connection ] ; $ cols = $ conn -> MetaColumns ( $ table_name ) ; if ( is_array ( $ cols ) ) { $ return = array_reduce ( $ cols , function ( $ carry , $ c ) { if ( is_object ( $ c ) ) { $ carry [ $ c -> name ] = $ c -> type ; } return $ carry ; } , array ( ) ) ; return $ return ; } return false ; }
Get the table's definition
@param $table_name The table's name
@param which_connection see method close
@return
- Array of (column name, column type) table found
- False No such table
- -1 Operation not supported for this database type
Get the table s definition