/** * Execute query and return resource. * @param $sql * @param array $params * @return bool|mysqli_result|resource|PDOStatement * @throws Exception */ public function query($sql, $params = array()) { if (self::$logSQLs) { $this->log($sql); } if (self::$loggingEnabled) { self::$queryCounter++; } if (!empty($params)) { $sql = LudoDBSql::fromPrepared($sql, $params); } $res = mysql_query($sql) or die(mysql_error() . "\nSQL:" . $sql); return $res; }
/** * Execute query and return resource. * @param $sql * @param array $params * @return bool|mysqli_result * @throws Exception */ public function query($sql, $params = array()) { if (self::$logSQLs) { $this->log($sql); } if (self::$loggingEnabled) { self::$queryCounter++; } if (!empty($params)) { $sql = LudoDBSql::fromPrepared($sql, $params); } if ($res = self::$conn->query($sql)) { return $res; } throw new Exception("SQL ERROR: " . self::$conn->error . "(" . $sql . ")"); }
public function getSQLCreate() { $sql = $this->sqlHandler()->getCreateTableSql(); $params = $this->parser->getDefaultValues(); if (!empty($params)) { $sql = LudoDBSql::fromPrepared($sql, $params); } return $sql; }