'expression' => false,
'export' => false,
'unitOfWork' => false,
- 'formatter' => false,
);
protected $properties = array('sql_comments' => array(array('start' => '--', 'end' => "\n", 'escape' => false),
case 'unitOfWork':
$this->modules[$name] = new IPF_ORM_Connection_UnitOfWork($this);
break;
- case 'formatter':
- $this->modules[$name] = new IPF_ORM_Formatter($this);
- break;
default:
$class = 'IPF_ORM_' . ucwords($name) . '_' . $this->getDriverName();
$this->modules[$name] = new $class($this);
return 'RAND()';
}
- public function matchPattern($pattern, $operator = null, $field = null)
- {
- $match = '';
- if ( ! is_null($operator)) {
- $field = is_null($field) ? '' : $field.' ';
- $operator = strtoupper($operator);
- switch ($operator) {
- // case insensitive
- case 'ILIKE':
- $match = $field.'LIKE ';
- break;
- // case sensitive
- case 'LIKE':
- $match = $field.'LIKE BINARY ';
- break;
- default:
- throw new IPF_ORM_Exception('not a supported operator type:'. $operator);
- }
- }
- $match.= "'";
- foreach ($pattern as $key => $value) {
- if ($key % 2) {
- $match .= $value;
- } else {
- $match .= $this->conn->escapePattern($this->conn->escape($value));
- }
- }
- $match.= "'";
- $match.= $this->patternEscapeString();
- return $match;
- }
-
public function guid()
{
return 'UUID()';
+++ /dev/null
-<?php
-
-class IPF_ORM_Formatter extends IPF_ORM_Connection_Module
-{
- public function escapePattern($text)
- {
- if ( ! $this->string_quoting['escape_pattern']) {
- return $text;
- }
- $tmp = $this->conn->string_quoting;
-
- $text = str_replace($tmp['escape_pattern'],
- $tmp['escape_pattern'] .
- $tmp['escape_pattern'], $text);
-
- foreach ($this->wildcards as $wildcard) {
- $text = str_replace($wildcard, $tmp['escape_pattern'] . $wildcard, $text);
- }
- return $text;
- }
-}
-
public function parseClause($clause)
{
- $clause = trim($clause);
+ $clause = trim($clause);
- if (is_numeric($clause)) {
- return $clause;
- }
+ if (is_numeric($clause)) {
+ return $clause;
+ }
$terms = $this->_tokenizer->clauseExplode($clause, array(' ', '+', '-', '*', '/', '<', '>', '=', '>=', '<='));