当前位置: 首页>>代码示例>>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;未经允许,请勿转载。