本文整理汇总了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;
}
示例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) {