function __construct($res, Query $obQuery) { $this->result = $res; $this->table_map = $obQuery->getTableMap(); $this->query_type = $obQuery->getType(); $this->arFieldsEntity = $obQuery->getFieldsEntity(); $this->sql = $obQuery->getQueryBuildParts(); if ($res) { if ($this->query_type == "select") { $this->mysql_num_fields = mysql_num_fields($res); $this->mysql_num_rows = mysql_num_rows($res); } } }
public function query(Query $obQuery) { $sql = $obQuery->getQueryBuildParts(); $db_res = mysql_query($sql, $this->db_conn); $res = new DBResult($db_res, $obQuery); $res->setAffectedRows(mysql_affected_rows($this->db_conn)); if ($obQuery->getType() == "insert") { $res->setInsertId(mysql_insert_id($this->db_conn)); } if (!$res->getResult()) { $res->setResultErrorNumber(mysql_errno($this->db_conn)); $res->setResultErrorText(mysql_error($this->db_conn)); } return $res; }