当前位置: 首页>>代码示例>>PHP>>正文


PHP mysql_unbuffered_query函数代码示例

本文整理汇总了PHP中mysql_unbuffered_query函数的典型用法代码示例。如果您正苦于以下问题:PHP mysql_unbuffered_query函数的具体用法?PHP mysql_unbuffered_query怎么用?PHP mysql_unbuffered_query使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了mysql_unbuffered_query函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: doQuery

 /**
  * @param $sql string
  * @return true|false|resource
  *
  * For SELECT, SHOW, DESCRIBE, EXPLAIN and other statements returning resultset, mysql_query() returns a resource on success, or FALSE on error.
  * For other type of SQL statements, INSERT, UPDATE, DELETE, DROP, etc, mysql_query() returns TRUE on success or FALSE on error.
  */
 protected function doQuery($sql)
 {
     $this->installErrorHandler();
     if ($this->bufferResults()) {
         $ret = mysql_query($sql, $this->mConn);
     } else {
         $ret = mysql_unbuffered_query($sql, $this->mConn);
     }
     $phpError = $this->restoreErrorHandler();
     if ($ret === false) {
         global $wgDBname;
         $error = $this->lastError();
         if (!$error) {
             $error = $phpError;
         }
         $err_num = $this->lastErrno();
         error_log(sprintf("SQL (%s): %d: %s", $wgDBname, $err_num, $error));
         error_log("SQL: invalid query: {$sql}");
         # Wikia change - begin
         switch ($err_num) {
             case 1213:
                 /* deadlock*/
                 error_log("MOLI: deadlock: {$error} ");
                 Wikia::debugBacktrace("MOLI: Deadlock:");
                 break;
             case 2006:
                 /* server has gone away */
                 error_log("MOLI: gone away: {$error} ");
                 Wikia::debugBacktrace("MOLI: gone away:");
                 break;
         }
         # Wikia change - end
     }
     return $ret;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:42,代码来源:DatabaseMysql.php

示例2: sl_db

 function sl_db()
 {
     if (!@mysql_select_db($this->db, $this->link)) {
         err('数据库' . $this->db . '不存在', "javascript:history.go(-1);");
     }
     @mysql_unbuffered_query("set names {$this->db_charset}");
 }
开发者ID:BGCX261,项目名称:zhuoao-svn-to-git,代码行数:7,代码来源:mysql.class.php

示例3: doQuery

 /**
  * @param $sql string
  * @return resource
  */
 protected function doQuery($sql)
 {
     $this->installErrorHandler();
     if ($this->bufferResults()) {
         $ret = mysql_query($sql, $this->mConn);
     } else {
         $ret = mysql_unbuffered_query($sql, $this->mConn);
     }
     $phpError = $this->restoreErrorHandler();
     if ($ret === false) {
         global $wgDBname;
         $error = $this->lastError();
         if (!$error) {
             $error = $phpError;
         }
         $err_num = $this->lastErrno();
         error_log(sprintf("SQL (%s): %d: %s", $wgDBname, $err_num, $error));
         error_log("SQL: invalid query: {$sql}");
         if ($err_num == 1213) {
             /* deadlock*/
             error_log("MOLI: deadlock: {$error} ");
             Wikia::debugBacktrace("MOLI: Deadlock:");
         }
     }
     return $ret;
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:30,代码来源:DatabaseMysql.php

示例4: query

 function query($sql, $unbuffered = false)
 {
     if (defined('PUN_SHOW_QUERIES')) {
         $q_start = get_microtime();
     }
     if ($unbuffered) {
         $this->query_result = @mysql_unbuffered_query($sql, $this->link_id);
     } else {
         $this->query_result = @mysql_query($sql, $this->link_id);
     }
     if ($this->query_result) {
         if (defined('PUN_SHOW_QUERIES')) {
             $this->saved_queries[] = array($sql, sprintf('%.5f', get_microtime() - $q_start));
         }
         ++$this->num_queries;
         return $this->query_result;
     } else {
         if (defined('PUN_SHOW_QUERIES')) {
             $this->saved_queries[] = array($sql, 0);
         }
         $this->error_no = @mysql_errno($this->link_id);
         $this->error_msg = @mysql_error($this->link_id);
         return false;
     }
 }
开发者ID:highpictv,项目名称:forum,代码行数:25,代码来源:mysql.php

示例5: run

 /**
  * Standard modular run function.
  *
  * @return tempcode	Results
  */
 function run()
 {
     $out = new ocp_tempcode();
     $tables = $GLOBALS['SITE_DB']->query_select('db_meta', array('DISTINCT m_table'));
     if (count($GLOBALS['SITE_DB']->connection_write) > 4) {
         $GLOBALS['SITE_DB']->connection_write = call_user_func_array(array($GLOBALS['SITE_DB']->static_ob, 'db_get_connection'), $GLOBALS['SITE_DB']->connection_write);
         _general_db_init();
     }
     list($db, $db_name) = $GLOBALS['SITE_DB']->connection_write;
     mysql_select_db($db_name, $db);
     foreach ($tables as $table) {
         if ($table['m_table'] == 'sessions') {
             continue;
         }
         // HEAP, so can't be repaired
         $table = get_table_prefix() . $table['m_table'];
         // Check/Repair
         $result = mysql_query('CHECK TABLE ' . $table . ' FAST', $db);
         echo mysql_error($db);
         mysql_data_seek($result, mysql_num_rows($result) - 1);
         $status_row = mysql_fetch_assoc($result);
         if ($status_row['Msg_type'] != 'status') {
             $out->attach(paragraph(do_lang_tempcode('TABLE_ERROR', escape_html($table), escape_html($status_row['Msg_type']), array(escape_html($status_row['Msg_text']))), 'dfsdgdsgfgd'));
             $result2 = mysql_query('REPAIR TABLE ' . $table, $db);
             mysql_data_seek($result2, mysql_num_rows($result2) - 1);
             $status_row_2 = mysql_fetch_assoc($result2);
             $out->attach(paragraph(do_lang_tempcode('TABLE_FIXED', escape_html($table), escape_html($status_row_2['Msg_type']), array(escape_html($status_row_2['Msg_text']))), 'dfsdfgdst4'));
         }
         // Optimise
         mysql_unbuffered_query('OPTIMIZE TABLE ' . $table, $db);
     }
     return $out;
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:38,代码来源:mysql.php

示例6: query

 function query($sql, $unbuffered = false)
 {
     if (strlen($sql) > FORUM_DATABASE_QUERY_MAXIMUM_LENGTH) {
         exit('Insane query. Aborting.');
     }
     if (defined('FORUM_SHOW_QUERIES') || defined('FORUM_DEBUG')) {
         $q_start = forum_microtime();
     }
     if ($unbuffered) {
         $this->query_result = @mysql_unbuffered_query($sql, $this->link_id);
     } else {
         $this->query_result = @mysql_query($sql, $this->link_id);
     }
     if ($this->query_result) {
         if (defined('FORUM_SHOW_QUERIES') || defined('FORUM_DEBUG')) {
             $this->saved_queries[] = array($sql, sprintf('%.5f', forum_microtime() - $q_start));
         }
         ++$this->num_queries;
         return $this->query_result;
     } else {
         if (defined('FORUM_SHOW_QUERIES') || defined('FORUM_DEBUG')) {
             $this->saved_queries[] = array($sql, 0);
         }
         return false;
     }
 }
开发者ID:ZerGabriel,项目名称:punbb,代码行数:26,代码来源:mysql.php

示例7: select

 function select($query, $class = 'recordset')
 {
     if (!$this->con_id) {
         return false;
     }
     if ($class == '' || !class_exists($class)) {
         $class = 'recordset';
     }
     $cur = mysql_unbuffered_query($query, $this->con_id);
     if ($cur) {
         # Insertion dans le reccordset
         $i = 0;
         $arryRes = array();
         while ($res = mysql_fetch_row($cur)) {
             for ($j = 0; $j < count($res); $j++) {
                 $arryRes[$i][strtolower(mysql_field_name($cur, $j))] = $res[$j];
             }
             $i++;
         }
         return new $class($arryRes);
     } else {
         $this->setError();
         return false;
     }
 }
开发者ID:nagaexe,项目名称:PHP-Naive-Bayesian-Filter,代码行数:25,代码来源:class.mysql.php

示例8: importar_ctw

function importar_ctw($db = "ctw10005.dbf", $id = "2007")
{
    //elimina la anterior
    mysql_unbuffered_query("TRUNCATE compacw_importados");
    $pathdbase = CTW_PATH . "/" . $db;
    //$db = dbase_open($ipdbase . $dirdbase . $nombredb . $db, 0);
    $rs = dbase_open($pathdbase, 2);
    //echo $pathdbase;
    $num_rows = dbase_numrecords($rs);
    //$o_num_rows = dbase_numrecords ($rs);
    //$num_rows = 100000;				//Eliminar la Consulta a 50000
    for ($i = 1; $i <= $num_rows; $i++) {
        $field = dbase_get_record_with_names($rs, $i);
        if (trim($field["EJE"]) == $id and trim($field["TIPO"]) == 1) {
            //
            $values_sql = " ('" . $field["CUENTA"] . "', " . $field["IMP1"] . ") ";
            $sql_ex = "INSERT INTO compacw_importados(cuenta, saldo) VALUES " . $values_sql;
            mysql_unbuffered_query($sql_ex);
            //
        }
    }
    //
    //dbase_pack($rs);
    dbase_close($rs);
    echo "<p>DATOS IMPORTADOS:  " . date("H:i:s") . " HRS </p>";
}
开发者ID:Cywaithaka,项目名称:S.A.F.E.-Open-Source-Microfinance-Suite,代码行数:26,代码来源:dbase.inc.php

示例9: QuerySql

function QuerySql($match_way, $query_way, $search_text, $Fields)
{
    $result = NULL;
    $row = NULL;
    switch ($match_way) {
        case '1':
            $match_way_sql = "= '" . $search_text . "';";
            break;
        case '2':
            $match_way_sql = " LIKE '%" . $search_text . "%';";
            break;
    }
    $getID = array();
    $flag = 0;
    foreach ($Fields as $value) {
        $q = "SELECT id FROM" . " `" . $query_way . "` " . "WHERE" . " `" . $Fields[$flag] . "`" . $match_way_sql;
        //echo $q."<br/>";
        $result = mysql_unbuffered_query($q);
        while ($row = mysql_fetch_row($result)) {
            $str .= $row[0] . ",";
        }
        //echo $str."<br/>";
        //echo "---".$flag."---";
        $flag++;
    }
    $str = substr($str, 0, strlen($str) - 1);
    $sql = "SELECT * from " . $query_way . " where id in (" . $str . ");";
    return $sql;
}
开发者ID:Mr9esx,项目名称:ASWQL,代码行数:29,代码来源:func.php

示例10: cs_sql_connect

function cs_sql_connect($cs_db, $test = 0)
{
    $error = '';
    if (!extension_loaded('mysql')) {
        $error = 'PHP extension mysql must be activated!';
    } else {
        $connect = mysql_connect($cs_db['place'], $cs_db['user'], $cs_db['pwd']) or $error = mysql_error();
    }
    if (empty($error)) {
        mysql_select_db($cs_db['name']) or $error = mysql_error($connect);
    }
    global $cs_main;
    $sql_charset = strtolower($cs_main['charset']);
    if (empty($error) and $sql_charset == 'utf-8') {
        # since php 5.2.3 - depends on mysql libs, too
        if (function_exists('mysql_set_charset')) {
            mysql_set_charset('utf8', $connect);
        } else {
            mysql_unbuffered_query("SET NAMES 'utf8'", $connect) or $error = mysql_error();
        }
    }
    if (empty($test) and empty($error)) {
        return $connect;
    } elseif (empty($test)) {
        cs_error_sql(__FILE__, 'cs_sql_connect', $error, 1);
    } else {
        return $error;
    }
}
开发者ID:aberrios,项目名称:WEBTHESGO,代码行数:29,代码来源:mysql.php

示例11: query

 function query($query, $bypass_error = FALSE, $unbufferd = false)
 {
     $this->querytime = get_microtime();
     $this->query_result = $unbufferd ? mysql_unbuffered_query($query, $this->connect_id) : mysql_query($query, $this->connect_id);
     if ($this->query_result) {
         return $this->query_result;
     } else {
         if ((mysql_errno() == 1030 && strpos(mysql_error(), '127') || mysql_errno() == 1034 || mysql_errno() == 1035) && preg_match('#(INTO|FROM)\\s+([a-z_]+)#i', $query, $match) && mysql_query('REPAIR TABLE ' . $match[2], $this->connect_id)) {
             $this->query_result = $unbufferd ? mysql_unbuffered_query($query, $this->connect_id) : mysql_query($query, $this->connect_id);
             if ($this->query_result) {
                 return $this->query_result;
             }
         } else {
             if (mysql_errno() == 1062 && preg_match('#ALTER\\s+TABLE\\s+([a-z_]+)\\s+ADD\\s+PRIMARY\\s+KEY\\s+\\(([a-z_]+)\\)#i', $query, $table) && preg_match("#Duplicate\\s+entry\\s+'(.*)'\\s+for\\s+key#i", mysql_error(), $entry) && mysql_query("DELETE FROM {$table['1']} WHERE {$table['2']} LIKE '{$entry['1']}%' LIMIT " . (mysql_num_rows(mysql_query("SELECT {$table['2']} FROM {$table['1']} WHERE {$table['2']} LIKE '{$entry['1']}%'", $this->connect_id)) - 1), $this->connect_id) || mysql_errno() == 1062 && preg_match('#CREATE\\s+UNIQUE\\s+INDEX\\s+([a-z_]+)\\s+ON\\s+([a-z_]+)\\s+\\(([a-z_]+)\\)#i', $query, $table) && preg_match("#Duplicate\\s+entry\\s+'(.*)'\\s+for\\s+key#i", mysql_error(), $entry) && mysql_query("DELETE FROM {$table['2']} WHERE {$table['3']} LIKE '{$entry['1']}%' LIMIT " . (mysql_num_rows(mysql_query("SELECT {$table['3']} FROM {$table['2']} WHERE {$table['3']} LIKE '{$entry['1']}%'", $this->connect_id)) - 1), $this->connect_id)) {
                 return $this->query($query, $bypass_error, $unbufferd);
             } else {
                 if (mysql_errno() == 1007 && preg_match('#CREATE\\s+DATABASE\\s+#i', $query)) {
                     return true;
                 }
             }
         }
     }
     if ($bypass_error) {
         return NULL;
     } else {
         $this->show_error("While executing query \"{$query}\"\n\nthe following error occured: " . mysql_error());
     }
 }
开发者ID:cbsistem,项目名称:nexos,代码行数:28,代码来源:mysql.php

示例12: query

 function query($sql, $unbuffered = false)
 {
     if (strlen($sql) > 140000) {
         exit('Insane query. Aborting.');
     }
     if (defined('OPENLD_SHOW_QUERIES')) {
         $q_start = microtime_float();
     }
     if ($unbuffered) {
         $this->query_result = @mysql_unbuffered_query($sql, $this->link_id);
     } else {
         $this->query_result = @mysql_query($sql, $this->link_id);
     }
     if ($this->query_result) {
         if (defined('OPENLD_SHOW_QUERIES')) {
             $this->saved_queries[] = array($sql, sprintf('%.5f', get_microtime() - $q_start));
         }
         ++$this->num_queries;
         return $this->query_result;
     } else {
         if (defined('OPENLD_SHOW_QUERIES')) {
             $this->saved_queries[] = array($sql, 0);
         }
         return false;
     }
 }
开发者ID:Dawzz,项目名称:Open-Link-Directory,代码行数:26,代码来源:mysql.php

示例13: query

 function query($sql, $unbuffered = false)
 {
     if (defined('FORUM_SHOW_QUERIES')) {
         $q_start = get_microtime();
     }
     if ($unbuffered) {
         $this->query_result = @mysql_unbuffered_query($sql, $this->link_id);
     } else {
         $this->query_result = @mysql_query($sql, $this->link_id);
     }
     if ($this->query_result) {
         if (defined('FORUM_SHOW_QUERIES')) {
             $this->saved_queries[] = array($sql, sprintf('%.5f', get_microtime() - $q_start));
         }
         ++$this->num_queries;
         return $this->query_result;
     } else {
         if (defined('FORUM_SHOW_QUERIES')) {
             $this->saved_queries[] = array($sql, 0);
         }
         $this->error_no = @mysql_errno($this->link_id);
         $this->error_msg = @mysql_error($this->link_id);
         // Rollback transaction
         if ($this->in_transaction) {
             mysql_query('ROLLBACK', $this->link_id);
         }
         --$this->in_transaction;
         return false;
     }
 }
开发者ID:istrwei,项目名称:Luna,代码行数:30,代码来源:mysql_innodb.php

示例14: rewind

 function rewind()
 {
     global $MYSQL_FORCE_INDEXES;
     $this->Clear();
     $list = "";
     foreach ($this->ids as $id) {
         $list .= "v{$id} AS v{$id}, ";
     }
     $table = $this->cache->GetTableName(0, $this->postfix);
     $sql = $this->ivl->GetSQL($this->cache, $table, $this->limit, $this->use_subseconds, isset($this->sequence) ? $this->sequence : false, $this->sampling);
     if ($MYSQL_FORCE_INDEXES) {
         if ($sql['index']) {
             sprintf($idx_fix, "FORCE INDEX (%s)", $sql['index']);
         } else {
             $idx_fix = "FORCE INDEX (PRIMARY)";
         }
     } else {
         $idx_fix = "";
     }
     $list .= $sql['list'];
     $cond =& $sql['cond'];
     $sort =& $sql['sort'];
     $limit =& $sql['limit'];
     $join =& $sql['join'];
     $this->res = mysql_unbuffered_query("SELECT {$list} FROM `{$table}` {$idx_fix} {$join} {$cond} {$sort} {$limit}", $this->cache->dbh);
     if (!$this->res) {
         throw new ADEIException(translate("SELECT request '%s'  on CACHE table '%s' is failed. MySQL error: %s", "SELECT {$list} FROM `{$table}` {$idx_fix} {$join} {$cond} {$sort} {$limit}", $table, mysql_error($this->cache->dbh)));
     }
     $this->next();
 }
开发者ID:nicolaisi,项目名称:adei,代码行数:30,代码来源:rawpoint.php

示例15: query

 function query($sql, $unbuffered = false)
 {
     if (strlen($sql) > 140000) {
         exit('Insane query. Aborting.');
     }
     if (defined('FORUM_SHOW_QUERIES') || defined('FORUM_DEBUG')) {
         $q_start = forum_microtime();
     }
     if ($unbuffered) {
         $this->query_result = @mysql_unbuffered_query($sql, $this->link_id);
     } else {
         $this->query_result = @mysql_query($sql, $this->link_id);
     }
     if ($this->query_result) {
         if (defined('FORUM_SHOW_QUERIES') || defined('FORUM_DEBUG')) {
             $this->saved_queries[] = array($sql, sprintf('%.5f', forum_microtime() - $q_start));
         }
         ++$this->num_queries;
         return $this->query_result;
     } else {
         if (defined('FORUM_SHOW_QUERIES') || defined('FORUM_DEBUG')) {
             $this->saved_queries[] = array($sql, 0);
         }
         if ($this->in_transaction) {
             mysql_query('ROLLBACK', $this->link_id);
         }
         --$this->in_transaction;
         return false;
     }
 }
开发者ID:torepublicStartpageCode,项目名称:torepublic2,代码行数:30,代码来源:mysql_innodb.php


注:本文中的mysql_unbuffered_query函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。