From e22129170a6c8b6c10337e2962cff685e0523a94 Mon Sep 17 00:00:00 2001 From: Andrey Kutejko Date: Sat, 27 Jul 2013 16:53:55 +0300 Subject: [PATCH] cleanup --- ipf/orm/connection.php | 4 ---- ipf/orm/expression/mysql.php | 32 -------------------------------- ipf/orm/formatter.php | 22 ---------------------- ipf/orm/query.php | 8 ++++---- 4 files changed, 4 insertions(+), 62 deletions(-) delete mode 100644 ipf/orm/formatter.php diff --git a/ipf/orm/connection.php b/ipf/orm/connection.php index 5f7fc93..8495221 100644 --- a/ipf/orm/connection.php +++ b/ipf/orm/connection.php @@ -14,7 +14,6 @@ abstract class IPF_ORM_Connection extends IPF_ORM_Configurable implements Counta 'expression' => false, 'export' => false, 'unitOfWork' => false, - 'formatter' => false, ); protected $properties = array('sql_comments' => array(array('start' => '--', 'end' => "\n", 'escape' => false), @@ -177,9 +176,6 @@ abstract class IPF_ORM_Connection extends IPF_ORM_Configurable implements Counta 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); diff --git a/ipf/orm/expression/mysql.php b/ipf/orm/expression/mysql.php index 9b38c65..cc11fc6 100644 --- a/ipf/orm/expression/mysql.php +++ b/ipf/orm/expression/mysql.php @@ -12,38 +12,6 @@ class IPF_ORM_Expression_Mysql extends IPF_ORM_Expression_Driver 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()'; diff --git a/ipf/orm/formatter.php b/ipf/orm/formatter.php deleted file mode 100644 index 6ff634d..0000000 --- a/ipf/orm/formatter.php +++ /dev/null @@ -1,22 +0,0 @@ -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; - } -} - diff --git a/ipf/orm/query.php b/ipf/orm/query.php index 65cfee4..3bbea7b 100644 --- a/ipf/orm/query.php +++ b/ipf/orm/query.php @@ -379,11 +379,11 @@ class IPF_ORM_Query extends IPF_ORM_Query_Abstract implements Countable, Seriali 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(' ', '+', '-', '*', '/', '<', '>', '=', '>=', '<=')); -- 2.49.0