46 $this->conn = mysqli_init();
49 $this->logger->addQuery(
'', $this->
error(), $this->
errno());
53 if (XOOPS_DB_PCONNECT == 1 && PHP_VERSION_ID >= 50300 ) {
54 mysqli_real_connect($this->conn,
'p:'.XOOPS_DB_HOST, XOOPS_DB_USER, XOOPS_DB_PASS,
null,
null,
null, MYSQLI_CLIENT_FOUND_ROWS);
56 mysqli_real_connect($this->conn, XOOPS_DB_HOST, XOOPS_DB_USER, XOOPS_DB_PASS,
null,
null,
null, MYSQLI_CLIENT_FOUND_ROWS);
59 if (
false != $selectdb) {
60 if (!mysqli_select_db($this->conn, XOOPS_DB_NAME)) {
61 $this->logger->addQuery(
'', $this->
error(), $this->
errno());
67 if (version_compare(mysqli_get_server_info($this->conn),
'5.6',
'>=')) {
68 mysqli_query($this->conn,
'SET SESSION sql_mode = \'\'');
213 public function &
queryF($sql, $limit=0, $start=0)
215 if (!empty($limit)) {
217 $sql .=
' LIMIT ' . (int)$limit;
219 $sql = $sql.
' LIMIT '.(int)$start.
', '.(
int)$limit;
222 $result = mysqli_query($this->conn, $sql);
225 $this->logger->addQuery($sql);
228 $this->logger->addQuery($sql, $this->
error(), $this->
errno());
259 if (
false !== ($fp = fopen($file,
'r'))) {
260 include_once XOOPS_ROOT_PATH.
'/class/database/sqlutility.php';
261 $sql_queries = trim(fread($fp, filesize($file)));
262 SqlUtility::splitMySqlFile($pieces, $sql_queries);
263 foreach ($pieces as $query) {
266 $prefixed_query = SqlUtility::prefixQuery(trim($query), $this->prefix());
267 if (
false != $prefixed_query) {
268 $this->
query($prefixed_query[0]);
338 while (
false !== ($pos=strpos($query,
'?'))) {
339 $pre=substr($query, 0, $pos);
341 if ($pos+1<=strlen($query)) {
342 $after=substr($query, $pos+1);
345 $query=$pre.
'{'.$count.
'}'.$after;
348 $this->mPrepareQuery=$query;
357 if (func_num_args()<2) {
361 $types=func_get_arg(0);
362 $count=strlen($types);
363 if (func_num_args()<$count) {
369 for ($i=0;$i<$count;$i++) {
370 $searches[$i]=
'{'.$i.
'}';
371 switch (substr($types, $i, 1)) {
373 $replaces[$i]=(int)func_get_arg($i+1);
377 $replaces[$i]=$this->
quoteString(func_get_arg($i+1));
381 $replaces[$i]= (float)func_get_arg($i + 1);
390 $this->mPrepareQuery=str_replace($searches, $replaces, $this->mPrepareQuery);