本文整理匯總了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);
}