本文整理匯總了PHP中DibiConnection::getSubstitutes方法的典型用法代碼示例。如果您正苦於以下問題:PHP DibiConnection::getSubstitutes方法的具體用法?PHP DibiConnection::getSubstitutes怎麽用?PHP DibiConnection::getSubstitutes使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類DibiConnection
的用法示例。
在下文中一共展示了DibiConnection::getSubstitutes方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: createConnection
public static function createConnection(DI\Container $container)
{
$dibiConnection = new \DibiConnection($container->params['database']);
$dibiConnection->query('SET NAMES UTF8');
$substitutions = array('core' => 'cms_', 'vd' => 'cms_vd_', 'c' => 'cgf_', 'media' => 'media_');
foreach ($substitutions as $sub => $prefix) {
$dibiConnection->getSubstitutes()->{$sub} = $prefix;
}
// $profiler = new \DibiProfiler();
// $dibiConnection->setProfiler($profiler);
// $dibiConnection->setFile(APP_DIR.'/../log/dibi.log');
return $dibiConnection;
}
示例2: cb
//.........這裏部分代碼省略.........
$this->hasError = TRUE;
return "**Extra placeholder**";
}
$cursor++;
return $this->formatValue($this->args[$cursor - 1], FALSE);
}
if (!empty($matches[10])) {
// modifier
$mod = $matches[10];
$cursor =& $this->cursor;
if ($cursor >= count($this->args) && $mod !== 'else' && $mod !== 'end') {
$this->hasError = TRUE;
return "**Extra modifier %{$mod}**";
}
if ($mod === 'if') {
$this->ifLevel++;
$cursor++;
if (!$this->comment && !$this->args[$cursor - 1]) {
// open comment
$this->ifLevelStart = $this->ifLevel;
$this->comment = TRUE;
return "/*";
}
return '';
} elseif ($mod === 'else') {
if ($this->ifLevelStart === $this->ifLevel) {
$this->ifLevelStart = 0;
$this->comment = FALSE;
return "*/";
} elseif (!$this->comment) {
$this->ifLevelStart = $this->ifLevel;
$this->comment = TRUE;
return "/*";
}
} elseif ($mod === 'end') {
$this->ifLevel--;
if ($this->ifLevelStart === $this->ifLevel + 1) {
// close comment
$this->ifLevelStart = 0;
$this->comment = FALSE;
return "*/";
}
return '';
} elseif ($mod === 'ex') {
// array expansion
array_splice($this->args, $cursor, 1, $this->args[$cursor]);
return '';
} elseif ($mod === 'lmt') {
// apply limit
if ($this->args[$cursor] !== NULL) {
$this->limit = (int) $this->args[$cursor];
}
$cursor++;
return '';
} elseif ($mod === 'ofs') {
// apply offset
if ($this->args[$cursor] !== NULL) {
$this->offset = (int) $this->args[$cursor];
}
$cursor++;
return '';
} else {
// default processing
$cursor++;
return $this->formatValue($this->args[$cursor - 1], $mod);
}
}
if ($this->comment) {
return '...';
}
if ($matches[1]) {
// SQL identifiers: `ident`
return $this->identifiers->{$matches[1]};
}
if ($matches[2]) {
// SQL identifiers: [ident]
return $this->identifiers->{$matches[2]};
}
if ($matches[3]) {
// SQL strings: '...'
return $this->driver->escape(str_replace("''", "'", $matches[4]), dibi::TEXT);
}
if ($matches[5]) {
// SQL strings: "..."
return $this->driver->escape(str_replace('""', '"', $matches[6]), dibi::TEXT);
}
if ($matches[7]) {
// string quote
$this->hasError = TRUE;
return '**Alone quote**';
}
if ($matches[8]) {
// SQL identifier substitution
$m = substr($matches[8], 0, -1);
$m = $this->connection->getSubstitutes()->{$m};
return $matches[9] == '' ? $this->formatValue($m, FALSE) : $m . $matches[9];
// value or identifier
}
die('this should be never executed');
}