Пример #1
0
 function ociexecute($null, $mode = false)
 {
     _mysqlbindbyname($GLOBALS['$stmt'], ':oci_unique', round(lcg_value() * 100000000));
     preg_match('/^[\\s]*([\\w]+)/', $GLOBALS['$stmt']['$sql'], $matchs);
     $GLOBALS['$stmt_mode'] = empty($matchs[1]) ? 'default' : strtolower($matchs[1]);
     $GLOBALS['$stmt']['$sql'] = preg_replace(array('/[\\w_]+_doc_list[\\s\\S]+where l\\.list_id=d\\.list_id\\(\\+\\)/', "/\\(\\+\\)[\\s]+/", '/decode\\(([^,]+),([^,]+),([^,]+),([^,]+)\\)/', '/[\\w\\_]+\\.nextval/', '/to_char\\(([^,\'"]+),([^\\)]+)\\)/es', '/to_date\\(([^,\\)]+),([^\\)]+)\\)([\\s\\d\\+\\-\\/]*)/es', '/nvl\\(([^,]+),([^\\)]+)\\)/', '/^[\\s]*select(.*)\\.currval(.*)dual[\\s]*$/', '/^[\\s]*(insert[^\\(]+)([\\s]+t[\\s]+)\\(/', '/(regexp_substr|regexp_replace)\\(([^,\\)]+),.*\'\\)/U', '/trunc\\(([^,\\)]+)(\\)|,([^\\)]+)\\))/es', '/(sysdate|SYSDATE)([ \\d\\+\\-\\/]*)/es', '/([\\s]*)LOAD([\\s]*)/', '/^[\\s]*alter[\\s]*session.*$/', '/^([\\s]*update[\\s]+.*[\\s]+(set|SET)[\\s]+)/', '/=[\\s]+(null|NULL)[\\s]+/'), array('tuijian_doc_list l left join tuijian_doc_detail d on l.list_id=d.list_id where 1', ' ', ' case when \\1 = \\2 then \\3  else \\4 End ', 'NULL', '_oci_to_char("\\1", "\\2")', '_oci_to_date("\\1", "\\2", "\\3")', 'ifnull(\\1,\\2)', 'SELECT last_insert_id()', '\\1 (', ' \\2 ', '_oci_trunc("\\1", "\\3")', '_oci_sysdate("\\2")', '\\1`LOAD`\\2', 'select 1', '\\1 oci_unique=:oci_unique, ', ' is NULL '), $GLOBALS['$stmt']['$sql']);
     $GLOBALS['lastSql'] = $GLOBALS['$stmt']['$sql'];
     $mysql_error = _mysqlexecute($GLOBALS['$stmt']);
     if ($mysql_error) {
         var_dump($mysql_error, $GLOBALS['lastSql'], 'mysqlmysql');
     }
     return $mysql_error;
 }
Пример #2
0
 /**
  * @desc   WHAT?
  * @author xing39393939@gmail.com
  * @since  2012-11-29 18:13:14
  * @throws 注意:无DB异常处理
  */
 function delete($key)
 {
     $bool = false;
     if ($this->config['host']) {
         if ($this->memcacheObj || $this->connect()) {
             $t1 = microtime(true);
             try {
                 $bool = $this->memcacheObj->delete($key);
             } catch (Exception $e) {
                 _status(1, VHOST . '(Couchbase)', '异常', "{$this->config['host_alias']}:{$this->config['bucket']}(delete)", $key, VIP, GET_INCLUDED_FILES);
             }
             $diff_time = sprintf('%.5f', microtime(true) - $t1);
             _status(1, VHOST . '(Couchbase)', "{$this->config['host_alias']}:{$this->config['bucket']}(delete)", GET_INCLUDED_FILES, NULL, VIP, $diff_time);
             if ($diff_time < 1) {
                 _status(1, VHOST . '(Couchbase)', '一秒内', _debugtime($diff_time), "{$this->config['host_alias']}:{$this->config['bucket']}(delete)" . VIP, GET_INCLUDED_FILES, $diff_time);
             } else {
                 _status(1, VHOST . '(Couchbase)', '超时', _debugtime($diff_time), "{$this->config['host_alias']}:{$this->config['bucket']}(delete)" . VIP, GET_INCLUDED_FILES, $diff_time);
             }
         }
     } else {
         if (strpos(get_class($this), 'memcache_server') !== false) {
             $this->connect($key);
         }
         if ($this->memcacheObj) {
             $t1 = microtime(true);
             $bool = $this->memcacheObj->delete($key, 0);
             $diff_time = sprintf('%.5f', microtime(true) - $t1);
             _status(1, VHOST . '(Memcache)', "{$this->current_host['host']}:{$this->current_host['port']}(delete)", GET_INCLUDED_FILES, NULL, VIP, $diff_time);
             if ($diff_time < 1) {
                 _status(1, VHOST . '(Memcache)', '一秒内', _debugtime($diff_time), "{$this->current_host['host']}:{$this->current_host['port']}(delete)" . VIP, GET_INCLUDED_FILES, $diff_time);
             } else {
                 _status(1, VHOST . '(Memcache)', '超时', _debugtime($diff_time), "{$this->current_host['host']}:{$this->current_host['port']}(delete)" . VIP, GET_INCLUDED_FILES, $diff_time);
             }
         }
         //mysql中删除;
         if (!$this->mysql_conn && $this->mysql_config) {
             $this->mysql_conn = _mysqllogon($this->mysql_config['db_config']);
             if ($this->mysql_config['encode']) {
                 mysql_query("SET NAMES '{$this->mysql_config['encode']}'");
             }
         }
         if (!$this->mysql_conn) {
             return $bool;
         }
         $sql = "delete from  {$this->mysql_config['table_name']} where mem_key=:mem_key";
         $stmt = _mysqlparse($this->mysql_conn, $sql);
         _mysqlbindbyname($stmt, ":mem_key", $key);
         _mysqlexecute($stmt);
     }
     return $bool;
 }