49 if (XOOPS_DB_PCONNECT == 1) {
50 $this->conn = @mysql_pconnect(XOOPS_DB_HOST, XOOPS_DB_USER, XOOPS_DB_PASS, MYSQL_CLIENT_FOUND_ROWS);
52 $this->conn = @mysql_connect(XOOPS_DB_HOST, XOOPS_DB_USER, XOOPS_DB_PASS,
false, MYSQL_CLIENT_FOUND_ROWS);
56 $this->logger->addQuery(
'', $this->
error(), $this->
errno());
60 if (
false != $selectdb) {
61 if (!mysql_select_db(XOOPS_DB_NAME)) {
62 $this->logger->addQuery(
'', $this->
error(), $this->
errno());
68 if (version_compare(mysql_get_server_info($this->conn),
'5.6',
'>=')) {
69 mysql_query(
'SET SESSION sql_mode = \'\'', $this->conn);
214 public function &
queryF($sql, $limit=0, $start=0)
216 if (!empty($limit)) {
218 $sql .=
' LIMIT ' . (int)$limit;
220 $sql = $sql.
' LIMIT '.(int)$start.
', '.(
int)$limit;
223 $result = mysql_query($sql, $this->conn);
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]);
319 while (
false !== ($pos=strpos($query,
'?'))) {
320 $pre=substr($query, 0, $pos);
322 if ($pos+1<=strlen($query)) {
323 $after=substr($query, $pos+1);
326 $query=$pre.
'{'.$count.
'}'.$after;
329 $this->mPrepareQuery=$query;
338 if (func_num_args()<2) {
342 $types=func_get_arg(0);
343 $count=strlen($types);
344 if (func_num_args()<$count) {
350 for ($i=0;$i<$count;$i++) {
351 $searches[$i]=
'{'.$i.
'}';
352 switch (substr($types, $i, 1)) {
354 $replaces[$i]=(int)func_get_arg($i+1);
358 $replaces[$i]=$this->
quoteString(func_get_arg($i+1));
362 $replaces[$i]=floatval(func_get_arg($i + 1));
371 $this->mPrepareQuery=str_replace($searches, $replaces, $this->mPrepareQuery);