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


PHP Sqlite::getRowswhere方法代码示例

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


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

示例1: trafficperslave

function trafficperslave($slave, $oldtime, $newtime)
{
    global $gbl, $sgbl, $login, $ghtml;
    $sq = new Sqlite(null, 'vps');
    $res = $sq->getRowswhere("syncserver = '{$slave}'", array('nname'));
    if (!$res) {
        return;
    }
    foreach ($res as $r) {
        $vps = new Vps(null, null, $r['nname']);
        $vps->get();
        $vpslist[] = $vps;
    }
    $list = null;
    foreach ($vpslist as $d) {
        $rt = new Remote();
        if ($d->isXen()) {
            $rt->viflist = $d->getViflist();
        } else {
            $rt->vpsid = $d->vpsid;
        }
        $rt->nname = $d->nname;
        $list[$d->nname] = $rt;
    }
    $driverapp = $gbl->getSyncClass(null, $slave, 'vps');
    try {
        $vps_usage = rl_exec_get(null, $slave, array("vpstraffic__{$driverapp}", 'findTotaltrafficUsage'), array($list, $oldtime, $newtime));
    } catch (exception $e) {
        exit;
    }
    dprintr($vps_usage);
    $res = "";
    foreach ($vpslist as $d) {
        $res['nname'] = "{$d->nname}:{$oldtime}:{$newtime}";
        $domt = new Vpstraffic(null, null, $res['nname']);
        $res['timestamp'] = @strftime("%c", $newtime);
        $res['oldtimestamp'] = @strftime("%c", $oldtime);
        $res['ddate'] = time();
        $res['comment'] = null;
        $res['parent_list'] = null;
        $res['parent_clname'] = $d->getClName();
        $res['traffic_usage'] = $vps_usage[$d->nname]['total'];
        $res['incoming_usage'] = $vps_usage[$d->nname]['incoming'];
        $res['outgoing_usage'] = $vps_usage[$d->nname]['outgoing'];
        //		print_r($res);
        $domt->create($res);
        $domt->was();
    }
    $firstofmonth = @mktime(00, 01, 00, @date("n"), 1, @date("Y"));
    $today = time() + 2 * 24 * 60 * 60;
    if ($vpslist) {
        foreach ($vpslist as $vps) {
            $vpst = $vps->getList("vpstraffic");
            $list = get_namelist_from_objectlist($vpst);
            $tu = trafficGetIndividualObjectTotal($vpst, $firstofmonth, $today, $vps->nname);
            $sq->rawQuery("update vps set used_q_traffic_usage = '{$tu}' where nname = '{$vps->nname}'");
            list($month, $year) = get_last_month_and_year();
            $tlu = VpstrafficHistory::getMonthTotal($vpst, $month, $year, null);
            $tlu = $tlu['traffic_usage'];
            $sq->rawQuery("update vps set used_q_traffic_last_usage = '{$tlu}' where nname = '{$vps->nname}'");
            /*
            	try {
            		$sgbl->__var_backupdisk_usage[$vps->getClName()] = rl_exec_get(null, $vps->syncserver, array("vps", "getBackupDiskSize"), array($vps->nname));
            	} catch (Exception $e) {
            		$sgbl->__var_backupdisk_usage[$vps->getClName()] = null;
            	}
            */
        }
    }
}
开发者ID:digideskio,项目名称:hypervm,代码行数:70,代码来源:trafficperslave.php


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