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


PHP Database::query方法代码示例

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


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

示例1: listUsers

 /**
  * @return string 
  */
 public static function listUsers(Database &$database)
 {
     $query = $database->query('SELECT name, email FROM users');
     $table = '<table><tr><th>Name</th><th>E-mail</th></tr>';
     while ($value = $query->fetch(Database::FETCH_BOTH)) {
         $table .= '<tr><td>' . $value[0] . '</td><td>' . $value[1] . '</td></tr>';
     }
     $table .= '</table>';
     return $table;
 }
开发者ID:engenhariaSI,项目名称:pingpONG,代码行数:13,代码来源:Users.php

示例2: stream_get_contents

// Log the process output if available
$stdout = stream_get_contents($pipes[1]);
$stderr = stream_get_contents($pipes[2]);
if ("{$stdout}{$stderr}") {
    $method = $stderr ? 'error' : 'info';
    Log::$method(sprintf('Output captured from command line: %s', $process['command']), array_filter(array('stdout' => $stdout, 'stderr' => $stderr)));
    unset($method);
}
unset($stdout, $stderr);
// Handles cleanup after process exit
switch (strtolower($process['type'])) {
    // Permanent processes will be restarted upon death
    case 'permanent':
        core\Database::query('UPDATE `' . FRAMEWORK_COLLECTION_PROCESS . '` SET `pid` = NULL WHERE `id` = ?', $process['id']);
        Log::debug('Permanent process died, clearing pid.', [$res, $process]);
        break;
        // Sets pid to 0, prevents it fire again and double enqueue of the same time slot.
    // Sets pid to 0, prevents it fire again and double enqueue of the same time slot.
    case 'cron':
        core\Database::query('UPDATE `' . FRAMEWORK_COLLECTION_PROCESS . '` SET `pid` = 0 WHERE `id` = ?', $process['id']);
        break;
        // Deletes the process object upon exit
    // Deletes the process object upon exit
    default:
        $process = array_select($process, array(Node::FIELD_COLLECTION, 'id', 'pid'));
        $res = Node::delete($process);
        Log::debug("Deleting finished process, affected rows: {$res}.", [$res, $process]);
        break;
}
// Recursive process, spawn another worker.
Process::spawnWorker(@$_SERVER['env']);
开发者ID:Victopia,项目名称:prefw,代码行数:31,代码来源:Process.php

示例3: invalidate

 /**
  * Logout function, application terminating point.
  */
 static function invalidate($sid = null)
 {
     if ($sid === null) {
         $sid = static::$currentSession['sid'];
     }
     $sid = util::packUuid($sid);
     $session = Node::getOne(array(Node::FIELD_COLLECTION => FRAMEWORK_COLLECTION_SESSION, 'sid' => $sid));
     Database::query('DELETE FROM `' . FRAMEWORK_COLLECTION_SESSION . '` WHERE `sid` = ?', array($sid));
     Log::info(sprintf('Session invalidated', $session));
     /* Clear reference */
     static::$currentSession = null;
 }
开发者ID:Victopia,项目名称:prefw,代码行数:15,代码来源:Session.php


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