當前位置: 首頁>>代碼示例>>PHP>>正文


PHP scraperwiki::sqlitecommand方法代碼示例

本文整理匯總了PHP中scraperwiki::sqlitecommand方法的典型用法代碼示例。如果您正苦於以下問題:PHP scraperwiki::sqlitecommand方法的具體用法?PHP scraperwiki::sqlitecommand怎麽用?PHP scraperwiki::sqlitecommand使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在scraperwiki的用法示例。


在下文中一共展示了scraperwiki::sqlitecommand方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: table_info

 static function table_info($name)
 {
     $sname = explode(".", $name);
     if (count($sname) == 2) {
         $result = scraperwiki::sqlitecommand("execute", "PRAGMA " . $sname[0] . ".table_info(`" . $sname[1] . "`)");
     } else {
         $result = scraperwiki::sqlitecommand("execute", "PRAGMA table_info(`" . $name . "`)");
     }
     $res = array();
     foreach ($result->data as $i => $row) {
         array_push($res, array_combine($result->keys, $row));
     }
     return $res;
 }
開發者ID:rishabmps,項目名稱:extraction-framework,代碼行數:14,代碼來源:scraperwiki.php

示例2: array

$key = array('year', 'month', 'day', 'hour');
foreach ($data as $row) {
    $newData = array();
    foreach ($row as $k => $value) {
        $newData[$k] = $value;
    }
    scraperwiki::save_sqlite($key, $data);
}
#$sql="SELECT name FROM sqlite_master WHERE type='table' ORDER BY name;";
#$x = scraperwiki::sqlitecommand("execute", $sql);
#print_r($x);
$sql = "SELECT count(*) as number FROM swdata;";
$x = scraperwiki::sqlitecommand("execute", $sql);
echo "rows:" . $x->data[0][0] . "<br/>\n";
$sql = "SELECT COUNT(*) as n, MAX(direction) as d FROM swdata GROUP BY direction;";
$x = scraperwiki::sqlitecommand("execute", $sql);
$x = $x->data;
echo "totals by direction:";
foreach ($x as $row) {
    foreach ($row as $cell) {
        echo $cell . " ";
    }
    echo ",";
}
echo "<br/>\n";
$sql = "SELECT COUNT(*) as n, MAX(hour) as h FROM swdata WHERE direction='N' GROUP BY hour;";
$x = scraperwiki::sqliteexecute($sql);
$x = $x->data;
echo "N totals by hour:";
foreach ($x as $row) {
    foreach ($row as $cell) {
開發者ID:flyeven,項目名稱:scraperwiki-scraper-vault,代碼行數:31,代碼來源:statistics_1.php


注:本文中的scraperwiki::sqlitecommand方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。