本文整理汇总了PHP中DBManager::getValidDBName方法的典型用法代码示例。如果您正苦于以下问题:PHP DBManager::getValidDBName方法的具体用法?PHP DBManager::getValidDBName怎么用?PHP DBManager::getValidDBName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBManager
的用法示例。
在下文中一共展示了DBManager::getValidDBName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadBeans
/**
* Load Beans uses Link2 to take a SugarQuery object and add the joins needed to take a link and make the connection
*
* @param Linkname $join
* @param $alias
*/
protected function loadBeans($join, $options)
{
$alias = !empty($options['alias']) ? $options['alias'] : $this->getJoinTableAlias($join);
$joinType = !empty($options['joinType']) ? $options['joinType'] : 'INNER';
$team_security = isset($options['team_security']) ? $options['team_security'] : true;
$ignoreRole = !empty($options['ignoreRole']) ? $options['ignoreRole'] : false;
$bean = !empty($options['relatedJoin']) ? $this->join[$options['relatedJoin']]->bean : $this->from;
if (is_array($bean)) {
// the bean is the first element of the array
$bean = reset($bean);
}
$bean->load_relationship($join);
if (empty($bean->{$join})) {
throw new SugarApiExceptionInvalidParameter("Invalid link {$join}");
}
$bean->{$join}->buildJoinSugarQuery($this, array('joinTableAlias' => $alias, 'joinType' => $joinType, 'ignoreRole' => $ignoreRole));
$joined = BeanFactory::newBean($bean->{$join}->getRelatedModuleName());
if ($team_security === true) {
$joined->addVisibilityQuery($this, array("table_alias" => $alias, 'as_condition' => true));
}
if ($joined->hasCustomFields()) {
$table_cstm = $joined->get_custom_table_name();
$alias_cstm = $this->db->getValidDBName($alias . '_cstm', false, 'alias');
$this->joinTable($table_cstm, array('alias' => $alias_cstm, 'joinType' => "LEFT", "linkingTable" => true))->on()->equalsField("{$alias_cstm}.id_c", "{$alias}.id");
}
}
示例2: foreach
/**
* Construct where clause from a list of name-value pairs.
* @param array $fields_array Name/value pairs for column checks
* @return string The WHERE clause
*/
function get_where($fields_array)
{
$where_clause = "";
foreach ($fields_array as $name => $value) {
if (!empty($where_clause)) {
$where_clause .= " AND ";
}
$name = $this->db->getValidDBName($name);
$where_clause .= "{$name} = " . $this->db->quoted($value, false);
}
if (!empty($where_clause)) {
return "WHERE {$where_clause} AND deleted=0";
} else {
return "WHERE deleted=0";
}
}
示例3: getRelateAlias
/**
* Composes alias for related name field part
*
* @param string $field Current bean field
* @param string $name_field Related bean field
*
* @return string
*/
public function getRelateAlias($field, $name_field)
{
$alias = sprintf('rel_%s_%s', $field, $name_field);
$alias = $this->db->getValidDBName($alias, true, 'alias');
return $alias;
}