DBSqlBuilderFactory Class Reference
[Model]
Creates builder for given query type and driver. More...
Static Public Member Functions |
|
static | create_builder ($type, $query, $params=null) |
Create appropiate SQL builder. |
|
Public Attributes |
|
const | COUNT = 5 |
const | DELETE = 4 |
const | INSERT = 2 |
const | REPLACE = 8 |
const | SELECT = 1 |
const | UPDATE = 3 |
const | WHERE = 6 |
const | WHEREGROUP = 7 |
Detailed Description
Creates builder for given query type and driver.
Definition at line 8 of file dbsqlbuilderfactory.cls.php.
Member Function Documentation
static DBSqlBuilderFactory::create_builder | ( | $ | type, | |
$ | query, | |||
$ | params = null |
|||
) | [static] |
Create appropiate SQL builder.
- Parameters:
-
int $type Type of builder to create. Any of the constants DBSqlBuilderFactory::SELECT, DBSqlBuilderFactory::UPDATE etc. IDBQuery|IDBWhere $query The query to build SQL for array $params Associative array dependend on builder type
- Returns:
- IDBSqlBuilder
Definition at line 28 of file dbsqlbuilderfactory.cls.php.
00028 { 00029 $driver = DB::get_connection($query->get_table()->get_table_driver()); 00030 $db = $driver->get_driver_name(); 00031 $key = $db . '%%' . $type; 00032 if (!isset(self::$builders[$key])) { 00033 $part = false; 00034 switch ($type) { 00035 case self::SELECT: 00036 $part ='Select'; 00037 break; 00038 case self::INSERT: 00039 $part = 'Insert'; 00040 break; 00041 case self::UPDATE: 00042 $part = 'Update'; 00043 break; 00044 case self::DELETE: 00045 $part = 'Delete'; 00046 break; 00047 case self::COUNT: 00048 $part = 'Count'; 00049 break; 00050 case self::WHERE: 00051 $part = 'Where'; 00052 break; 00053 case self::WHEREGROUP: 00054 $part = 'WhereGroup'; 00055 break; 00056 case self::REPLACE: 00057 $part = 'Replace'; 00058 break; 00059 } 00060 if ($part === false) { 00061 throw new Exception(tr('Unknown SQL Builder Type: %s', 'core', array('%s' => $type))); 00062 } 00063 00064 $lower_part = strtolower($part); 00065 Load::classes_in_directory("model/base/sqlbuilder/", "dbsqlbuilder.$lower_part", 'cls'); 00066 Load::classes_in_directory("model/drivers/$db/sqlbuilder/", "dbsqlbuilder.$lower_part.$db", 'cls'); 00067 $cls = 'DBSqlBuilder' . $part . ucfirst($db); // $db is ASCII 00068 self::$builders[$key] = $cls; 00069 } 00070 $cls = self::$builders[$key]; 00071 return new $cls($query, $params); 00072 }
Member Data Documentation
const DBSqlBuilderFactory::COUNT = 5 |
Definition at line 13 of file dbsqlbuilderfactory.cls.php.
const DBSqlBuilderFactory::DELETE = 4 |
Definition at line 12 of file dbsqlbuilderfactory.cls.php.
const DBSqlBuilderFactory::INSERT = 2 |
Definition at line 10 of file dbsqlbuilderfactory.cls.php.
const DBSqlBuilderFactory::REPLACE = 8 |
Definition at line 16 of file dbsqlbuilderfactory.cls.php.
const DBSqlBuilderFactory::SELECT = 1 |
Definition at line 9 of file dbsqlbuilderfactory.cls.php.
const DBSqlBuilderFactory::UPDATE = 3 |
Definition at line 11 of file dbsqlbuilderfactory.cls.php.
const DBSqlBuilderFactory::WHERE = 6 |
Definition at line 14 of file dbsqlbuilderfactory.cls.php.
const DBSqlBuilderFactory::WHEREGROUP = 7 |
Definition at line 15 of file dbsqlbuilderfactory.cls.php.
The documentation for this class was generated from the following file:
- gyro/core/model/base/sqlbuilder/dbsqlbuilderfactory.cls.php