示例#1
0
 function affectedRows($r = 0)
 {
     if (!$r) {
         $r = $this->lastResult;
     }
     return ocirowcount($this->lastResult);
 }
 function affectedRows($ressource = null)
 {
     if ($ressource !== null && get_class($ressource) == 'CopixDbResultSetOci8') {
         return ocirowcount($ressource->_idResult);
     } else {
         return -1;
     }
 }
 /**
  * The constructor.
  * @access public
  * @param integer $resourceId The resource id for this query.
  */
 function OracleDeleteQueryResult($resourceId)
 {
     // ** parameter validation
     $resourceRule = ResourceValidatorRule::getRule();
     ArgumentValidator::validate($resourceId, $resourceRule, true);
     // ** end of parameter validation
     $this->_resourceId = $resourceId;
     $this->_numberOfRows = ocirowcount($this->_resourceId);
 }
 /**
  * Creates a new OracleINSERTQueryResult object.
  * @access public
  * @param integer $resourceId The resource id for this query.
  * @param integer $lastId The last id that was inserted
  * @return object A new OracleINSERTQueryResult object.
  */
 function OracleInsertQueryResult($resourceId, $lastId)
 {
     // ** parameter validation
     $resourceRule = ResourceValidatorRule::getRule();
     $integerRule = OptionalRule::getRule(IntegerValidatorRule::getRule());
     ArgumentValidator::validate($resourceId, $resourceRule, true);
     ArgumentValidator::validate($lastId, $integerRule, true);
     // ** end of parameter validation
     $this->_resourceId = $resourceId;
     $this->_numberOfRows = ocirowcount($this->_resourceId);
     $this->_lastAutoIncrementValue = $lastId;
 }
示例#5
0
 function _affectedRows()
 {
     return is_resource($this->_lastrs) ? ocirowcount($this->_lastrs) : false;
 }
示例#6
0
if (!$conn) {
    $conn = oracle_login($PHPSPLOIT, "DEDICATED");
}
if (!$conn) {
    $err = @oci_error();
    return error("ERROR: ocilogon(): %s", $err["message"]);
}
// Send query
$query = @ociparse($conn, $PHPSPLOIT['QUERY']);
if (!$query) {
    $err = @oci_error();
    return error("ERROR: ociparse(): %s", $err["message"]);
}
$statement_type = @ocistatementtype($query);
if (!ociexecute($query)) {
    $err = @oci_error($query);
    return error("ERROR: ociexecute(): %s", $err["message"]);
}
if ($statement_type == "SELECT") {
    $result = array();
    $obj = oci_fetch_array($query, OCI_ASSOC + OCI_RETURN_NULLS);
    $result[] = array_keys($obj);
    $result[] = array_values($obj);
    while ($line = oci_fetch_array($query, OCI_ASSOC + OCI_RETURN_NULLS)) {
        $result[] = array_values($line);
    }
    return array('GET', count($result) - 1, $result);
} else {
    $rows = @ocirowcount($query);
    return array('SET', $rows);
}
示例#7
0
 function AffectedRows($rsMain)
 {
     return is_resource($rsMain) ? ocirowcount($rsMain) : false;
 }
示例#8
0
 function _get_stats_flag_data($conn_db, $v1, $v2, $stats_flag, $date)
 {
     $v2_index = '';
     $v2_index = strstr($v2, '点击数(总量)') ? 'TOTAL_CLI' : $v2_index;
     $v2_index = strstr($v2, '点击数(独立IP)') ? 'TOTAL_IP' : $v2_index;
     $v2_index = strstr($v2, '点击数(人均)') ? 'AVG' : $v2_index;
     if ($v2_index == '') {
         echo 'v2 参数错误';
         return false;
     }
     $url = "http://partner.site.com/interface/rd/sc?ud={$date}&cli={$stats_flag}";
     $chinfo = null;
     $result = _curl($chinfo, $url);
     if ($result == '') {
         echo "接口数据有误";
         return fasle;
     }
     $result = json_decode($result, true);
     $result = $result[0];
     if ($v2_index == 'AVG' && $result['TOTAL_IP']) {
         $result['AVG'] = $result['TOTAL_CLI'] / $result['TOTAL_IP'];
     } else {
         $result['AVG'] = 0;
     }
     //更新配置表
     $sql = "update {$this->report_monitor} set fun_count=:fun_count where v1=:v1 and v2=:v2 and cal_date =to_date(:cal_date,'yyyy-mm-dd hh24:mi:ss')";
     $stmt = _ociparse($conn_db, $sql);
     _ocibindbyname($stmt, ':v1', $v1);
     _ocibindbyname($stmt, ':v2', $v2);
     _ocibindbyname($stmt, ':cal_date', $date);
     _ocibindbyname($stmt, ':fun_count', $result[$v2_index]);
     $error = _ociexecute($stmt);
     if (ocirowcount($stmt)) {
         $sql = "insert into {$this->report_monitor}(id, v1, v2, v3, v5,  fun_count, cal_date, md5, add_time ) values\n                (seq_{$this->report_monitor}.nextval, :v1, :v2, :vip, :vip, :fun_count, to_date(:cal_date,'yyyy-mm-dd hh24:mi:ss'), :md5, sysdate)";
         $stmt = _ociparse($conn_db, $sql);
         _ocibindbyname($stmt, ':v1', $v1);
         _ocibindbyname($stmt, ':v2', $v2);
         _ocibindbyname($stmt, ':vip', VIP);
         _ocibindbyname($stmt, ':fun_count', $result[$v2_index]);
         _ocibindbyname($stmt, ':cal_date', $date);
         _ocibindbyname($stmt, ':md5', md5($v1 . $v2 . $date));
         $error = _ociexecute($stmt);
     }
     //更新天表数据
     $sql = "update {$this->report_monitor_date} set fun_count=:fun_count where v1=:v1 and v2=:v2 and cal_date =to_date(:cal_date,'yyyy-mm-dd')";
     $stmt = _ociparse($conn_db, $sql);
     _ocibindbyname($stmt, ':v1', $v1);
     _ocibindbyname($stmt, ':v2', $v2);
     _ocibindbyname($stmt, ':cal_date', $date);
     _ocibindbyname($stmt, ':fun_count', $result[$v2_index]);
     $error = _ociexecute($stmt);
     var_dump($error);
     if (!ocirowcount($stmt)) {
         $sql = "insert into {$this->report_monitor_date}( v1, v2, fun_count, cal_date) values\n                ( :v1, :v2, :fun_count, to_date(:cal_date,'yyyy-mm-dd hh24:mi:ss'))";
         $stmt = _ociparse($conn_db, $sql);
         _ocibindbyname($stmt, ':v1', $v1);
         _ocibindbyname($stmt, ':v2', $v2);
         _ocibindbyname($stmt, ':fun_count', $result[$v2_index]);
         _ocibindbyname($stmt, ':cal_date', $date);
         $error = _ociexecute($stmt);
         var_dump($error);
     }
     //更新小时表数据
     $sql = "update {$this->report_monitor_hour} set fun_count=:fun_count where v1=:v1 and v2=:v2 and cal_date =to_date(:cal_date,'yyyy-mm-dd hh24:mi:ss')";
     $stmt = _ociparse($conn_db, $sql);
     _ocibindbyname($stmt, ':v1', $v1);
     _ocibindbyname($stmt, ':v2', $v2);
     _ocibindbyname($stmt, ':cal_date', $date);
     _ocibindbyname($stmt, ':fun_count', $result[$v2_index]);
     $error = _ociexecute($stmt);
     var_dump($error);
     if (!ocirowcount($stmt)) {
         $sql = "insert into {$this->report_monitor_hour}( v1, v2, v3, fun_count, cal_date ) values\n                (:v1, :v2, :v3, :fun_count, to_date(:cal_date,'yyyy-mm-dd hh24:mi:ss'))";
         $stmt = _ociparse($conn_db, $sql);
         _ocibindbyname($stmt, ':v1', $v1);
         _ocibindbyname($stmt, ':v2', $v2);
         _ocibindbyname($stmt, ':v3', VIP);
         _ocibindbyname($stmt, ':fun_count', $result[$v2_index]);
         _ocibindbyname($stmt, ':cal_date', $date);
         $error = _ociexecute($stmt);
         var_dump($error);
     }
 }
示例#9
0
 /**
  * Return number of affected rows
  */
 function sql_affectedrows()
 {
     return $this->query_result ? @ocirowcount($this->query_result) : false;
 }
示例#10
0
文件: r57.php 项目: Theov/webshells
     break;
 case 'Oracle':
     $db = @ocilogon($_POST['mysql_l'], $_POST['mysql_p'], $_POST['mysql_db']);
     if ($error = @ocierror()) {
         echo "<div align=center><font face=Verdana size=-2 color=red><b>Can't connect to Oracle server.<br>" . $error['message'] . "</b></font></div>";
     } else {
         $querys = @explode(';', $_POST['db_query']);
         foreach ($querys as $num => $query) {
             if (strlen($query) > 5) {
                 echo "<font face=Verdana size=-2 color=green><b>Query#" . $num . " : " . htmlspecialchars($query) . "</b></font><br>";
                 $stat = @ociparse($db, $query);
                 @ociexecute($stat);
                 if ($error = @ocierror()) {
                     echo "<table width=100%><tr><td><font face=Verdana size=-2>Error : <b>" . $error['message'] . "</b></font></td></tr></table><br>";
                 } else {
                     $rowcount = @ocirowcount($stat);
                     if ($rowcount != 0) {
                         echo "<table width=100%><tr><td><font face=Verdana size=-2>affected rows : <b>" . $rowcount . "</b></font></td></tr></table><br>";
                     } else {
                         echo "<table width=100%><tr>";
                         for ($j = 1; $j <= @ocinumcols($stat); $j++) {
                             echo "<td bgcolor=#cccccc><font face=Verdana size=-2><b>&nbsp;" . htmlspecialchars(@ocicolumnname($stat, $j)) . "&nbsp;</b></font></td>";
                         }
                         echo "</tr>";
                         while (ocifetch($stat)) {
                             echo "<tr>";
                             for ($j = 1; $j <= @ocinumcols($stat); $j++) {
                                 echo "<td><font face=Verdana size=-2>&nbsp;" . htmlspecialchars(@ociresult($stat, $j)) . "&nbsp;</font></td>";
                             }
                             echo "</tr>";
                         }
示例#11
0
 function _initialize()
 {
     ini_set("display_errors", true);
     $xxi = 0;
     $conn_db = _ocilogon($this->db);
     if (!$conn_db) {
         exit('no db');
     }
     $get_included_files = basename(array_shift(get_included_files()));
     $tt1 = microtime(true);
     echo "<pre> 准备压缩数据:\n";
     $monitor_count = $files = $monitor = $monitor_min = array();
     $ic = 0;
     $config_data = array();
     $sql = "select * from {$this->report_monitor_queue} order by id desc LIMIT 0, 2000";
     $stmt = _ociparse($conn_db, $sql);
     _ociexecute($stmt);
     $_row = array();
     while (ocifetchinto($stmt, $_row, OCI_ASSOC + OCI_RETURN_LOBS + OCI_RETURN_NULLS)) {
         $msg_array = unserialize($_row['QUEUE']);
         if ($msg_array['v5'] == null) {
             $msg_array['v5'] = VIP;
         }
         //专门对付SQL不规范的写法
         if (strpos($msg_array['v1'], 'SQL') !== false) {
             $out = array();
             preg_match('# in(\\s+)?\\(#is', $msg_array['v4'], $out);
             if ($out) {
                 $msg_array['v4'] = substr($msg_array['v4'], 0, strpos($msg_array['v4'], ' in')) . ' in....';
             }
         }
         if (strpos($msg_array['v1'], 'SQL') !== false) {
             preg_match('# in(\\s+)?\\(#is', $msg_array['v3'], $out);
             if ($out) {
                 $msg_array['v3'] = substr($msg_array['v3'], 0, strpos($msg_array['v3'], ' in')) . ' in....';
             }
         }
         foreach ((array) $msg_array['includes'] as $file) {
             $files[$msg_array['vhost']][$file] = $file;
         }
         //查看命中了哪些监控
         $config_data[$msg_array['v1']][$msg_array['v2']]++;
         //日志数据,不会被删除
         $monitor[date('Y-m-d H', strtotime($msg_array['time']))][$msg_array['v1']][$msg_array['v2']][$msg_array['v3']][$msg_array['v4']][$msg_array['v5']]['uptype'] = $msg_array['uptype'];
         if ($msg_array['uptype'] == 'replace') {
             $monitor[date('Y-m-d H', strtotime($msg_array['time']))][$msg_array['v1']][$msg_array['v2']][$msg_array['v3']][$msg_array['v4']][$msg_array['v5']]['count'] = $msg_array['num'];
         } else {
             $monitor[date('Y-m-d H', strtotime($msg_array['time']))][$msg_array['v1']][$msg_array['v2']][$msg_array['v3']][$msg_array['v4']][$msg_array['v5']]['count'] += $msg_array['num'];
         }
         //最大耗时
         $monitor[date('Y-m-d H', strtotime($msg_array['time']))][$msg_array['v1']][$msg_array['v2']][$msg_array['v3']][$msg_array['v4']][$msg_array['v5']]['diff_time'] = max($monitor[date('Y-m-d H', strtotime($msg_array['time']))][$msg_array['v1']][$msg_array['v2']][$msg_array['v3']][$msg_array['v4']][$msg_array['v5']]['diff_time'], abs($msg_array['diff_time']));
         //总耗时
         $monitor[date('Y-m-d H', strtotime($msg_array['time']))][$msg_array['v1']][$msg_array['v2']][$msg_array['v3']][$msg_array['v4']][$msg_array['v5']]['total_diff_time'] += abs($msg_array['diff_time']);
         //内存单次最大消耗
         $monitor[date('Y-m-d H', strtotime($msg_array['time']))][$msg_array['v1']][$msg_array['v2']][$msg_array['v3']][$msg_array['v4']][$msg_array['v5']]['memory_max'] = max($monitor[date('Y-m-d H', strtotime($msg_array['time']))][$msg_array['v1']][$msg_array['v2']][$msg_array['v3']][$msg_array['v4']][$msg_array['v5']]['memory_max'], abs($msg_array['memory']));
         //内存消耗.总
         $monitor[date('Y-m-d H', strtotime($msg_array['time']))][$msg_array['v1']][$msg_array['v2']][$msg_array['v3']][$msg_array['v4']][$msg_array['v5']]['memory_total'] += abs($msg_array['memory']);
         // 用户消耗CPU,单次最大
         $monitor[date('Y-m-d H', strtotime($msg_array['time']))][$msg_array['v1']][$msg_array['v2']][$msg_array['v3']][$msg_array['v4']][$msg_array['v5']]['cpu_user_time_max'] = max($monitor[date('Y-m-d H', strtotime($msg_array['time']))][$msg_array['v1']][$msg_array['v2']][$msg_array['v3']][$msg_array['v4']][$msg_array['v5']]['cpu_user_time_max'], abs($msg_array['user_cpu']));
         //用户消耗CPU,总
         $monitor[date('Y-m-d H', strtotime($msg_array['time']))][$msg_array['v1']][$msg_array['v2']][$msg_array['v3']][$msg_array['v4']][$msg_array['v5']]['cpu_user_time_total'] += abs($msg_array['user_cpu']);
         //系统消耗CPU,单次最大
         $monitor[date('Y-m-d H', strtotime($msg_array['time']))][$msg_array['v1']][$msg_array['v2']][$msg_array['v3']][$msg_array['v4']][$msg_array['v5']]['cpu_sys_time_max'] = max($monitor[date('Y-m-d H', strtotime($msg_array['time']))][$msg_array['v1']][$msg_array['v2']][$msg_array['v3']][$msg_array['v4']][$msg_array['v5']]['cpu_sys_time_max'], abs($msg_array['sys_cpu']));
         //系统消耗CPU,总
         $monitor[date('Y-m-d H', strtotime($msg_array['time']))][$msg_array['v1']][$msg_array['v2']][$msg_array['v3']][$msg_array['v4']][$msg_array['v5']]['cpu_sys_time_total'] += abs($msg_array['sys_cpu']);
         $monitor_count[md5(date('Y-m-d H', strtotime($msg_array['time'])) . $msg_array['v1'] . $msg_array['v2'] . $msg_array['v3'] . $msg_array['v4'] . $msg_array['v5'])] = 1;
         if ($ic++ > 10 * 10000) {
             break;
         }
     }
     //clear queue start
     $sql_d = "TRUNCATE {$this->report_monitor_queue}";
     $stmt_d = _ociparse($conn_db, $sql_d);
     _ociexecute($stmt_d);
     //clear queue end
     $diff_time = sprintf('%.5f', microtime(true) - $tt1);
     echo "\n从{$ic}个压缩到" . count($monitor_count) . "(耗时:{$diff_time})\n";
     echo "命中的类型:\n";
     print_r($config_data);
     echo "\n\n";
     $conn_db = _ocilogon($this->db);
     foreach ($monitor as $time => $vtype) {
         foreach ($vtype as $type => $vhost) {
             foreach ($vhost as $host => $vact) {
                 foreach ($vact as $act => $vkey) {
                     foreach ($vkey as $key => $vhostip) {
                         foreach ($vhostip as $hostip => $v) {
                             if (!$host) {
                                 $host = 'null';
                             }
                             //截取4000字节
                             if (strlen($key) > 4000) {
                                 $key = substr($key, 0, 4000);
                             }
                             if (strlen($hostip) > 200) {
                                 $hostip = substr($hostip, 0, 200);
                             }
                             if (strlen($act) > 200) {
                                 $act = substr($act, 0, 200);
                             }
                             //去掉回车
                             $act = strtr($act, array("\n" => null, "\r" => null));
                             if ($v['uptype'] == 'replace') {
                                 //memory_max=,memory_total, cpu_user_time_max,cpu_user_time_total,cpu_sys_time_max,cpu_sys_time_total
                                 $sql = "update {$this->report_monitor} set fun_count=:fun_count,v6=:v6, total_diff_time=:total_diff_time,\n\t\t\t\t\t\t\t\t\tmemory_max=:memory_max, memory_total=:memory_total, cpu_user_time_max=:cpu_user_time_max, cpu_user_time_total=:cpu_user_time_total, cpu_sys_time_max=:cpu_sys_time_max, cpu_sys_time_total=:cpu_sys_time_total where md5=:md5 ";
                             } else {
                                 $sql = "update {$this->report_monitor} set fun_count=fun_count+:fun_count,v6=:v6, total_diff_time=:total_diff_time,\n\t\t\t\t\t\t\t\t    memory_max=:memory_max, memory_total=:memory_total, cpu_user_time_max=:cpu_user_time_max, cpu_user_time_total=:cpu_user_time_total, cpu_sys_time_max=:cpu_sys_time_max, cpu_sys_time_total=:cpu_sys_time_total where md5=:md5 ";
                             }
                             $stmt = _ociparse($conn_db, $sql);
                             _ocibindbyname($stmt, ':md5', md5($time . $type . $host . $act . $key . $hostip));
                             _ocibindbyname($stmt, ':fun_count', $v['count']);
                             _ocibindbyname($stmt, ':v6', abs($v['diff_time']));
                             _ocibindbyname($stmt, ':total_diff_time', $v['total_diff_time']);
                             _ocibindbyname($stmt, ':memory_max', $v['memory_max']);
                             _ocibindbyname($stmt, ':memory_total', $v['memory_total']);
                             _ocibindbyname($stmt, ':cpu_user_time_max', $v['cpu_user_time_max']);
                             _ocibindbyname($stmt, ':cpu_user_time_total', $v['cpu_user_time_total']);
                             _ocibindbyname($stmt, ':cpu_sys_time_max', $v['cpu_sys_time_max']);
                             _ocibindbyname($stmt, ':cpu_sys_time_total', $v['cpu_sys_time_total']);
                             $oci_error = _ociexecute($stmt);
                             print_r($oci_error);
                             if ($oci_error) {
                                 _status(1, VHOST . "(BUG错误)", 'SQL错误', "{$get_included_files}/{$_GET['act']}", var_export(array('cal_date' => $time, 'v1' => $type, 'v2' => $host, 'v3' => $act, 'v4' => $key, 'v5' => $hostip, 'fun_count' => $v['count'], 'v6' => abs($v['diff_time']), 'total_diff_time' => $v['total_diff_time'], 'memory_max' => $v['memory_max'], 'memory_total' => $v['memory_total'], 'cpu_user_time_max' => $v['cpu_user_time_max'], 'cpu_user_time_total' => $v['cpu_user_time_total'], 'cpu_sys_time_max' => $v['cpu_sys_time_max'], 'cpu_sys_time_total' => $v['cpu_sys_time_total']), true) . "|" . var_export($oci_error, true), VIP);
                             } else {
                                 _status(1, VHOST . "(PHPAPM)", "统计消耗", $type, 'monitor(update)', VIP);
                             }
                             $_row_count = ocirowcount($stmt);
                             if (!$_row_count) {
                                 $xxi++;
                                 echo "{$xxi}:[{$time} . {$type} . {$host} . {$act} . {$key} . {$hostip}]\n";
                                 $sql = "insert into {$this->report_monitor} (id,v1,v2,v3,v4,v5,fun_count,cal_date,v6,total_diff_time,memory_max,memory_total, cpu_user_time_max,cpu_user_time_total,cpu_sys_time_max,cpu_sys_time_total,md5)\n                                    values(seq_{$this->report_monitor}.nextval,:v1,:v2,:v3,:v4,:v5,:fun_count,to_date(:cal_date,'yyyy-mm-dd hh24:mi:ss'),:v6,:total_diff_time,:memory_max,:memory_total, :cpu_user_time_max,:cpu_user_time_total,:cpu_sys_time_max,:cpu_sys_time_total,:md5)";
                                 $stmt = _ociparse($conn_db, $sql);
                                 _ocibindbyname($stmt, ':md5', md5($time . $type . $host . $act . $key . $hostip));
                                 _ocibindbyname($stmt, ':cal_date', $time);
                                 _ocibindbyname($stmt, ':v1', $type);
                                 _ocibindbyname($stmt, ':v2', $host);
                                 _ocibindbyname($stmt, ':v3', $act);
                                 _ocibindbyname($stmt, ':v4', $key);
                                 _ocibindbyname($stmt, ':v5', $hostip);
                                 _ocibindbyname($stmt, ':fun_count', $v['count']);
                                 _ocibindbyname($stmt, ':v6', abs($v['diff_time']));
                                 _ocibindbyname($stmt, ':total_diff_time', $v['total_diff_time']);
                                 _ocibindbyname($stmt, ':memory_max', $v['memory_max']);
                                 _ocibindbyname($stmt, ':memory_total', $v['memory_total']);
                                 _ocibindbyname($stmt, ':cpu_user_time_max', $v['cpu_user_time_max']);
                                 _ocibindbyname($stmt, ':cpu_user_time_total', $v['cpu_user_time_total']);
                                 _ocibindbyname($stmt, ':cpu_sys_time_max', $v['cpu_sys_time_max']);
                                 _ocibindbyname($stmt, ':cpu_sys_time_total', $v['cpu_sys_time_total']);
                                 $oci_error = _ociexecute($stmt);
                                 print_r($oci_error);
                                 if ($oci_error) {
                                     _status(1, VHOST . "(BUG错误)", 'SQL错误', "{$get_included_files}/{$_GET['act']}", var_export(array('cal_date' => $time, 'time' => date('Y-m-d H:i:s'), 'md5' => md5($time . $type . $host . $act . $key . $hostip), 'v1' => $type, 'v2' => $host, 'v3' => $act, 'v4' => $key, 'v5' => $hostip, 'fun_count' => $v['count'], 'v6' => abs($v['diff_time']), 'memory_max' => $v['memory_max'], 'memory_total' => $v['memory_total'], 'cpu_user_time_max' => $v['cpu_user_time_max'], 'cpu_user_time_total' => $v['cpu_user_time_total'], 'cpu_sys_time_max' => $v['cpu_sys_time_max'], 'cpu_sys_time_total' => $v['cpu_sys_time_total']), true) . "|" . var_export($oci_error, true), VIP);
                                 } else {
                                     _status(1, VHOST . "(PHPAPM)", "统计消耗", $type, 'monitor', VIP);
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     _ocilogoff($conn_db);
     if (!is_writable('/dev/shm')) {
         exit('no writable shm');
     }
     if (!file_exists($dir = '/dev/shm/' . VHOST . '/')) {
         mkdir($dir);
     }
     if (!file_exists($dir1 = '/dev/shm/xss_' . VHOST . '/')) {
         mkdir($dir1);
     }
     include PHPAPM_PATH . "./lib/project_function.php";
     $project_function = new project_function();
     $check_files = array();
     if (date('H') > 8 && date('H') <= 19) {
         $time_area = '白天';
     } else {
         $time_area = '晚上';
     }
     //文件记录
     foreach ($files as $module_name => $_files) {
         foreach (array_unique($_files) as $file) {
             if (!is_file($file)) {
                 continue;
             }
             //文件修改时间
             $new_file = $dir . md5($file);
             //
             if (is_file($new_file) && filectime($new_file) < filectime($file)) {
                 echo "代码改动\n";
                 _status(1, $module_name . "(代码改动)", "文件改动-{$time_area}", $file, "", VIP, 0);
                 touch($new_file, filectime($file));
             } elseif (!is_file($new_file)) {
                 _status(1, $module_name . "(代码改动)", "新增文件-{$time_area}", $file, "", VIP, 0);
                 touch($new_file, filectime($file));
             }
             //安全校验
             $new_file = $dir1 . md5($file);
             if (is_file($new_file) && filectime($new_file) < filectime($file)) {
                 $check_files[$file] = $module_name;
             } elseif (!is_file($new_file)) {
                 $check_files[$file] = $module_name;
             }
         }
     }
     foreach ($check_files as $file => $module_name) {
         $token = token_get_all(file_get_contents($file));
         //代码所有人统计
         if (strpos($file, '/phpCas/') === false || strpos($file, '/PHPMailer/') === false) {
             $project_function->_function_author($token, $module_name, $file);
             $project_function->_function_count($token, $module_name, $file);
             $project_function->_xss($token, $module_name, $file);
             $project_function->_sign($token, $module_name, $file);
             $project_function->_disable_function($token, $module_name, $file);
         }
         touch($dir1 . md5($file), filectime($file));
     }
     die("\n" . date("Y-m-d H:i:s") . ',file:' . __FILE__ . ',line:' . __LINE__ . "\n");
 }
示例#12
0
 public function affectedRows()
 {
     return ocirowcount($this->_hMaster);
 }
示例#13
0
/**
 *  db_affected_rows() - Returns the number of rows changed in the last query
 *
 *  @param		string	Query result set handle
 */
function db_affected_rows($qhandle)
{
    return @ocirowcount($qhandle);
}
 function affected_rows()
 {
     switch ($this->db) {
         case 'MySQL':
             return @mysql_affected_rows($this->res);
             break;
         case 'MSSQL':
             return @mssql_affected_rows($this->res);
             break;
         case 'PostgreSQL':
             return @pg_affected_rows($this->res);
             break;
         case 'Oracle':
             return @ocirowcount($this->res);
             break;
         default:
             return 0;
             break;
     }
 }
示例#15
0
 function _initialize()
 {
     set_time_limit(0);
     ini_set("display_errors", true);
     echo "<pre>";
     $conn_db = _ocilogon($this->db);
     if (!$conn_db) {
         return;
     }
     //每小时汇总[上小时+当前小时]
     $hourtime = strtotime(date('Y-m-d H:0:0') . " -1 hour");
     $endtime = time();
     if ($_GET['hour']) {
         $hourtime = strtotime($_GET['hour']);
         $endtime = strtotime("{$_GET['hour']} +1 day");
     }
     //所有配置信息 包含虚列
     $sql = "select * from  {$this->report_monitor_config} t  where id>0";
     $stmt = _ociparse($conn_db, $sql);
     $oci_error = _ociexecute($stmt);
     $this->all_config = $_row = array();
     while (ocifetchinto($stmt, $_row, OCI_ASSOC + OCI_RETURN_LOBS + OCI_RETURN_NULLS)) {
         $this->all_config[$_row['V1'] . $_row['V2']] = $_row;
     }
     $addwhere = null;
     if ($_GET['v1']) {
         $addwhere .= " and v1=:v1 ";
     }
     if ($_GET['v2']) {
         $addwhere .= " and v2=:v2 ";
     }
     for ($it = $hourtime; $it <= $endtime; $it += 3600) {
         $hour = date('Y-m-d H:00:00', $it);
         echo "hour:{$hour}\n";
         //每小时数据汇总memory_max,memory_total, cpu_user_time_max,cpu_user_time_total,cpu_sys_time_max,cpu_sys_time_total
         $sql = "select to_char(t.cal_date, 'yyyy-mm-dd hh24') cal_date, t.v1, decode(t.v2,null,'null',v2) v2,\n                    decode(t.v3,null,'null',v3) v3, sum(fun_count) fun_count,avg(fun_count) fun_count_avg,max(abs(nvl(v6,0))) DIFF_TIME, sum(abs(t.total_diff_time)) total_diff_time,\n                    max(memory_max) memory_max, sum(memory_total) memory_total, max(cpu_user_time_max) cpu_user_time_max,sum(cpu_user_time_total) cpu_user_time_total, max(cpu_sys_time_max) cpu_sys_time_max, sum(cpu_sys_time_total) cpu_sys_time_total\n                    from {$this->report_monitor} t\n                    where cal_date >= to_date(:hour,'yyyy-mm-dd hh24:mi:ss') and cal_date <to_date(:hour,'yyyy-mm-dd hh24:mi:ss')+1/24\n                    {$addwhere}\n                    group by t.v1, t.v2,t.v3, to_char(t.cal_date, 'yyyy-mm-dd hh24')  ";
         $stmt_list = _ociparse($conn_db, $sql);
         _ocibindbyname($stmt_list, ':hour', $hour);
         if ($_GET['v1']) {
             _ocibindbyname($stmt_list, ':v1', $_GET['v1']);
         }
         if ($_GET['v2']) {
             _ocibindbyname($stmt_list, ':v2', $_GET['v2']);
         }
         $oci_error = _ociexecute($stmt_list);
         print_r($oci_error);
         $_row = array();
         while (ocifetchinto($stmt_list, $_row, OCI_ASSOC + OCI_RETURN_LOBS + OCI_RETURN_NULLS)) {
             $_row2 = $this->all_config[$_row['V1'] . $_row['V2']];
             //正常情况下从原始表读取数据.如果是按照最后一分钟计算.走min表
             //虚列数据不进行计算
             if ($_row2['VIRTUAL_COLUMNS'] == 0) {
                 if ($_row2['HOUR_COUNT_TYPE'] == 4) {
                     $_row['FUN_COUNT'] = $_row['FUN_COUNT_AVG'];
                 }
                 $sql = "update {$this->report_monitor_hour} set fun_count=:fun_count,diff_time=:diff_time, total_diff_time=:total_diff_time,\n                memory_max=:memory_max, memory_total=:memory_total, cpu_user_time_max=:cpu_user_time_max, cpu_user_time_total=:cpu_user_time_total, cpu_sys_time_max=:cpu_sys_time_max, cpu_sys_time_total=:cpu_sys_time_total\n                where v1=:v1 and v2=:v2 and v3=:v3  and  cal_date=to_date(:cal_date,'yyyy-mm-dd hh24') ";
                 $stmt = _ociparse($conn_db, $sql);
                 _ocibindbyname($stmt, ':v1', $_row['V1']);
                 _ocibindbyname($stmt, ':v2', $_row['V2']);
                 _ocibindbyname($stmt, ':v3', $_row['V3']);
                 _ocibindbyname($stmt, ':cal_date', $_row['CAL_DATE']);
                 _ocibindbyname($stmt, ':fun_count', $_row['FUN_COUNT']);
                 _ocibindbyname($stmt, ':diff_time', abs($_row['DIFF_TIME']));
                 _ocibindbyname($stmt, ':total_diff_time', abs($_row['TOTAL_DIFF_TIME']));
                 _ocibindbyname($stmt, ':memory_max', $_row['MEMORY_MAX']);
                 _ocibindbyname($stmt, ':memory_total', $_row['MEMORY_TOTAL']);
                 _ocibindbyname($stmt, ':cpu_user_time_max', $_row['CPU_USER_TIME_MAX']);
                 _ocibindbyname($stmt, ':cpu_user_time_total', $_row['CPU_USER_TIME_TOTAL']);
                 _ocibindbyname($stmt, ':cpu_sys_time_max', $_row['CPU_SYS_TIME_MAX']);
                 _ocibindbyname($stmt, ':cpu_sys_time_total', $_row['CPU_SYS_TIME_TOTAL']);
                 $oci_error = _ociexecute($stmt);
                 print_r($oci_error);
                 _status(1, VHOST . "(PHPAPM)", "统计消耗", $_row['V1'], 'monitor_hour(update)', VIP);
                 $ocirowcount = ocirowcount($stmt);
                 if ($ocirowcount < 1) {
                     $sql = "insert into {$this->report_monitor_hour} (cal_date,v1,v2,v3,fun_count,diff_time, total_diff_time,memory_max,memory_total, cpu_user_time_max,cpu_user_time_total,cpu_sys_time_max,cpu_sys_time_total)\n                    values (to_date(:cal_date,'yyyy-mm-dd hh24'),:v1,:v2,:v3,:fun_count,:diff_time, :total_diff_time, :memory_max,:memory_total, :cpu_user_time_max,:cpu_user_time_total,:cpu_sys_time_max,:cpu_sys_time_total) ";
                     $stmt = _ociparse($conn_db, $sql);
                     _ocibindbyname($stmt, ':v1', $_row['V1']);
                     _ocibindbyname($stmt, ':v2', $_row['V2']);
                     _ocibindbyname($stmt, ':v3', $_row['V3']);
                     _ocibindbyname($stmt, ':cal_date', $_row['CAL_DATE']);
                     _ocibindbyname($stmt, ':fun_count', $_row['FUN_COUNT']);
                     _ocibindbyname($stmt, ':diff_time', abs($_row['DIFF_TIME']));
                     _ocibindbyname($stmt, ':total_diff_time', abs($_row['TOTAL_DIFF_TIME']));
                     _ocibindbyname($stmt, ':memory_max', $_row['MEMORY_MAX']);
                     _ocibindbyname($stmt, ':memory_total', $_row['MEMORY_TOTAL']);
                     _ocibindbyname($stmt, ':cpu_user_time_max', $_row['CPU_USER_TIME_MAX']);
                     _ocibindbyname($stmt, ':cpu_user_time_total', $_row['CPU_USER_TIME_TOTAL']);
                     _ocibindbyname($stmt, ':cpu_sys_time_max', $_row['CPU_SYS_TIME_MAX']);
                     _ocibindbyname($stmt, ':cpu_sys_time_total', $_row['CPU_SYS_TIME_TOTAL']);
                     $oci_error = _ociexecute($stmt);
                     print_r($oci_error);
                     if ($oci_error) {
                         $get_included_files = basename(array_shift(get_included_files()));
                         _status(1, VHOST . "(BUG错误)", 'SQL错误', $get_included_files . '/' . $_GET['act'], var_export($oci_error, true) . "|" . var_export($_row, true));
                     } else {
                         _status(1, VHOST . "(PHPAPM)", "统计消耗", $_row['V1'], 'hour', VIP);
                     }
                 }
                 //虚数列数据
                 $compare_group = array_filter(explode('|', '|' . $_row2['COMPARE_GROUP']));
                 if (count($compare_group) > 0) {
                     foreach ($compare_group as $v) {
                         $sql = "update {$this->report_monitor_hour} set fun_count=:fun_count,diff_time=:diff_time,total_diff_time=:total_diff_time,\n                                        memory_max=:memory_max, memory_total=:memory_total, cpu_user_time_max=:cpu_user_time_max, cpu_user_time_total=:cpu_user_time_total, cpu_sys_time_max=:cpu_sys_time_max, cpu_sys_time_total=:cpu_sys_time_total\n                                        where v1=:v1 and v2=:v2 and v3=:v3  and  cal_date=to_date(:cal_date,'yyyy-mm-dd hh24') ";
                         $stmt = _ociparse($conn_db, $sql);
                         _ocibindbyname($stmt, ':v1', $v);
                         _ocibindbyname($stmt, ':v2', $_row['V1'] . '_' . $_row['V2']);
                         _ocibindbyname($stmt, ':v3', $_row['V3']);
                         _ocibindbyname($stmt, ':cal_date', $_row['CAL_DATE']);
                         _ocibindbyname($stmt, ':fun_count', $_row['FUN_COUNT']);
                         _ocibindbyname($stmt, ':diff_time', abs($_row['DIFF_TIME']));
                         _ocibindbyname($stmt, ':total_diff_time', abs($_row['TOTAL_DIFF_TIME']));
                         _ocibindbyname($stmt, ':memory_max', $_row['MEMORY_MAX']);
                         _ocibindbyname($stmt, ':memory_total', $_row['MEMORY_TOTAL']);
                         _ocibindbyname($stmt, ':cpu_user_time_max', $_row['CPU_USER_TIME_MAX']);
                         _ocibindbyname($stmt, ':cpu_user_time_total', $_row['CPU_USER_TIME_TOTAL']);
                         _ocibindbyname($stmt, ':cpu_sys_time_max', $_row['CPU_SYS_TIME_MAX']);
                         _ocibindbyname($stmt, ':cpu_sys_time_total', $_row['CPU_SYS_TIME_TOTAL']);
                         $oci_error = _ociexecute($stmt);
                         print_r($oci_error);
                         _status(1, VHOST . "(PHPAPM)", "统计消耗", $_row['V1'], 'monitor_hour(update)', VIP);
                         $ocirowcount = ocirowcount($stmt);
                         if ($ocirowcount < 1) {
                             $sql = "insert into {$this->report_monitor_hour} (cal_date,v1,v2,v3,fun_count,diff_time,total_diff_time,memory_max,memory_total, cpu_user_time_max,cpu_user_time_total,cpu_sys_time_max,cpu_sys_time_total)\n                                            values (to_date(:cal_date,'yyyy-mm-dd hh24'),:v1,:v2,:v3,:fun_count,:diff_time,:total_diff_time, :memory_max,:memory_total, :cpu_user_time_max,:cpu_user_time_total,:cpu_sys_time_max,:cpu_sys_time_total) ";
                             $stmt = _ociparse($conn_db, $sql);
                             _ocibindbyname($stmt, ':v1', $v);
                             _ocibindbyname($stmt, ':v2', $_row['V1'] . '_' . $_row['V2']);
                             _ocibindbyname($stmt, ':v3', $_row['V3']);
                             _ocibindbyname($stmt, ':cal_date', $_row['CAL_DATE']);
                             _ocibindbyname($stmt, ':fun_count', $_row['FUN_COUNT']);
                             _ocibindbyname($stmt, ':diff_time', abs($_row['DIFF_TIME']));
                             _ocibindbyname($stmt, ':total_diff_time', abs($_row['TOTAL_DIFF_TIME']));
                             _ocibindbyname($stmt, ':memory_max', $_row['MEMORY_MAX']);
                             _ocibindbyname($stmt, ':memory_total', $_row['MEMORY_TOTAL']);
                             _ocibindbyname($stmt, ':cpu_user_time_max', $_row['CPU_USER_TIME_MAX']);
                             _ocibindbyname($stmt, ':cpu_user_time_total', $_row['CPU_USER_TIME_TOTAL']);
                             _ocibindbyname($stmt, ':cpu_sys_time_max', $_row['CPU_SYS_TIME_MAX']);
                             _ocibindbyname($stmt, ':cpu_sys_time_total', $_row['CPU_SYS_TIME_TOTAL']);
                             $oci_error = _ociexecute($stmt);
                             print_r($oci_error);
                             if ($oci_error) {
                                 $get_included_files = basename(array_shift(get_included_files()));
                                 _status(1, VHOST . "(BUG错误)", 'SQL错误', $get_included_files . '/' . $_GET['act'], var_export($oci_error, true) . "|" . var_export($_row, true));
                             } else {
                                 _status(1, VHOST . "(PHPAPM)", "统计消耗", $_row['V1'], 'hour', VIP);
                             }
                         }
                     }
                 }
             }
         }
     }
     //刷新一天的数据
     $sql = "select to_char(t.cal_date, 'yyyy-mm-dd') cal_date, t.v1, decode(t.v2,null,'null',v2) v2,\n                  sum(fun_count) fun_count,avg(fun_count) fun_count_avg from {$this->report_monitor_hour} t\n                  where cal_date >= to_date(:m_date,'yyyy-mm-dd') and cal_date<to_date(:m_date,'yyyy-mm-dd')+1 {$addwhere}\n                  group by t.v1, t.v2, to_char(t.cal_date, 'yyyy-mm-dd')";
     $stmt_list = _ociparse($conn_db, $sql);
     echo htmlspecialchars($sql);
     var_dump(date("Y-m-d", $hourtime));
     //print_r($_GET);
     _ocibindbyname($stmt_list, ':m_date', date("Y-m-d", $hourtime));
     if ($_GET['v1']) {
         _ocibindbyname($stmt_list, ':v1', $_GET['v1']);
     }
     if ($_GET['v2']) {
         _ocibindbyname($stmt_list, ':v2', $_GET['v2']);
     }
     $oci_error = _ociexecute($stmt_list);
     print_r($oci_error);
     $_row = array();
     while (ocifetchinto($stmt_list, $_row, OCI_ASSOC + OCI_RETURN_LOBS + OCI_RETURN_NULLS)) {
         //补全v1的信息
         $sql = "select * from {$this->report_monitor_v1} where v1=:v1  ";
         $stmt = _ociparse($conn_db, $sql);
         _ocibindbyname($stmt, ':v1', $_row['V1']);
         $oci_error = _ociexecute($stmt);
         print_r($oci_error);
         $_row_config = array();
         ocifetchinto($stmt, $_row_config, OCI_ASSOC + OCI_RETURN_LOBS + OCI_RETURN_NULLS);
         if (!$_row_config) {
             $sql = "insert into {$this->report_monitor_v1} (v1,id) values (:v1,seq_{$this->report_monitor}.nextval) ";
             $stmt = _ociparse($conn_db, $sql);
             _ocibindbyname($stmt, ':v1', $_row['V1']);
             $oci_error = _ociexecute($stmt);
             print_r($oci_error);
             _status(1, VHOST . "(PHPAPM)", "统计消耗", $_row['V1'], 'v1_config', VIP);
         }
         $_row_config = $this->all_config[$_row['V1'] . $_row['V2']];
         //如果是不累计的,重置总量为上个小时的总量
         if ($_row_config['DAY_COUNT_TYPE'] == 1 || $_row_config['DAY_COUNT_TYPE'] == 2 || $_row_config['DAY_COUNT_TYPE'] == 5 || $_row_config['DAY_COUNT_TYPE'] == 7) {
             //echo "只计算最后一小时\n";
             $sql2 = "select to_char(max(cal_date),'yyyy-mm-dd hh24:mi:ss') cal_date from\n                {$this->report_monitor_hour} where cal_date>=to_date(:cal_date,'yyyy-mm-dd')\n                and  cal_date<to_date(:cal_date,'yyyy-mm-dd')+1 and v1=:v1 and v2=:v2 ";
             $stmt2 = _ociparse($conn_db, $sql2);
             _ocibindbyname($stmt2, ':v1', $_row['V1']);
             _ocibindbyname($stmt2, ':v2', $_row['V2']);
             _ocibindbyname($stmt2, ':cal_date', $_row['CAL_DATE']);
             $oci_error2 = _ociexecute($stmt2);
             print_r($oci_error2);
             $_row2 = array();
             ocifetchinto($stmt2, $_row2, OCI_ASSOC + OCI_RETURN_LOBS + OCI_RETURN_NULLS);
             //print_r($_row2);
             $sql = "select  t.v1, t.v2,  sum(fun_count) fun_count,avg(fun_count) fun_count_avg\n \t\t\tfrom  {$this->report_monitor_hour} t where cal_date=to_date(:cal_date,'yyyy-mm-dd hh24:mi:ss')\n                    and v1=:v1 and v2=:v2  group by t.v1, t.v2";
             $stmt = _ociparse($conn_db, $sql);
             _ocibindbyname($stmt, ':v1', $_row['V1']);
             _ocibindbyname($stmt, ':v2', $_row['V2']);
             _ocibindbyname($stmt, ':cal_date', $_row2['CAL_DATE']);
             $oci_error = _ociexecute($stmt);
             print_r($oci_error);
             $_row2 = array();
             ocifetchinto($stmt, $_row2, OCI_ASSOC + OCI_RETURN_LOBS + OCI_RETURN_NULLS);
             $_row['FUN_COUNT'] = $_row2['FUN_COUNT'];
             //v3个数
             if ($_row_config['DAY_COUNT_TYPE'] == 7) {
                 //echo "计算V3个数\n";
                 $sql = "select  count(distinct(t.v3)) num\n \t\t\tfrom  {$this->report_monitor_hour} t where cal_date>=to_date(:cal_date,'yyyy-mm-dd')\n                    and v1=:v1 and v2=:v2";
                 $stmt = _ociparse($conn_db, $sql);
                 _ocibindbyname($stmt, ':v1', $_row['V1']);
                 _ocibindbyname($stmt, ':v2', $_row['V2']);
                 _ocibindbyname($stmt, ':cal_date', $_row['CAL_DATE']);
                 $oci_error = _ociexecute($stmt);
                 print_r($oci_error);
                 ocifetchinto($stmt, $_row2, OCI_ASSOC + OCI_RETURN_LOBS + OCI_RETURN_NULLS);
                 $_row['FUN_COUNT'] = $_row2['NUM'];
                 //echo " num:{$_row['FUN_COUNT']} \n";
             }
             //最后一小时的平均值
             if ($_row_config['DAY_COUNT_TYPE'] == 5) {
                 $_row['FUN_COUNT'] = $_row2['FUN_COUNT_AVG'];
             }
         }
         //当天的平均数
         if ($_row_config['DAY_COUNT_TYPE'] == 6) {
             $_row['FUN_COUNT'] = $_row['FUN_COUNT_AVG'];
         }
         //print_r($_row);
         //echo " num:{$_row['FUN_COUNT']} \n";
         $sql = "update {$this->report_monitor_date} set fun_count=:fun_count\n              where v1=:v1 and v2=:v2 and cal_date=to_date(:cal_date,'yyyy-mm-dd') ";
         $stmt2 = _ociparse($conn_db, $sql);
         _ocibindbyname($stmt2, ':v1', $_row['V1']);
         _ocibindbyname($stmt2, ':v2', $_row['V2']);
         _ocibindbyname($stmt2, ':cal_date', $_row['CAL_DATE']);
         _ocibindbyname($stmt2, ':fun_count', $_row['FUN_COUNT']);
         $oci_error = _ociexecute($stmt2);
         print_r($oci_error);
         _status(1, VHOST . "(PHPAPM)", "统计消耗", $_row['V1'], 'monitor_date(update)', VIP);
         $_row_count = ocirowcount($stmt2);
         if (!$_row_count) {
             $sql = "insert into {$this->report_monitor_date} (cal_date,v1,v2,fun_count) values\n                    (to_date(:cal_date,'yyyy-mm-dd'),:v1,:v2,:fun_count) ";
             $stmt = _ociparse($conn_db, $sql);
             _ocibindbyname($stmt, ':v1', $_row['V1']);
             _ocibindbyname($stmt, ':v2', $_row['V2']);
             _ocibindbyname($stmt, ':cal_date', $_row['CAL_DATE']);
             _ocibindbyname($stmt, ':fun_count', $_row['FUN_COUNT']);
             $oci_error = _ociexecute($stmt);
             print_r($oci_error);
             _status(1, VHOST . "(PHPAPM)", "统计消耗", $_row['V1'], 'date', VIP);
         }
         $compare_group = array_filter(explode('|', '|' . $_row_config['COMPARE_GROUP']));
         if (count($compare_group) > 0) {
             foreach ($compare_group as $v) {
                 $sql = "update {$this->report_monitor_date} set fun_count=:fun_count\n                                  where v1=:v1 and v2=:v2 and cal_date=to_date(:cal_date,'yyyy-mm-dd') ";
                 $stmt2 = _ociparse($conn_db, $sql);
                 _ocibindbyname($stmt2, ':v1', $v);
                 _ocibindbyname($stmt2, ':v2', $_row['V1'] . '_' . $_row['V2']);
                 _ocibindbyname($stmt2, ':cal_date', $_row['CAL_DATE']);
                 _ocibindbyname($stmt2, ':fun_count', $_row['FUN_COUNT']);
                 $oci_error = _ociexecute($stmt2);
                 print_r($oci_error);
                 _status(1, VHOST . "(PHPAPM)", "统计消耗", $_row['V1'], 'monitor_date(update)', VIP);
                 $_row_count = ocirowcount($stmt2);
                 if (!$_row_count) {
                     $sql = "insert into {$this->report_monitor_date} (cal_date,v1,v2,fun_count) values\n                    (to_date(:cal_date,'yyyy-mm-dd'),:v1,:v2,:fun_count) ";
                     $stmt = _ociparse($conn_db, $sql);
                     _ocibindbyname($stmt, ':v1', $v);
                     _ocibindbyname($stmt, ':v2', $_row['V1'] . '_' . $_row['V2']);
                     _ocibindbyname($stmt, ':cal_date', $_row['CAL_DATE']);
                     _ocibindbyname($stmt, ':fun_count', $_row['FUN_COUNT']);
                     $oci_error = _ociexecute($stmt);
                     print_r($oci_error);
                     _status(1, VHOST . "(PHPAPM)", "统计消耗", $_row['V1'], 'date', VIP);
                 }
             }
         }
         if (!$_row_config) {
             $sql = "select count(*) c from {$this->report_monitor_config} where v1=:v1 ";
             $stmt = _ociparse($conn_db, $sql);
             _ocibindbyname($stmt, ':v1', $_row['V1']);
             $oci_error = _ociexecute($stmt);
             print_r($oci_error);
             $_row2 = array();
             ocifetchinto($stmt, $_row2, OCI_ASSOC + OCI_RETURN_LOBS + OCI_RETURN_NULLS);
             $sql = "select * from {$this->report_monitor_v1} where  v1=:v1 ";
             $stmt = _ociparse($conn_db, $sql);
             _ocibindbyname($stmt, ':v1', $_row['V1']);
             $oci_error = _ociexecute($stmt);
             print_r($oci_error);
             $_row3 = array();
             ocifetchinto($stmt, $_row3, OCI_ASSOC + OCI_RETURN_LOBS + OCI_RETURN_NULLS);
             $sql = "insert into  {$this->report_monitor_config} (v1,v2,orderby,id,day_count_type,hour_count_type,percent_count_type)\n                values (:v1,:v2,:orderby,seq_{$this->report_monitor}.nextval,:day_count_type,:hour_count_type,:percent_count_type) ";
             $stmt = _ociparse($conn_db, $sql);
             _ocibindbyname($stmt, ':v1', $_row['V1']);
             _ocibindbyname($stmt, ':v2', $_row['V2']);
             _ocibindbyname($stmt, ':day_count_type', intval($_row3['DAY_COUNT_TYPE']));
             _ocibindbyname($stmt, ':hour_count_type', intval($_row3['HOUR_COUNT_TYPE']));
             _ocibindbyname($stmt, ':percent_count_type', intval($_row3['PERCENT_COUNT_TYPE']));
             if ($_row['V2'] == '汇总') {
                 _ocibindbyname($stmt, ':orderby', intval(0));
             } else {
                 _ocibindbyname($stmt, ':orderby', max(1, $_row2['C'] + 1));
             }
             $oci_error = _ociexecute($stmt);
             print_r($oci_error);
             _status(1, VHOST . "(PHPAPM)", "统计消耗", $_row['V1'], 'config', VIP);
         }
     }
     //清除过期数据
     if ($_GET['del'] && rand(1, 10) == 1) {
         $sql = "delete from  {$this->report_monitor} where cal_date<=sysdate-10 ";
         $stmt_list = _ociparse($conn_db, $sql);
         $oci_error = _ociexecute($stmt_list);
         print_r($oci_error);
     }
 }
示例#16
0
 /**
  * Returns number of affected rows in previous database operation. If no previous operation exists, this returns false.
  *
  * @return int Number of affected rows
  * @access public
  */
 function lastAffected()
 {
     return $this->_statementId ? ocirowcount($this->_statementId) : false;
 }
<?php

$sqlPcpApontamentoEmpenho = mysql_query("SELECT PCP_APONTAMENTO_EMPENHO.CO_PCP_APONTAMENTO_EMPENHO\r\n\t\t\t\t\t\t\t\t\t\t\t\t , DATE_FORMAT(PCP_APONTAMENTO_EMPENHO.DT_APONTAMENTO_EMPENHO, '%Y%m%d') AS DT_APONTAMENTO_EMPENHO\r\n\t\t\t\t\t\t\t\t\t\t\t     , PCP_APONTAMENTO_EMPENHO.CO_PCP_OP\r\n\t\t\t\t\t\t\t\t\t\t\t     , CONCAT(PCP_OP.CO_NUM, PCP_OP.CO_ITEM, PCP_OP.CO_SEQUENCIA) AS NU_OP\r\n\t\t\t\t\t\t\t\t\t\t\t     , PCP_APONTAMENTO_EMPENHO.NU_ARMAZEM\r\n\t\t\t\t\t\t\t\t\t\t\t\t , PCP_APONTAMENTO_EMPENHO.CO_PRODUTO_ORIGEM\r\n\t\t\t\t\t\t\t\t\t\t\t\t , PCP_APONTAMENTO_EMPENHO.QTD_EMPENHO_ORIGEM\r\n\t\t\t\t\t\t\t\t\t\t\t\t , PCP_APONTAMENTO_EMPENHO.SALDO_EMPENHO_ORIGEM\r\n\t\t\t\t\t\t\t\t\t\t\t\t , PCP_APONTAMENTO_EMPENHO.CO_PRODUTO_DESTINO\r\n\t\t\t\t\t\t\t\t\t\t\t\t , CASE WHEN PCP_ESTRUTURA.NU_SEQ_COMPONENTE = ' ' THEN ' '\r\n\t\t\t\t\t\t\t\t\t\t\t\t        WHEN PCP_ESTRUTURA.NU_SEQ_COMPONENTE = '' THEN ' '\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHEN PCP_ESTRUTURA.NU_SEQ_COMPONENTE IS NULL THEN ' '\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tELSE 'ERRO'\r\n\t\t\t\t\t\t\t\t\t\t\t       END AS NU_SEQ_COMPONENTE\r\n\t\t\t\t\t\t\t\t\t\t\t\t , PCP_APONTAMENTO_EMPENHO.QTD_EMPENHO_DESTINO\r\n\t\t\t\t\t\t\t\t\t\t\t\t , PCP_APONTAMENTO_EMPENHO.SALDO_EMPENHO_DESTINO\r\n\t\t\t\t\t\t\t\t\t\t\t\t , PCP_APONTAMENTO_EMPENHO.CO_PCP_APONTAMENTO\r\n\t\t\t\t\t\t\t\t\t\t     FROM tb_pcp_apontamento_empenho PCP_APONTAMENTO_EMPENHO\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t     INNER JOIN tb_pcp_op PCP_OP\r\n\t\t\t\t\t\t\t\t\t\t\t\t     ON PCP_OP.CO_PCP_OP = PCP_APONTAMENTO_EMPENHO.CO_PCP_OP\r\n\t\t\t\t\t\t\t\t\t\t\t\t     AND PCP_OP.FL_DELET IS NULL\r\n\t\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t\t LEFT JOIN tb_pcp_estrutura PCP_ESTRUTURA\r\n\t\t\t\t\t\t\t\t\t\t\t\t     ON PCP_ESTRUTURA.CO_PRODUTO = PCP_OP.CO_PRODUTO\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t AND PCP_ESTRUTURA.CO_COMPONENTE = PCP_APONTAMENTO_EMPENHO.CO_PRODUTO_DESTINO\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t WHERE PCP_APONTAMENTO_EMPENHO.FL_SINCRONISMO IS NULL\r\n\t\t\t\t\t\t\t\t\t\t\t AND PCP_APONTAMENTO_EMPENHO.FL_DELET IS NULL\r\n\t\t\t\t\t\t\t\t\t\t     ORDER BY PCP_APONTAMENTO_EMPENHO.CO_PCP_APONTAMENTO_EMPENHO", $conexaoExtranet) or die(mysql_error());
if (mysql_num_rows($sqlPcpApontamentoEmpenho) > 0) {
    while ($rowPcpApontamentoEmpenho = mysql_fetch_array($sqlPcpApontamentoEmpenho)) {
        $sqlVerificaIntegracaoTotvsApontamento = ociparse($totvsConexao, "SELECT ZP1_XCODEX FROM ZP1010 WHERE ZP1_XCODEX = '" . $rowPcpApontamentoEmpenho['CO_PCP_APONTAMENTO_EMPENHO'] . "'");
        ociexecute($sqlVerificaIntegracaoTotvsApontamento);
        if (ocirowcount($sqlVerificaIntegracaoTotvsApontamento) == null) {
            //INICIO CAPTURA O CODIGO DO ULTIMO R_E_C_N_O_ DA TABELA
            $sqlIntegracaoTotvsRecno = ociparse($totvsConexao, "SELECT MAX(R_E_C_N_O_) AS R_E_C_N_O FROM ZP1010");
            ociexecute($sqlIntegracaoTotvsRecno);
            $rowIntegracaoTotvsRecno = oci_fetch_array($sqlIntegracaoTotvsRecno);
            if ($rowIntegracaoTotvsRecno['R_E_C_N_O'] > 0) {
                $recnoIntegracaoApontamento = $rowIntegracaoTotvsRecno['R_E_C_N_O'] + 1;
            } else {
                $recnoIntegracaoApontamento = 1;
            }
            //FIM CAPTURA O CODIGO DO ULTIMO R_E_C_N_O_ DA TABELA
            //INICIO CAPTURA O CODIGO Da ULTIMA INTEGRACAO DA TABELA
            $sqlIntegracaoTotvsCodigoIntegracao = ociparse($totvsConexao, "SELECT MAX(ZP1_XCOINT) AS ZP1_XCOINT FROM ZP1010");
            ociexecute($sqlIntegracaoTotvsCodigoIntegracao);
            $rowIntegracaoTotvsCodigoIntegracao = oci_fetch_array($sqlIntegracaoTotvsCodigoIntegracao);
            if ($rowIntegracaoTotvsCodigoIntegracao['ZP1_XCOINT'] > 0) {
                $codigoIntegracaoApontamento = $rowIntegracaoTotvsCodigoIntegracao['ZP1_XCOINT'] + 1;
            } else {
                $codigoIntegracaoApontamento = 1;
            }
            //FIM CAPTURA O CODIGO DA ULTIMA INTEGRACAO DA TABELA
            $dataCadastro = date("Ymd");
            $horaCadastro = date("h:i:s");
            $tipoApontamento = '1';
示例#18
0
 /**
  * Affected Rows
  *
  * @access  public
  * @return  integer
  */
 function affected_rows()
 {
     return @ocirowcount($this->stmt_id);
 }
function da_sql_affected_rows($link, $statement, $config)
{
    if ($config[sql_debug] == 'true') {
        print "<b>DEBUG(SQL,OCI DRIVER): Query Result: Affected rows:: " . @ocirowcount($statement) . "</b><br>\n";
    }
    return @ocirowcount($statement);
}
 /**
  *	This function will return the number of rows matched by the SQL query.
  *
  *	@param $sql	The SQL statement to use.
  *
  *	@returns	The number of rows matched by the SQL query.
  *
  *  @remark     Don't use this for SQL select statements as the returned value will not be correct.
  */
 function getMatchedRowsNum($sql)
 {
     $result = $this->_connectAndExec($sql);
     return ocirowcount($result);
 }
ocidefinebyname();
ocierror();
ociexecute();
ocifetch();
ocifetchinto();
ocifetchstatement();
ocifreecollection();
ocifreecursor();
ocifreedesc();
ocifreestatement();
ociinternaldebug();
ociloadlob();
ocilogoff();
ocilogon();
ocinewcollection();
ocinewcursor();
ocinewdescriptor();
ocinlogon();
ocinumcols();
ociparse();
ociplogon();
ociresult();
ocirollback();
ocirowcount();
ocisavelob();
ocisavelobfile();
ociserverversion();
ocisetprefetch();
ocistatementtype();
ociwritelobtofile();
ociwritetemporarylob();