当前位置: 首页>>代码示例>>PHP>>正文


PHP ARC2::mtime方法代码示例

本文整理汇总了PHP中ARC2::mtime方法的典型用法代码示例。如果您正苦于以下问题:PHP ARC2::mtime方法的具体用法?PHP ARC2::mtime怎么用?PHP ARC2::mtime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ARC2的用法示例。


在下文中一共展示了ARC2::mtime方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: query

 function query($q, $result_format = '', $src = '', $keep_bnode_ids = 0, $log_query = 0)
 {
     if ($log_query) {
         $this->logQuery($q);
     }
     ARC2::inc('SPARQLPlusParser');
     $p =& new ARC2_SPARQLPlusParser($this->a, $this);
     $p->parse($q, $src);
     $infos = $p->getQueryInfos();
     $t1 = ARC2::mtime();
     if (!($errs = $p->getErrors())) {
         $qt = $infos['query']['type'];
         $r = array('query_type' => $qt, 'result' => $this->runQuery($q, $qt, $infos));
     } else {
         $r = array('result' => '');
     }
     $t2 = ARC2::mtime();
     $r['query_time'] = $t2 - $t1;
     /* query result */
     if ($result_format == 'raw') {
         return $r['result'];
     }
     if ($result_format == 'rows') {
         return $this->v('rows', array(), $r['result']);
     }
     if ($result_format == 'row') {
         if (!isset($r['result']['rows'])) {
             return array();
         }
         return $r['result']['rows'] ? $r['result']['rows'][0] : array();
     }
     return $r;
 }
开发者ID:scor,项目名称:rdf,代码行数:33,代码来源:ARC2_RemoteStore.php

示例2: runQuery

 function runQuery($infos)
 {
     $this->infos = $infos;
     $con = $this->store->getDBCon();
     $t1 = ARC2::mtime();
     /* delete */
     $this->refs_deleted = false;
     /* graph(s) only */
     if (!$this->v('construct_triples', array(), $this->infos['query'])) {
         $tc = $this->deleteTargetGraphs();
     } elseif (!$this->v('pattern', array(), $this->infos['query'])) {
         $tc = $this->deleteTriples();
     } else {
         $tc = $this->deleteConstructedGraph();
     }
     $t2 = ARC2::mtime();
     /* clean up */
     if ($tc && ($this->refs_deleted || rand(1, 100) == 1)) {
         $this->cleanTableReferences();
     }
     if ($tc && rand(1, 50) == 1) {
         $this->store->optimizeTables();
     }
     if ($tc && rand(1, 500) == 1) {
         $this->cleanValueTables();
     }
     $t3 = ARC2::mtime();
     $index_dur = round($t3 - $t2, 4);
     $dur = round($t3 - $t1, 4);
     return array('t_count' => $tc, 'delete_time' => $dur, 'index_update_time' => $index_dur);
 }
开发者ID:portokallidis,项目名称:Metamorphosis-Meducator,代码行数:31,代码来源:ARC2_StoreDeleteQueryHandler.php

示例3: testBlockUpdateWithoutGraph

 public function testBlockUpdateWithoutGraph()
 {
     global $prefixSparql, $graph1;
     $q = $prefixSparql . " \n\t\t\tINSERT DATA { \n\t\t\t\ta:A b:Name \"Test2\" . \n    \t\t}";
     $p = ARC2::getSPARQLPlusParser();
     $p->parse($q);
     $infos = $p->getQueryInfos();
     $t1 = ARC2::mtime();
     $err = $p->getErrors();
     if ($err) {
         print_r($err);
         $this->assertTrue(true);
     } else {
         $this->assertTrue(false);
     }
     $q = $prefixSparql . " \n\t\t\tDELETE DATA { \n\t\t\t\ta:A b:Name \"Test2\" . \n    \t\t}";
     $p = ARC2::getSPARQLPlusParser();
     $p->parse($q);
     $infos = $p->getQueryInfos();
     $t1 = ARC2::mtime();
     $err = $p->getErrors();
     if ($err) {
         print_r($err);
         $this->assertTrue(true);
     } else {
         $this->assertTrue(false);
     }
 }
开发者ID:BorderCloud,项目名称:arc2,代码行数:28,代码来源:ARC2_SPARQLParserTest.php

示例4: query

 function query($q, $result_format = '', $src = '', $keep_bnode_ids = 0, $log_query = 0)
 {
     if ($log_query) {
         $this->logQuery($q);
     }
     $con = $this->getDBCon();
     if (preg_match('/^dump/i', $q)) {
         $infos = array('query' => array('type' => 'dump'));
     } else {
         ARC2::inc('SPARQLPlusParser');
         $p =& new ARC2_SPARQLPlusParser($this->a, $this);
         $p->parse($q, $src);
         $infos = $p->getQueryInfos();
     }
     if ($result_format == 'infos') {
         return $infos;
     }
     $infos['result_format'] = $result_format;
     if (!isset($p) || !$p->getErrors()) {
         $qt = $infos['query']['type'];
         if (!in_array($qt, array('select', 'ask', 'describe', 'construct', 'load', 'insert', 'delete', 'dump'))) {
             return $this->addError('Unsupported query type "' . $qt . '"');
         }
         $t1 = ARC2::mtime();
         $r = array('query_type' => $qt, 'result' => $this->runQuery($infos, $qt, $keep_bnode_ids, $q));
         $t2 = ARC2::mtime();
         $r['query_time'] = $t2 - $t1;
         /* query result */
         if ($result_format == 'raw') {
             return $r['result'];
         }
         if ($result_format == 'rows') {
             return $r['result']['rows'] ? $r['result']['rows'] : array();
         }
         if ($result_format == 'row') {
             return $r['result']['rows'] ? $r['result']['rows'][0] : array();
         }
         return $r;
     }
     return 0;
 }
开发者ID:benblamey,项目名称:cmu-teaching-php,代码行数:41,代码来源:ARC2_Store.php

示例5: handleQueryRequest

 function handleQueryRequest($q)
 {
     if (preg_match('/^dump/i', $q)) {
         $infos = array('query' => array('type' => 'dump'));
         $this->is_dump = 1;
     } else {
         ARC2::inc('SPARQLPlusParser');
         $p = new ARC2_SPARQLPlusParser($this->a, $this);
         $p->parse($q);
         $infos = $p->getQueryInfos();
     }
     /* errors? */
     if ($errors = $this->getErrors()) {
         $this->setHeader('http', 'HTTP/1.1 400 Bad Request');
         $this->setHeader('content-type', 'Content-type: text/plain; charset=utf-8');
         $this->result = htmlspecialchars(join("\n", $errors));
         return true;
     }
     $qt = $infos['query']['type'];
     /* wrong read key? */
     if ($this->read_key && $this->p('key') != $this->read_key && preg_match('/^(select|ask|construct|describe|dump)$/', $qt)) {
         $this->setHeader('http', 'HTTP/1.1 401 Access denied');
         $this->setHeader('content-type', 'Content-type: text/plain; charset=utf-8');
         $this->result = 'Access denied. Missing or wrong "key" parameter.';
         return true;
     }
     /* wrong write key? */
     if ($this->write_key && $this->p('key') != $this->write_key && preg_match('/^(load|insert|delete|update)$/', $qt)) {
         $this->setHeader('http', 'HTTP/1.1 401 Access denied');
         $this->setHeader('content-type', 'Content-type: text/plain; charset=utf-8');
         $this->result = 'Access denied. Missing or wrong "key" parameter.';
         return true;
     }
     /* non-allowed query type? */
     if (!in_array($qt, $this->getFeatures())) {
         $this->setHeader('http', 'HTTP/1.1 401 Access denied');
         $this->setHeader('content-type', 'Content-type: text/plain; charset=utf-8');
         $this->result = 'Access denied for "' . $qt . '" query';
         return true;
     }
     /* load/insert/delete via GET */
     if (in_array($qt, array('load', 'insert', 'delete')) && isset($_GET['query'])) {
         $this->setHeader('http', 'HTTP/1.1 501 Not Implemented');
         $this->setHeader('content-type', 'Content-type: text/plain; charset=utf-8');
         $this->result = 'Query type "' . $qt . '" not supported via GET';
         return true;
     }
     /* unsupported query type */
     if (!in_array($qt, array('select', 'ask', 'describe', 'construct', 'load', 'insert', 'delete', 'dump'))) {
         $this->setHeader('http', 'HTTP/1.1 501 Not Implemented');
         $this->setHeader('content-type', 'Content-type: text/plain; charset=utf-8');
         $this->result = 'Unsupported query type "' . $qt . '"';
         return true;
     }
     /* adjust infos */
     $infos = $this->adjustQueryInfos($infos);
     $t1 = ARC2::mtime();
     $r = array('result' => $this->runQuery($infos, $qt));
     $t2 = ARC2::mtime();
     $r['query_time'] = $t2 - $t1;
     /* query errors? */
     if ($errors = $this->getErrors()) {
         $this->setHeader('http', 'HTTP/1.1 400 Bad Request');
         $this->setHeader('content-type', 'Content-type: text/plain; charset=utf-8');
         $this->result = 'Error: ' . join("\n", $errors);
         return true;
     }
     /* result */
     $m = 'get' . ucfirst($qt) . 'ResultDoc';
     if (method_exists($this, $m)) {
         $this->result = $this->{$m}($r);
     } else {
         $this->setHeader('content-type', 'Content-type: text/plain; charset=utf-8');
         $this->result = 'Result serializer not available, dumping raw data:' . "\n" . print_r($r, 1);
     }
 }
开发者ID:johnulist,项目名称:arc2,代码行数:76,代码来源:ARC2_StoreEndpoint.php

示例6: queryDB

 function queryDB($sql, $con, $log_errors = 0)
 {
     $t1 = ARC2::mtime();
     $r = mysql_query($sql, $con);
     $t2 = ARC2::mtime() - $t1;
     if ($t2 > 1) {
         //echo "\n needed " . $t2 . ' secs for ' . $sql;
     }
     if ($log_errors && ($er = mysql_error($con))) {
         $this->addError($er);
     }
     return $r;
 }
开发者ID:dmj,项目名称:uni-helmstedt.hab.de,代码行数:13,代码来源:ARC2_Class.php

示例7: queryDB

 function queryDB($sql, $con, $log_errors = 0)
 {
     $t1 = ARC2::mtime();
     $r = mysqli_query($con, $sql);
     if (0) {
         $t2 = ARC2::mtime() - $t1;
         $call_obj = $this;
         $call_path = '';
         while ($call_obj) {
             $call_path = get_class($call_obj) . ' / ' . $call_path;
             $call_obj = isset($call_obj->caller) ? $call_obj->caller : false;
         }
         echo "\n" . $call_path . " needed " . $t2 . ' secs for ' . str_replace("\n", ' ', $sql);
     }
     $er = mysqli_error($con);
     if ($log_errors && !empty($er)) {
         $this->addError($er);
     }
     return $r;
 }
开发者ID:johnulist,项目名称:arc2,代码行数:20,代码来源:ARC2_Class.php

示例8: logInserts

 function logInserts()
 {
     $t_start = $this->t_start;
     $t_prev = $this->t_prev;
     $t_now = ARC2::mtime();
     $tc_prev = $this->t_count_prev;
     $tc_now = $this->t_count;
     $tc_diff = $tc_now - $tc_prev;
     $dur_full = $t_now - $t_start;
     $dur_diff = $t_now - $t_prev;
     $speed_full = round($tc_now / $dur_full);
     $speed_now = round($tc_diff / $dur_diff);
     $r = $tc_diff . ' in ' . round($dur_diff, 5) . ' = ' . $speed_now . ' t/s  (' . $tc_now . ' in ' . round($dur_full, 5) . ' = ' . $speed_full . ' t/s )';
     $fp = @fopen("arc_insert_log.txt", "a");
     @fwrite($fp, $r . "\r\n");
     @fclose($fp);
     $this->t_prev = $t_now;
     $this->t_count_prev = $tc_now;
 }
开发者ID:scf,项目名称:scf,代码行数:19,代码来源:ARC2_StoreLoadQueryHandler.php

示例9: getFinalQueryResult

 function getFinalQueryResult($q_sql, $tmp_tbl)
 {
     /* var names */
     $vars = array();
     $aggregate_vars = array();
     foreach ($this->infos['query']['result_vars'] as $entry) {
         if ($entry['aggregate']) {
             $vars[] = $entry['alias'];
             $aggregate_vars[] = $entry['alias'];
         } else {
             $vars[] = $entry['var'];
         }
     }
     /* result */
     $r = array('variables' => $vars);
     $v_sql = $this->getValueSQL($tmp_tbl, $q_sql);
     //echo "\n\n" . $v_sql;
     $t1 = ARC2::mtime();
     $con = $this->store->getDBCon();
     $rs = mysql_unbuffered_query($v_sql, $con);
     if ($er = mysql_error($con)) {
         $this->addError($er);
     }
     $t2 = ARC2::mtime();
     $rows = array();
     $types = array(0 => 'uri', 1 => 'bnode', 2 => 'literal');
     if ($rs) {
         while ($pre_row = mysql_fetch_array($rs)) {
             $row = array();
             foreach ($vars as $var) {
                 if (isset($pre_row[$var])) {
                     $row[$var] = $pre_row[$var];
                     $row[$var . ' type'] = isset($pre_row[$var . ' type']) ? $types[$pre_row[$var . ' type']] : (in_array($var, $aggregate_vars) ? 'literal' : 'uri');
                     if (isset($pre_row[$var . ' lang_dt']) && ($lang_dt = $pre_row[$var . ' lang_dt'])) {
                         if (preg_match('/^([a-z]+(\\-[a-z0-9]+)*)$/i', $lang_dt)) {
                             $row[$var . ' lang'] = $lang_dt;
                         } else {
                             $row[$var . ' datatype'] = $lang_dt;
                         }
                     }
                 }
             }
             if ($row || !$vars) {
                 $rows[] = $row;
             }
         }
     }
     $r['rows'] = $rows;
     return $r;
 }
开发者ID:jifengmao,项目名称:visualRDF,代码行数:50,代码来源:ARC2_StoreSelectQueryHandler.php

示例10: FourStore_StorePlus

 /**
 * Check, send a request SPARQL and parse the response. Example of using :
 	$sp_readonly = new FourStore_StorePlus($endpoint);
 
 	echo "\nPrint :";
     $q = "select * where { GRAPH <http://example.com> {?x ?y ?z.}} ";
     $rows = $sp_readonly->query($q, 'rows');
     $err = $sp_readonly->getErrors();
     if ($err) {
    print_r($err);
    throw new Exception(print_r($err,true));
 	}
 	var_dump($rows);
 
 	echo "\nASK  :";
     $q = 	"PREFIX a: <http://example.com/test/a/>
 			PREFIX b: <http://example.com/test/b/>
 			ask where { GRAPH <http://example.com> {a:A b:Name \"Test3\" .}} ";
     $res = $sp_readonly->query($q, 'raw');
     $err = $sp_readonly->getErrors();
     if ($err) {
    print_r($err);
    throw new Exception(print_r($err,true));
 	}
 	var_dump($res);
 
 * @param string $query : Query Sparql
 * @param $q Query SPARQL
 * @param  $result_format Optional,
 * rows to return array of results or
 * row to return array of first result or
 * raw to return boolean for request ask, insert and delete
 * @return array|boolean in function of parameter $result_format
 * @access public
 */
 public function query($q, $result_format = '')
 {
     if ($this->_debug) {
         print date('Y-m-d\\TH:i:s\\Z', time()) . ' : ' . $q . '' . "\n\n";
     }
     $p = new FourStore_SPARQLParser('', $this);
     $p->parse($q);
     $infos = $p->getQueryInfos();
     $t1 = ARC2::mtime();
     if (!($errs = $p->getErrors())) {
         $qt = $infos['query']['type'];
         $r = array('query_type' => $qt, 'result' => $this->runQuery($q, $qt, $infos));
     } else {
         $r = array('result' => '');
         if ($this->_debug) {
             print date('Y-m-d\\TH:i:s\\Z', time()) . ' : ERROR ' . $q . '' . "\n\n";
             print_r($errs);
         }
         return $this->_arc2_RemoteStore->addError($p->getErrors());
     }
     $t2 = ARC2::mtime();
     $r['query_time'] = $t2 - $t1;
     /* query result */
     if ($result_format == 'raw') {
         return $r['result'];
     }
     if ($result_format == 'rows') {
         return $this->_arc2_RemoteStore->v('rows', array(), $r['result']);
     }
     if ($result_format == 'row') {
         if (!isset($r['result']['rows'])) {
             return array();
         }
         return $r['result']['rows'] ? $r['result']['rows'][0] : array();
     }
     return $r;
 }
开发者ID:klaffenboeck,项目名称:contextus,代码行数:72,代码来源:FourStore_StorePlus.php

示例11: testMtime

 public function testMtime()
 {
     $actual = ARC2::mtime();
     $this->assertTrue(is_float($actual));
 }
开发者ID:neumann89,项目名称:FUB-xml-project6-2013,代码行数:5,代码来源:ARC2_Test.php

示例12: getFinalQueryResult

 function getFinalQueryResult($q_sql, $vars, $tmp_tbl, $aggregate_vars = '')
 {
     $aggregate_vars = $aggregate_vars ? $aggregate_vars : array();
     $r = array('variables' => $vars);
     $v_sql = $this->getValueSQL($tmp_tbl);
     $t1 = ARC2::mtime();
     $con = $this->store->getDBCon();
     $rs = mysql_unbuffered_query($v_sql);
     if ($er = mysql_error()) {
         $this->addError($er);
     }
     $t2 = ARC2::mtime();
     $rows = array();
     $types = array(0 => 'uri', 1 => 'bnode', 2 => 'literal');
     if ($rs) {
         while ($pre_row = mysql_fetch_array($rs)) {
             $row = array();
             foreach ($vars as $var) {
                 if (isset($pre_row[$var])) {
                     $row[$var] = $pre_row[$var];
                     $row[$var . ' type'] = isset($pre_row[$var . ' type']) ? $types[$pre_row[$var . ' type']] : (in_array($var, $aggregate_vars) ? 'literal' : 'uri');
                     if (isset($pre_row[$var . ' lang_dt']) && ($lang_dt = $pre_row[$var . ' lang_dt'])) {
                         if (preg_match('/^([a-z]+(\\-[a-z0-9]+)*)$/i', $lang_dt)) {
                             $row[$var . ' lang'] = $lang_dt;
                         } else {
                             $row[$var . ' datatype'] = $lang_dt;
                         }
                     }
                 }
             }
             if ($row) {
                 $rows[] = $row;
             }
         }
     }
     $r['rows'] = $rows;
     return $r;
 }
开发者ID:helenadeus,项目名称:s3db.map,代码行数:38,代码来源:ARC2_StoreSelectQueryHandler.php


注:本文中的ARC2::mtime方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。