]> git.andy128k.dev Git - ipf-legacy-orm.git/commitdiff
cleanup
authorAndrey Kutejko <andy128k@gmail.com>
Sat, 27 Jul 2013 13:53:55 +0000 (16:53 +0300)
committerAndrey Kutejko <andy128k@gmail.com>
Sat, 27 Jul 2013 13:53:55 +0000 (16:53 +0300)
ipf/orm/connection.php
ipf/orm/expression/mysql.php
ipf/orm/formatter.php [deleted file]
ipf/orm/query.php

index 5f7fc93826c28039123dd461b09d17037f3d2b48..8495221ca4021d4e32cc52b9b870f014afe18a53 100644 (file)
@@ -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);
index 9b38c652cb9572d060970e5dc8e7cc734f51886b..cc11fc6c042cd23eb2ecfa51b3926288525ff7b9 100644 (file)
@@ -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 (file)
index 6ff634d..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-<?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;
-    }
-}
-
index 65cfee46805c28a7109350c2493e306c7d9a3556..3bbea7b55050b8072995584527cda5fcc7ecfa3c 100644 (file)
@@ -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(' ', '+', '-', '*', '/', '<', '>', '=', '>=', '<='));