Changeset 3714

Show
Ignore:
Timestamp:
07/19/07 20:49:13 (3 years ago)
Author:
coolengineer
Message:
  • #454
  • mysql_tc_query 를 DBQuery::query 로 모두 바꿈.
Location:
trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/components/Eolin.PHP.Core.php

    r3700 r3714  
    958958} 
    959959 
    960 function mysql_tc_query($query) { 
    961     global $_queryCache; 
    962     if( function_exists( '__tcSqlLogBegin' ) ) { 
    963         __tcSqlLogBegin($query); 
    964     } 
    965     $result = mysql_query($query); 
    966     if( function_exists( '__tcSqlLogEnd' ) ) { 
    967         __tcSqlLogEnd($result,false); 
    968     } 
    969     return $result; 
    970 } 
    971  
    972 function mysql_tc_clear_cache() { 
    973     global $cachedResult; 
    974     $cachedResult = array(); 
    975 } 
     960global $cachedResult; 
     961global $fileCachedResult; 
     962$cachedResult = array(); 
    976963 
    977964class DBQuery {  
    978965    /*@static@*/  
    979966    function queryExistence($query) { 
    980         $query = DBQuery::queryPostProcessing($query); 
    981         if ($result = mysql_tc_query($query)) { 
     967        if ($result = DBQuery::query($query)) { 
    982968            if (mysql_num_rows($result) > 0) { 
    983969                mysql_free_result($result); 
     
    991977    /*@static@*/ 
    992978    function queryCount($query) { 
    993         $query = DBQuery::queryPostProcessing($query); 
    994979        $count = 0; 
    995         if ($result = mysql_tc_query($query)) { 
     980        if ($result = DBQuery::query($query)) { 
    996981            $count = mysql_num_rows($result); 
    997982            mysql_free_result($result); 
     
    10351020    /*@static@*/ 
    10361021    function queryColumn($query, $useCache=true) { 
    1037         $query = DBQuery::queryPostProcessing($query); 
    1038  
    10391022        global $cachedResult; 
    10401023        $cacheKey = "{$query}_queryColumn"; 
     
    10491032 
    10501033        $column = null; 
    1051         if ($result = mysql_tc_query($query)) { 
     1034        if ($result = DBQuery::query($query)) { 
    10521035            $column = array(); 
    10531036            while ($row = mysql_fetch_row($result)) 
     
    10641047    /*@static@*/ 
    10651048    function queryAll($query, $type = MYSQL_BOTH, $count = -1) { 
    1066         $query = DBQuery::queryPostProcessing($query); 
    10671049        $all = array(); 
    1068         if ($result = mysql_tc_query($query)) { 
     1050        if ($result = DBQuery::query($query)) { 
    10691051            while ( ($count-- !=0) && $row = mysql_fetch_array($result, $type)) 
    10701052                array_push($all, $row); 
     
    10931075    /*@static@*/ 
    10941076    function execute($query) { 
    1095         $query = DBQuery::queryPostProcessing($query); 
    1096         return mysql_tc_query($query) ? true : false; 
    1097     } 
    1098  
    1099     /*@static@*/ 
    1100     function query($query) { 
    1101         $query = DBQuery::queryPostProcessing($query); 
    1102         return mysql_tc_query($query); 
    1103     } 
     1077        return DBQuery::query($query) ? true : false; 
     1078    } 
     1079 
     1080    /*@static@*/ 
    11041081    function queryPostProcessing($query) { 
    11051082        global $service; 
     
    11071084 
    11081085    } 
     1086 
     1087    /*@static@*/ 
     1088    function query($query) { 
     1089        $query = DBQuery::queryPostProcessing($query); 
     1090        if( function_exists( '__tcSqlLogBegin' ) ) { 
     1091            __tcSqlLogBegin($query); 
     1092            $result = mysql_query($query); 
     1093            __tcSqlLogEnd($result,false); 
     1094        } else { 
     1095            $result = mysql_query($query); 
     1096        } 
     1097        if( stristr($query, 'update ') || 
     1098            stristr($query, 'insert ') || 
     1099            stristr($query, 'update ') || 
     1100            stristr($query, 'replace ') ) { 
     1101            DBQuery::clearCache(); 
     1102        } 
     1103        return $result; 
     1104    } 
     1105 
     1106    function clearCache() { 
     1107        global $cachedResult; 
     1108        $cachedResult = array(); 
     1109        if( function_exists( '__tcSqlLogBegin' ) ) { 
     1110            __tcSqlLogBegin("Cache cleared"); 
     1111            __tcSqlLogEnd(null,true); 
     1112        } 
     1113    } 
     1114 
     1115    function cacheSave() { 
     1116    } 
     1117} 
     1118 
     1119register_shutdown_function( array('DBQuery',cacheSave) ); 
     1120 
     1121function mysql_tc_query($sql) { 
     1122    return DBQuery::query($sql); 
    11091123} 
    11101124 
     
    12041218            return false; 
    12051219        $this->_query = 'INSERT INTO ' . $this->table . '(' . implode(',', array_keys($attributes)) . ') VALUES(' . implode(',', $attributes) . ')'; 
    1206         if (mysql_tc_query($this->_query)) { 
     1220        if (DBQuery::query($this->_query)) { 
    12071221            $this->id = mysql_insert_id(); 
    12081222            return true; 
     
    12181232            array_push($attributes, $name . '=' . $value); 
    12191233        $this->_query = 'UPDATE ' . $this->table . ' SET ' . implode(',', $attributes) . $this->_makeWhereClause(); 
    1220         if (mysql_tc_query($this->_query)) 
     1234        if (DBQuery::query($this->_query)) 
    12211235            return true; 
    12221236        return false; 
     
    12311245            return false; 
    12321246        $this->_query = 'REPLACE INTO ' . $this->table . '(' . implode(',', array_keys($attributes)) . ') VALUES(' . implode(',', $attributes) . ')'; 
    1233         if (mysql_tc_query($this->_query)) { 
     1247        if (DBQuery::query($this->_query)) { 
    12341248            $this->id = mysql_insert_id(); 
    12351249            return true; 
     
    12421256            return false; 
    12431257        $this->_query = 'DELETE FROM ' . $this->table . $this->_makeWhereClause(); 
    1244         if (mysql_tc_query($this->_query)) 
     1258        if (DBQuery::query($this->_query)) 
    12451259            return true; 
    12461260        return false; 
  • trunk/plugins/PN_Subscription_Default/index.php

    r3604 r3714  
    234234    global $database; 
    235235    $statistics = array(); 
    236     if ($result = mysql_query("select ip, host, useragent, subscribed, referred from {$database['prefix']}SubscriptionStatistics where blogid = $blogid order by referred desc")) { 
     236    if ($result = DBQuery::query("select ip, host, useragent, subscribed, referred from {$database['prefix']}SubscriptionStatistics where blogid = $blogid order by referred desc")) { 
    237237        while ($record = mysql_fetch_array($result)) 
    238238            array_push($statistics, $record);