本文整理汇总了PHP中Database_Connection::quote_table方法的典型用法代码示例。如果您正苦于以下问题:PHP Database_Connection::quote_table方法的具体用法?PHP Database_Connection::quote_table怎么用?PHP Database_Connection::quote_table使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Database_Connection
的用法示例。
在下文中一共展示了Database_Connection::quote_table方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: compile
/**
* Compile the SQL query and return it.
*
* @param object Database instance
* @return string
*/
public function compile(\Database_Connection $db)
{
// Start an update query
$query = 'UPDATE ' . $db->quote_table($this->_table);
// Add the columns to update
$query .= ' SET ' . $this->_compile_set($db, $this->_set);
if (!empty($this->_where)) {
// Add selection conditions
$query .= ' WHERE ' . $this->_compile_conditions($db, $this->_where);
}
if ($this->_limit !== NULL && substr($db->_db_type, 0, 6) !== 'sqlite') {
// Add limiting
$query .= ' LIMIT ' . $this->_limit;
}
return $query;
}
示例2: compile
/**
* Compile the SQL query and return it.
*
* @param object Database instance
* @return string
*/
public function compile(\Database_Connection $db)
{
// Start a deletion query
$query = 'DELETE FROM ' . $db->quote_table($this->_table);
if (!empty($this->_where)) {
// Add deletion conditions
$query .= ' WHERE ' . $this->_compile_conditions($db, $this->_where);
}
if (!empty($this->_order_by)) {
// Add sorting
$query .= ' ' . $this->_compile_order_by($db, $this->_order_by);
}
if ($this->_limit !== NULL && substr($db->_db_type, 0, 6) !== 'sqlite') {
// Add limiting
$query .= ' LIMIT ' . $this->_limit;
}
return $query;
}
示例3: 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;
}
示例4: compile
/**
* Compile the SQL query and return it.
*
* @param object Database instance
* @return string
*/
public function compile(\Database_Connection $db)
{
// Start an insertion query
$query = 'INSERT INTO ' . $db->quote_table($this->_table);
// Add the column names
$query .= ' (' . implode(', ', array_map(array($db, 'quote_identifier'), $this->_columns)) . ') ';
if (is_array($this->_values)) {
// Callback for quoting values
$quote = array($db, 'quote');
$groups = array();
foreach ($this->_values as $group) {
foreach ($group as $i => $value) {
if (is_string($value) and isset($this->_parameters[$value])) {
// Use the parameter value
$group[$i] = $this->_parameters[$value];
}
}
$groups[] = '(' . implode(', ', array_map($quote, $group)) . ')';
}
// Add the values
$query .= 'VALUES ' . implode(', ', $groups);
} else {
// Add the sub-query
$query .= (string) $this->_values;
}
return $query;
}