本文整理汇总了PHP中OA_DB::quoteIdentifier方法的典型用法代码示例。如果您正苦于以下问题:PHP OA_DB::quoteIdentifier方法的具体用法?PHP OA_DB::quoteIdentifier怎么用?PHP OA_DB::quoteIdentifier使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OA_DB
的用法示例。
在下文中一共展示了OA_DB::quoteIdentifier方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: resetSequenceByData
/**
* Resets the sequence value for a given table and its id field to the
* maximum value currently in the table. This way after upgrade the
* sequence should be ready to use for inserting new campaigns, websites...
* This function have effect only on PostgreSQL. It does nothing when
* called on a different database.
*
* On database error the function logs an error and returns false.
*
* @param string $table Name of the table (without prefix)
* @param string $field Name of the id field (eg. affiliateid, campaignid)
* @return PEAR_Error True on success, PEAR_Error object on failure.
*/
function resetSequenceByData($table, $field)
{
if ($this->oDbh->dbsyntax == 'pgsql') {
$prefix = $this->getPrefix();
$tableName = $prefix . $table;
$sequenceName = OA_DB::getSequenceName($this->oDbh, $table, $field);
$qSeq = $this->oDbh->quoteIdentifier($sequenceName, true);
$qFld = $this->oDbh->quoteIdentifier($field, true);
$qTbl = $this->oDbh->quoteIdentifier($tableName, true);
$sql = "SELECT setval(" . $this->oDbh->quote($qSeq) . ", MAX({$qFld})) FROM {$qTbl}";
$result = $this->oDbh->exec($sql);
if (PEAR::isError($result)) {
return $result;
}
}
return true;
}