示例#1
0
 public function request($method, $param, $path)
 {
     $content = self::buildXML($param);
     $queueName = $this->queueName;
     $date = Util_Time::GetGMTDate();
     $canonicalizedMQSHeaders = array('x-mns-version' => $this->version);
     $sign = $this->createSign($method, $canonicalizedMQSHeaders, $date, $path);
     $host = $this->accountID . '.' . self::$beijingURL;
     $headers = array('Host' => $host, 'Date' => $date, 'Content-Type' => $this->contentType, 'Authorization' => $sign);
     foreach ($canonicalizedMQSHeaders as $key => $value) {
         $headers[$key] = $value;
     }
     $uri = $host . $path;
     $result = self::Http($uri, $method, $headers, $content, $path);
     if ($result) {
         $result = Util_String::XMLToArray($result);
     }
     return $result;
 }
示例#2
0
 function query($sql)
 {
     $sqlMD5 = md5($sql);
     $this->count++;
     if ($this->debug) {
         Util_Time::timerStart($sqlMD5);
     }
     $result = @mysql_query($sql, $this->_connection);
     if ($this->debug) {
         $duration = Util_Time::timerStop($sqlMD5, Util_Time::TIMER_PRECISION_MSEC);
         $rowNum = mysql_affected_rows($this->_connection);
         $count = $this->count;
         if ($this->debug === 'footer') {
             DB_Stat::push(array('total' => $count, 'row' => $rowNum, 'time' => $duration, 'sql' => $sql));
         } else {
             $statRecord = "[{$count}][ROW:{$rowNum}][time:{$duration} ms]{$sql}";
             echo "<pre>{$statRecord}</pre>\r\n";
         }
     }
     if ($result) {
         return $result;
     } else {
         if ($this->_trans_depth > 0) {
             $this->_trans_status = false;
         }
         $this->error = mysql_error($this->_connection);
         return false;
     }
 }