本文整理匯總了PHP中Db::find方法的典型用法代碼示例。如果您正苦於以下問題:PHP Db::find方法的具體用法?PHP Db::find怎麽用?PHP Db::find使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Db
的用法示例。
在下文中一共展示了Db::find方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: initialize
public function initialize()
{
parent::initialize();
$this->view->dbs = Db::find();
$this->view->currentDbId = $this->request->get('id');
$this->allowRoles();
}
示例2: initialize
/**
* Extend ControllerBase initialize()
*/
public function initialize()
{
parent::initialize();
$this->view->dbs = Db::find();
//list all dbs in the left column
$this->view->currentDbId = $this->request->get('id');
}
示例3: get_no_bind_users
static function get_no_bind_users($wx_id)
{
$self_table = self::$table_name;
$wx_connect_table = WxConnect::table();
$sql = "select {$self_table}.wx_openid from {$self_table}";
$sql .= " left join {$wx_connect_table}";
$sql .= " on {$self_table}.wx_openid = {$wx_connect_table}.wx_openid";
$sql .= " where {$self_table}.wx_id = '{$wx_id}'";
$sql .= " and {$self_table}.status = " . self::STATUS_YES;
$sql .= " and {$wx_connect_table}.wx_openid is null";
return Db::find($sql);
}
示例4: list_user
static function list_user($page, $size, $where = '')
{
if ($page < 1) {
$page = 1;
}
if (strlen($where)) {
$where = " where 1 and {$where}";
}
$start = ($page - 1) * $size;
$limit = "limit {$start}, {$size}";
$sql = "select user_id from " . self::table();
$sql .= " {$where} {$limit}";
$ret = Db::find($sql);
return $ret;
}
示例5: calculate
function calculate($ctx)
{
$where = 1;
$where = "status = '" . Contract::STATUS_NEW . "'";
$real_data = RealData::get_cache();
$real_price = $real_data['amount'];
$sql = "SELECT name, strike_amount, ask_amount,";
$sql .= " ({$real_price}*(1+0.1)-strike_amount)/ask_amount as level_10,";
$sql .= " ({$real_price}*(1+0.15)-strike_amount)/ask_amount as level_15,";
$sql .= " ({$real_price}*(1+0.20)-strike_amount)/ask_amount as level_20";
$sql .= " FROM " . Contract::table();
$sql .= " WHERE status = '" . Contract::STATUS_NEW . "'";
$sql .= "order by level_20 desc, level_15 desc, level_10 desc";
$ctx->ds = Db::find($sql);
}
示例6: finda
/**
* Just like Db::finda() but will return an array of objects
*
* @param string $class
* @param array $query
* @param array $options
* @return array
**/
static function finda($class, $query = array(), $options = array())
{
$collection = self::getCollection($class);
$result = Db::find($collection, $query, $options);
$objects = array();
foreach ($result as $data) {
$objects[] = new $class($data);
}
return $objects;
}
示例7: on_collaboration_handle_transactions
public function on_collaboration_handle_transactions($pars)
{
$colls = $pars['colls'];
if (!is_array($colls)) {
self::raiseError('Invalid data received.');
}
$response = array();
$n = sizeof($colls);
for ($i = 0; $i < $n; $i++) {
$coll = explode('|', $colls[$i]);
$document_id = Db::quote_literal($coll[0]);
$collaborator_id = Db::quote_literal($coll[1]);
$last_transid = Db::quote_literal($coll[2]);
unset($coll[0]);
unset($coll[1]);
unset($coll[2]);
$log = Db::quote_literal(str_replace('\\', '\\\\', implode('|', $coll)));
$coll_response = array();
if (false !== ($res = Db::find("SELECT * FROM amy.coll_handle_transactions({$document_id}, {$collaborator_id}, {$last_transid}, '{$log}')"))) {
while (false !== ($r = pg_fetch_assoc($res))) {
$coll_response[] = $r;
}
} else {
$coll_response = Db::last_error();
}
$response[] = array('document_id' => $document_id, 'transactions' => $coll_response);
}
self::setResult($response);
}
示例8: find
/**
* @param Db object <code>$db</code>, array of strings <code>$cols</code>, string <code>$cond</code>
* @return array of associative arrays; keys are column headings or null if zero rows returned
*/
public static function find(Db $db, $cols, $cond)
{
return $db->find($cols, $cond, self::$table);
}
示例9: permissionModalAction
/**
* Manage permission for an defined user
*/
public function permissionModalAction()
{
$db = Db::find();
$user = User::findById($this->request->get('id'));
$this->view->dbm = $db;
$this->view->user = $user;
}
示例10: register
public function register($username, $password = null, $service = 'amy', $credentials = array())
{
$username = Db::quote_literal($username);
if ('' == trim($username)) {
throw new Exception('Username cannot be empty.');
}
$service = Db::quote_literal($service);
$hashed_password = null == $password ? '' : md5($password);
$q_data = array();
if (is_array($credentials)) {
foreach (array('email', 'nickname', 'picture', 'bio') as $key) {
$q_data[$key] = isset($credentials[$key]) ? Db::quote_literal($credentials[$key]) : '';
}
}
if (false === ($row = Db::find_first("SELECT * FROM amy.user_create('{$username}', '{$hashed_password}', '{$service}', '" . $q_data['email'] . "', '" . $q_data['nickname'] . "', '" . $q_data['picture'] . "', '" . $q_data['bio'] . "')"))) {
throw new Exception("User registration failed: `" . Db::last_error() . "'.");
}
$this->load_user_info($row);
try {
$this->setup_support_dir();
} catch (Exception $e) {
Db::find("SELECT amy.user_delete(" . $this->userId . ")");
throw new Exception($e->getMessage());
}
return $this;
}