本文整理汇总了PHP中ADODB_mysqli::escape方法的典型用法代码示例。如果您正苦于以下问题:PHP ADODB_mysqli::escape方法的具体用法?PHP ADODB_mysqli::escape怎么用?PHP ADODB_mysqli::escape使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ADODB_mysqli
的用法示例。
在下文中一共展示了ADODB_mysqli::escape方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parseFindCriteria
/**
* Parses common criteria
*
* @param array $criteria array of the query search criteria
* @param string $join joins
* @param string $where where part of the statement
*/
private function parseFindCriteria($criteria, &$join, &$where)
{
if (isset($criteria['accountId'])) {
$join .= " JOIN account_ccs ac ON ac.cc_id = c.cc_id ";
$where .= "\n AND ac.account_id = " . $this->db->escape($criteria['accountId']) . "\n AND EXISTS (\n SELECT 1 FROM projects p WHERE p.cc_id = c.cc_id\n AND p.shared = " . ProjectEntity::SHARED_WITHIN_ACCOUNT . "\n AND p.account_id = " . $this->db->escape($criteria['accountId']) . "\n )\n ";
}
}
示例2: checkPermission
/**
* Checks if user has permissions to project in environment or account scope
*
* @param string $projectId Identifier of the project
* @param array $criteria ['envId' => '', 'clientid' => '']
* @return bool|mixed
*/
public function checkPermission($projectId, array $criteria)
{
$and = '';
foreach ($criteria as $name => $value) {
$field = 'f.' . \Scalr::decamelize($name);
$and .= " AND " . $field . "=" . $this->db->escape($value);
}
$projectEntity = new ProjectEntity();
$projectId = $projectEntity->type('projectId')->toDb($projectId);
$where = " WHERE p.project_id = UNHEX('" . $projectId . "') AND EXISTS (\n SELECT * FROM farms f\n LEFT JOIN farm_settings fs ON f.id = fs.farmid\n WHERE fs.name = '" . Entity\FarmSetting::PROJECT_ID . "'\n AND REPLACE(fs.value, '-', '') = HEX(p.project_id)\n {$and})";
$sql = "SELECT " . $projectEntity->fields('p') . "\n FROM " . $projectEntity->table('p') . $where;
return $this->db->GetOne($sql);
}
示例3: findFarmsByKey
/**
* Finds farms by key
* It searches by name
*
* @param int $envId Current enviroment id
* @param string $key optional Search key
* @return ArrayCollection Returns collection of the farm objects
*/
public function findFarmsByKey($envId, $key = null)
{
$statement = "\n SELECT *\n FROM farms f\n WHERE f.env_id = " . intval($envId) . "\n ";
if (!is_null($key) && $key !== '') {
$statement .= "\n AND f.name LIKE '%" . $this->db->escape($key) . "%'\n ";
}
$collection = new ArrayCollection();
$rs = $this->db->Execute($statement);
while ($rec = $rs->FetchRow()) {
$item = DBFarm::loadFields($rec);
$collection->append($item);
}
return $collection;
}
示例4: hasTable
/**
* {@inheritdoc}
* @see Scalr\Upgrade.UpdateInterface::hasTable()
*/
public function hasTable($table, $database = null)
{
$ret = $this->db->getOne("SHOW TABLES " . ($database ? "FROM `" . $this->db->escape($database) . "` " : "") . "LIKE ?", array($table));
return $ret ? true : false;
}