本文整理汇总了PHP中core\Database::escapeValue方法的典型用法代码示例。如果您正苦于以下问题:PHP Database::escapeValue方法的具体用法?PHP Database::escapeValue怎么用?PHP Database::escapeValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core\Database
的用法示例。
在下文中一共展示了Database::escapeValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: validate
function validate($username, $password)
{
$session = Node::getOne(array(Node::FIELD_COLLECTION => FRAMEWORK_COLLECTION_SESSION, 'username' => Database::escapeValue($username)));
$res = Session::validate($username, $password, $this->request()->fingerprint());
if (is_int($res)) {
switch ($res) {
case Session::ERR_MISMATCH:
throw new ServiceException('Username and password mismatch.', $res);
break;
case Session::ERR_EXISTS:
throw new ServiceException('Session already exists.', $res);
break;
}
}
return $res;
}
示例2: load
/**
* Loads data into current intance with specified $entityId from collection.
*
* @param {array|string|number} $filter Scalar types will be treated as identity,
* array types will be used as is.
*/
function load($identity)
{
if (!$identity) {
return $this;
}
$identity = Database::escapeValue($identity);
$filter = array(Node::FIELD_COLLECTION => self::collectionName());
if (is_scalar($identity)) {
$filter[$this->_primaryKey] = $identity;
} else {
if (is_array($identity)) {
$filter += $identity;
}
}
$this->beforeLoad($filter);
if ($filter !== false) {
$this->data((array) @Node::getOne($filter));
$this->afterLoad();
}
return $this;
}