diff --git a/classes/db_pdo.php b/classes/db_pdo.php index 8e26a0c..c724670 100644 --- a/classes/db_pdo.php +++ b/classes/db_pdo.php @@ -279,8 +279,23 @@ abstract class DB_PDO extends PDO { $hiers = explode('.', $ident); $hiers = array_map('mb_trim', $hiers); - // Return the re-compiled string - return implode('.', array_map(array($this, '_quote'), $hiers)); + // Re-compile the string + $raw = implode('.', array_map(array($this, '_quote'), $hiers)); + + // Fix functions + $funcs = array(); + preg_match_all("#{$this->escape_char}([a-zA-Z0-9_]+(\((.*?)\))){$this->escape_char}#iu", $raw, $funcs, PREG_SET_ORDER); + foreach($funcs as $f) + { + // Unquote the function + $raw = str_replace($f[0], $f[1], $raw); + + // Quote the inside identifiers + $raw = str_replace($f[3], $this->quote_ident($f[3]), $raw); + } + + return $raw; + } // -------------------------------------------------------------------------- diff --git a/docs/classes/BadConnectionException.html b/docs/classes/BadConnectionException.html index 9085c7d..8e86e5e 100644 --- a/docs/classes/BadConnectionException.html +++ b/docs/classes/BadConnectionException.html @@ -219,7 +219,7 @@
+ generated on 2013-04-25T08:15:20-04:00.
diff --git a/docs/classes/BadDBDriverException.html b/docs/classes/BadDBDriverException.html index 1729ee2..89c7267 100644 --- a/docs/classes/BadDBDriverException.html +++ b/docs/classes/BadDBDriverException.html @@ -219,7 +219,7 @@
+ generated on 2013-04-25T08:15:20-04:00.
diff --git a/docs/classes/DB_PDO.html b/docs/classes/DB_PDO.html index 4e29888..4b0cb8a 100644 --- a/docs/classes/DB_PDO.html +++ b/docs/classes/DB_PDO.html @@ -743,7 +743,7 @@ the connection/database
+ generated on 2013-04-25T08:15:20-04:00.
diff --git a/docs/classes/DB_Util.html b/docs/classes/DB_Util.html index a2559ef..6d9264b 100644 --- a/docs/classes/DB_Util.html +++ b/docs/classes/DB_Util.html @@ -210,7 +210,7 @@
+ generated on 2013-04-25T08:15:20-04:00.
diff --git a/docs/classes/Firebird.html b/docs/classes/Firebird.html index cd2a8a6..afc1326 100644 --- a/docs/classes/Firebird.html +++ b/docs/classes/Firebird.html @@ -925,7 +925,7 @@ the last query executed
+ generated on 2013-04-25T08:15:20-04:00.
diff --git a/docs/classes/Firebird_Result.html b/docs/classes/Firebird_Result.html index ec63ecc..1a49b47 100644 --- a/docs/classes/Firebird_Result.html +++ b/docs/classes/Firebird_Result.html @@ -505,7 +505,7 @@ the query
+ generated on 2013-04-25T08:15:20-04:00.
diff --git a/docs/classes/Firebird_SQL.html b/docs/classes/Firebird_SQL.html index b274683..4b7822b 100644 --- a/docs/classes/Firebird_SQL.html +++ b/docs/classes/Firebird_SQL.html @@ -234,7 +234,7 @@
+ generated on 2013-04-25T08:15:20-04:00.
diff --git a/docs/classes/Firebird_Util.html b/docs/classes/Firebird_Util.html index 529476f..9e7b629 100644 --- a/docs/classes/Firebird_Util.html +++ b/docs/classes/Firebird_Util.html @@ -213,7 +213,7 @@
+ generated on 2013-04-25T08:15:20-04:00.
diff --git a/docs/classes/MySQL.html b/docs/classes/MySQL.html index ae96e5c..5027ea7 100644 --- a/docs/classes/MySQL.html +++ b/docs/classes/MySQL.html @@ -963,7 +963,7 @@ the connection/database
+ generated on 2013-04-25T08:15:20-04:00.
diff --git a/docs/classes/MySQL_SQL.html b/docs/classes/MySQL_SQL.html index 64ff136..7e06fe4 100644 --- a/docs/classes/MySQL_SQL.html +++ b/docs/classes/MySQL_SQL.html @@ -239,7 +239,7 @@
+ generated on 2013-04-25T08:15:20-04:00.
diff --git a/docs/classes/MySQL_Util.html b/docs/classes/MySQL_Util.html index 064252b..70ae1e5 100644 --- a/docs/classes/MySQL_Util.html +++ b/docs/classes/MySQL_Util.html @@ -209,7 +209,7 @@
+ generated on 2013-04-25T08:15:20-04:00.
diff --git a/docs/classes/ODBC.html b/docs/classes/ODBC.html index 1902b43..ce7948a 100644 --- a/docs/classes/ODBC.html +++ b/docs/classes/ODBC.html @@ -963,7 +963,7 @@ the connection/database
+ generated on 2013-04-25T08:15:20-04:00.
diff --git a/docs/classes/ODBC_SQL.html b/docs/classes/ODBC_SQL.html index e8d5e74..a1b72ae 100644 --- a/docs/classes/ODBC_SQL.html +++ b/docs/classes/ODBC_SQL.html @@ -234,7 +234,7 @@
+ generated on 2013-04-25T08:15:20-04:00.
diff --git a/docs/classes/ODBC_Util.html b/docs/classes/ODBC_Util.html index 47b548b..114395e 100644 --- a/docs/classes/ODBC_Util.html +++ b/docs/classes/ODBC_Util.html @@ -204,7 +204,7 @@
+ generated on 2013-04-25T08:15:20-04:00.
diff --git a/docs/classes/PgSQL.html b/docs/classes/PgSQL.html index 86fcd3f..397de51 100644 --- a/docs/classes/PgSQL.html +++ b/docs/classes/PgSQL.html @@ -965,7 +965,7 @@ the connection/database
+ generated on 2013-04-25T08:15:20-04:00.
diff --git a/docs/classes/PgSQL_SQL.html b/docs/classes/PgSQL_SQL.html index af8f54e..3e0d49d 100644 --- a/docs/classes/PgSQL_SQL.html +++ b/docs/classes/PgSQL_SQL.html @@ -234,7 +234,7 @@
+ generated on 2013-04-25T08:15:20-04:00.
diff --git a/docs/classes/PgSQL_Util.html b/docs/classes/PgSQL_Util.html index 0293a10..e6ff280 100644 --- a/docs/classes/PgSQL_Util.html +++ b/docs/classes/PgSQL_Util.html @@ -209,7 +209,7 @@
+ generated on 2013-04-25T08:15:20-04:00.
diff --git a/docs/classes/Query_Builder.html b/docs/classes/Query_Builder.html index 5c521f4..048f655 100644 --- a/docs/classes/Query_Builder.html +++ b/docs/classes/Query_Builder.html @@ -1361,7 +1361,7 @@ passed array with key / value pairs
+ generated on 2013-04-25T08:15:20-04:00.
diff --git a/docs/classes/Query_Parser.html b/docs/classes/Query_Parser.html index 8a7bfa1..92e5854 100644 --- a/docs/classes/Query_Parser.html +++ b/docs/classes/Query_Parser.html @@ -145,7 +145,7 @@
+ generated on 2013-04-25T08:15:20-04:00.
diff --git a/docs/classes/SQLite.html b/docs/classes/SQLite.html index b7dc868..9ab42db 100644 --- a/docs/classes/SQLite.html +++ b/docs/classes/SQLite.html @@ -980,7 +980,7 @@ method if the database does not support 'TRUNCATE';
+ generated on 2013-04-25T08:15:20-04:00.
diff --git a/docs/classes/SQLite_SQL.html b/docs/classes/SQLite_SQL.html index 1e7f765..026bbcd 100644 --- a/docs/classes/SQLite_SQL.html +++ b/docs/classes/SQLite_SQL.html @@ -234,7 +234,7 @@
+ generated on 2013-04-25T08:15:20-04:00.
diff --git a/docs/classes/SQLite_Util.html b/docs/classes/SQLite_Util.html index c708647..df4f60f 100644 --- a/docs/classes/SQLite_Util.html +++ b/docs/classes/SQLite_Util.html @@ -209,7 +209,7 @@
+ generated on 2013-04-25T08:15:20-04:00.
diff --git a/docs/classes/iDB_SQL.html b/docs/classes/iDB_SQL.html index 320de39..471c415 100644 --- a/docs/classes/iDB_SQL.html +++ b/docs/classes/iDB_SQL.html @@ -244,7 +244,7 @@ specified table
+ generated on 2013-04-25T08:15:20-04:00.
diff --git a/docs/classes/iQuery_Builder.html b/docs/classes/iQuery_Builder.html index 4c205d6..fea7a90 100644 --- a/docs/classes/iQuery_Builder.html +++ b/docs/classes/iQuery_Builder.html @@ -964,7 +964,7 @@ passed array with key / value pairs
+ generated on 2013-04-25T08:15:20-04:00.
diff --git a/docs/deprecated.html b/docs/deprecated.html index f6c1461..497e9fd 100644 --- a/docs/deprecated.html +++ b/docs/deprecated.html @@ -68,7 +68,7 @@
+ generated on 2013-04-25T08:15:20-04:00.
diff --git a/docs/errors.html b/docs/errors.html index fff879c..9977fb8 100644 --- a/docs/errors.html +++ b/docs/errors.html @@ -237,7 +237,7 @@
+ generated on 2013-04-25T08:15:20-04:00.
diff --git a/docs/graph_class.html b/docs/graph_class.html index c5e7d6d..02ab063 100644 --- a/docs/graph_class.html +++ b/docs/graph_class.html @@ -65,7 +65,7 @@
+ generated on 2013-04-25T08:15:20-04:00.
diff --git a/docs/markers.html b/docs/markers.html index a81ac24..1e0358a 100644 --- a/docs/markers.html +++ b/docs/markers.html @@ -110,7 +110,7 @@
+ generated on 2013-04-25T08:15:20-04:00.
diff --git a/docs/namespaces/default.html b/docs/namespaces/default.html index f3cfd7d..61302cc 100644 --- a/docs/namespaces/default.html +++ b/docs/namespaces/default.html @@ -340,7 +340,7 @@ instantiates the specific db driver

+ generated on 2013-04-25T08:15:20-04:00.
diff --git a/docs/packages/.html b/docs/packages/.html index 730c09d..c3705ec 100644 --- a/docs/packages/.html +++ b/docs/packages/.html @@ -68,7 +68,7 @@
+ generated on 2013-04-25T08:15:20-04:00.
diff --git a/docs/packages/Default.html b/docs/packages/Default.html index 871e8b9..34d992d 100644 --- a/docs/packages/Default.html +++ b/docs/packages/Default.html @@ -95,7 +95,7 @@
+ generated on 2013-04-25T08:15:20-04:00.
diff --git a/docs/packages/Query.Drivers.html b/docs/packages/Query.Drivers.html index 9e99ff2..93aebbc 100644 --- a/docs/packages/Query.Drivers.html +++ b/docs/packages/Query.Drivers.html @@ -212,7 +212,7 @@ data-fetching methods

+ generated on 2013-04-25T08:15:20-04:00.
diff --git a/docs/packages/Query.Query.html b/docs/packages/Query.Query.html index 83849c1..c945f0f 100644 --- a/docs/packages/Query.Query.html +++ b/docs/packages/Query.Query.html @@ -150,7 +150,7 @@ instantiates the specific db driver

+ generated on 2013-04-25T08:15:20-04:00.
diff --git a/docs/packages/Query.html b/docs/packages/Query.html index b8d3533..ee51ce2 100644 --- a/docs/packages/Query.html +++ b/docs/packages/Query.html @@ -362,7 +362,7 @@ instantiates the specific db driver

+ generated on 2013-04-25T08:15:20-04:00.
diff --git a/docs/structure.xml b/docs/structure.xml index 4ec2f15..f8d336f 100644 --- a/docs/structure.xml +++ b/docs/structure.xml @@ -98,7 +98,7 @@ - + Free Query Builder / Database Abstraction Layer

]]>
@@ -350,228 +350,228 @@ - + _quote function - + - + mixed - + mixed - + $str - + empty_table function - + - + string - + mixed - + $table - + get_schemas function - + - + array - + get_tables function - + - + array - + get_dbs function - + - + array - + get_views function - + - + array - + get_sequences function - + - + array - + get_functions function - + - + array - + get_procedures function - + - + array - + get_triggers function - + - + array - + get_system_tables function - + - + array - + get_columns function - + - + string - + array - + $table - + get_types function - + - + array - + driver_query function - + - + string - + bool - + mixed - + $sql - + $filtered_index - + num_rows function - + - - + + int - + truncate function - + - + string - + void - + $table @@ -579,7 +579,7 @@ the connection/database]]>
- + Free Query Builder / Database Abstraction Layer

]]>
@@ -712,1347 +712,1347 @@ instantiates the specific db driver]]> - + select function - + - + string - + \$this - + $fields - + _select function - + - + string - + string - + string - + $field - + $as - + select_max function - + - + string - + string - + \$this - + $field - + $as - + select_min function - + - + string - + string - + \$this - + $field - + $as - + select_avg function - + - + string - + string - + \$this - + $field - + $as - + select_sum function - + - + string - + string - + \$this - + $field - + $as - + distinct function - + - + \$this - + from function - + - + string - + \$this - + $tblname - + _like function - + - + string - + mixed - + string - + string - + string - + \$this - + $field - + $val - + $pos - + $like - + $conj - + like function - + - + string - + mixed - + string - + \$this - + $field - + $val - + $pos - + or_like function - + - + string - + mixed - + string - + \$this - + $field - + $val - + $pos - + not_like function - + - + string - + mixed - + string - + \$this - + $field - + $val - + $pos - + or_not_like function - + - + string - + mixed - + string - + \$this - + $field - + $val - + $pos - + _having function - + - + mixed - + mixed - + string - + \$this - + $key - + $val - + $conj - + having function - + - + mixed - + mixed - + \$this - + $key - + $val - + or_having function - + - + mixed - + mixed - + \$this - + $key - + $val - + _where function - + - + mixed - + mixed - + array - + $key - + $val - + _where_string function - + - + mixed - + mixed - + string - + \$this - + $key - + $val - + $conj - + _where_in function - + - + mixed - + mixed - - - + + + \$this - + $key - + $val - + $in - + $conj - + where function - + - + mixed - + mixed - + \$this - + $key - + $val - + or_where function - + - + string - + mixed - + \$this - + $key - + $val - + where_in function - + - + mixed - + mixed - + \$this - + $field - + $val - + or_where_in function - + - + string - + mixed - + \$this - + $field - + $val - + where_not_in function - + - + string - + mixed - + \$this - + $field - + $val - + or_where_not_in function - + - + string - + mixed - + \$this - + $field - + $val - + set function - + - + mixed - + mixed - + \$this - + $key - + $val - + join function - + - + string - + string - + string - + \$this - + $table - + $condition - + $type - + group_by function - + - + mixed - + \$this - + $field - + order_by function - + - + string - + string - + \$this - + $field - + $type - + limit function - + - + int - + int - + string - + $limit - + $offset - + group_start function - + - + \$this - + or_group_start function - + - + \$this - + or_not_group_start function - + - + \$this - + group_end function - + - + \$this - + get function - + - - + + int - + int - + object - + $table - + $limit - + $offset - + get_where function - + - + string - + array - + int - + int - + object - + $table - + $where - + $limit - + $offset - + count_all function - + - + string - + int - + $table - + count_all_results function - + - + string - + int - + $table - + insert function - + - + string - + mixed - + mixed - + $table - + $data - + update function - + - + string - + mixed - + mixed - + $table - + $data - + delete function - + - + string - + mixed - + mixed - + $table - + $where - + get_compiled_select function - + - + string - + bool - + string - + $table - + $reset - + get_compiled_insert function - + - + string - + bool - + string - + $table - + $reset - + get_compiled_update function - + - + string - + bool - + string - + $table - + $reset - + get_compiled_delete function - + - + string - + bool - + string - + $table - + $reset - + _get_compile function - + - + string - + string - - + + - + $type - + $table - + $reset - + reset_query function - + - + void - + _run function - + - + string - + string - + bool - + mixed - + $type - + $table - + $simple - + __call function - + - + string - + array - + mixed - + $name - + $params - + _compile function - + - + string - + string - + \$string - + $type - + $table diff --git a/tests/core/db_qb_test.php b/tests/core/db_qb_test.php index 0bba7fa..50a05b8 100644 --- a/tests/core/db_qb_test.php +++ b/tests/core/db_qb_test.php @@ -36,6 +36,22 @@ abstract class QBTest extends UnitTestCase { $this->assertReference($this->db, $db); } + // -------------------------------------------------------------------------- + + public function TestFunctionGet() + { + if (empty($this->db)) return; + + $query = $this->db->select('id, COUNT(id) as count') + ->from('test') + ->group_by('id') + ->get(); + + $this->assertIsA($query, 'PDOStatement'); + } + + // -------------------------------------------------------------------------- + public function TestGet() { if (empty($this->db)) return; diff --git a/tests/db_files/FB_TEST_DB.FDB b/tests/db_files/FB_TEST_DB.FDB index a7155a8..144d10b 100755 Binary files a/tests/db_files/FB_TEST_DB.FDB and b/tests/db_files/FB_TEST_DB.FDB differ