本文整理汇总了PHP中Database_Connection::quote_identifier方法的典型用法代码示例。如果您正苦于以下问题:PHP Database_Connection::quote_identifier方法的具体用法?PHP Database_Connection::quote_identifier怎么用?PHP Database_Connection::quote_identifier使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Database_Connection
的用法示例。
在下文中一共展示了Database_Connection::quote_identifier方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: compile
/**
* Compile the SQL partial for a JOIN statement and return it.
*
* @param object Database instance
* @return string
*/
public function compile(\Database_Connection $db)
{
if ($this->_type) {
$sql = strtoupper($this->_type) . ' JOIN';
} else {
$sql = 'JOIN';
}
// Quote the table name that is being joined
$sql .= ' ' . $db->quote_table($this->_table) . ' ON ';
$conditions = array();
foreach ($this->_on as $condition) {
// Split the condition
list($c1, $op, $c2) = $condition;
if ($op) {
// Make the operator uppercase and spaced
$op = ' ' . strtoupper($op);
}
// Quote each of the identifiers used for the condition
$conditions[] = $db->quote_identifier($c1) . $op . ' ' . $db->quote_identifier($c2);
}
// Concat the conditions "... AND ..."
$sql .= '(' . implode(' AND ', $conditions) . ')';
return $sql;
}
示例2: _compile_order_by
/**
* Compiles an array of ORDER BY statements into an SQL partial.
*
* @param object Database instance
* @param array sorting columns
* @return string
*/
protected function _compile_order_by(\Database_Connection $db, array $columns)
{
$sort = array();
foreach ($columns as $group) {
list($column, $direction) = $group;
if (!empty($direction)) {
// Make the direction uppercase
$direction = ' ' . strtoupper($direction);
}
$sort[] = $db->quote_identifier($column) . $direction;
}
return 'ORDER BY ' . implode(', ', $sort);
}