示例#1
0
 public function db()
 {
     $db = new BaseModelDB();
     $rs = $db->getData("SELECT * FROM `test`", 10);
     //$db->setTableName('test');
     //$db->update(array('name'=>'示例'), array('id'=>2));
     // $rs = $db->getRow("SELECT * FROM `test`");
     // $rs = $db->getFirst("SELECT * FROM `test`");
     header('Content-Type: text/html; charset=UTF-8');
     var_dump($rs);
 }
 public function __construct($dbname = null, array $db_config = array())
 {
     parent::__construct($dbname, $db_config);
     parent::setTableName("warning_message");
 }
 public function __construct($dbname = null, array $db_config = array())
 {
     parent::__construct($dbname, $db_config);
     parent::setTableName("err_sendlog");
 }
 public function __construct($dbname = null, array $db_config = array())
 {
     parent::__construct($dbname, $db_config);
     parent::setTableName("queue_runtime");
 }
示例#5
0
文件: example.php 项目: az0ne/diaoyu
/**
 * All rights reserved.
 * 示例程序
 * @author          wangxin <*****@*****.**>
 * @time            2011/3/2 15:03
 * @version         Id: 0.9
*/
require dirname(__FILE__) . "/global.php";
/*
$mcd = new MyMemcached();
$urls = array('http://baidu.com', 'http://www.google.com.hk', 'http://search.sina.com.cn');
$r = Http::multiHeader($urls);
// var_dump($r);
exit;
*/
$db = new BaseModelDB();
$rs = $db->getData("SELECT * FROM `test`", 10);
exit;
$starttime = microtime(true);
$mcd = new MyMemcached();
$a = array();
for ($i = 0; $i < 100; $i++) {
    $a['key' . $i] = $i;
}
$mcd->setMulti($a, 10);
$t1 = microtime(true) - $starttime;
$starttime = microtime(true);
$mc = new MyMemcache();
for ($i = 0; $i < 100; $i++) {
    $a['key' . $i] = $i;
    $mc->set('key' . $i, $i, 10);
 public function __construct($dbname = null, array $db_config = array())
 {
     parent::__construct($dbname, $db_config);
     parent::setTableName("sysmodule");
 }
示例#7
0
文件: MyDB.php 项目: az0ne/diaoyu
 /**
  * 增加慢查询提示 
  */
 public function debugResult($result, $type = '')
 {
     parent::debugResult($result, $type);
     if (defined('DAGGER_DEBUG')) {
         $runTime = floatval($this->runTime) * 1000;
         if ($runTime > 100) {
             BaseModelCommon::debug('slow sql', 'warn');
         }
     }
 }
示例#8
0
 /**
  * 执行给出的SQL语句
  * @param string $sql               sql statement
  * @param array &$result            result data
  * @param string $master_or_slave   master db / slave db
  * @return the number of this->_affected rows
  */
 public function exec($sql, $data = '', &$result = array(), $master_or_slave = 'master')
 {
     switch (strtoupper(trim($sql))) {
         case 'START TRANSACTION':
         case 'BEGIN':
             self::$inTransaction = true;
             break;
         case 'COMMIT':
         case 'ROLLBACK':
             self::$inTransaction = false;
             break;
     }
     defined('DAGGER_DEBUG') && BaseModelCommon::debug(intval(self::$inTransaction), 'db_inTransaction');
     $this->_sendQuery($sql, $data, $master_or_slave, $result);
     $this->debugResult($result, 'db_affected_num');
     if (is_int($result['affected_num']) && $result['affected_num'] >= 0) {
         return true;
     }
     return false;
 }
示例#9
0
 /**
  * 增加慢查询提示 
  */
 public function debugResult($result, $type = '')
 {
     parent::debugResult($result, $type);
     if (defined('DAGGER_DEBUG')) {
         $runTime = floatval($this->runTime);
         //本来就是毫秒..不用成1000..
         if ($runTime > 100) {
             //超过100ms  就为慢查询...
             BaseModelCommon::debug('slow sql', 'warn');
         }
     }
 }
示例#10
0
 public function __construct($dbname = null, array $db_config = array())
 {
     parent::__construct($dbname, $db_config);
 }
 public function __construct($dbname = null, array $db_config = array())
 {
     parent::__construct($dbname, $db_config);
     parent::setTableName("online_debug");
 }