public function getColumnsFromInformationSchema() { $table = new static("information_schema.COLUMNS", $this->params); $select = new Select($table, $this->params); $select->fields(array("DATA_TYPE AS type", "CHARACTER_MAXIMUM_LENGTH AS maxLen", "COLUMN_NAME AS name", "COLUMN_TYPE AS extType", "COLUMN_DEFAULT AS defaultValue", "IS_NULLABLE AS nullable")); $where = array(array("field" => "TABLE_SCHEMA", "value" => $this->schema), array("operator" => "AND"), array("field" => "TABLE_NAME", "value" => $this->name)); $select->where($where); $res = $select->execute(NULL, $smartMode = FALSE); if (is_null($res)) { $msg = "Can't fetch columns for table " . $this->name . " on schema `" . $this->schema . '`, wrong connection, database or a temporary table?.' . 'you might want to try specifying fields in your query so they\'re not ' . 'gathered dynamically through information_schema'; throw new \Exception($msg); } return $res; }
public function __construct(\apf\db\mysql5\Select $select, $map = NULL) { $this->select = $select; $this->result = $select->getQueryResult(); $this->map = $map; }