コード例 #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);
 }
コード例 #2
0
 public function __construct($dbname = null, array $db_config = array())
 {
     parent::__construct($dbname, $db_config);
     parent::setTableName("warning_message");
 }
コード例 #3
0
 public function __construct($dbname = null, array $db_config = array())
 {
     parent::__construct($dbname, $db_config);
     parent::setTableName("err_sendlog");
 }
コード例 #4
0
 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);
コード例 #6
0
 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
ファイル: BaseModelDB.php プロジェクト: az0ne/diaoyu
 /**
  * 执行给出的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
ファイル: MyDB.php プロジェクト: guojianing/dagger2
 /**
  * 增加慢查询提示 
  */
 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
ファイル: MyDB.php プロジェクト: sdgdsffdsfff/dagger_alarm
 public function __construct($dbname = null, array $db_config = array())
 {
     parent::__construct($dbname, $db_config);
 }
コード例 #11
0
 public function __construct($dbname = null, array $db_config = array())
 {
     parent::__construct($dbname, $db_config);
     parent::setTableName("online_debug");
 }