From 56c061a7d179e55692b24aafd61951202df62890 Mon Sep 17 00:00:00 2001 From: "Timothy J. Warren" Date: Thu, 20 Mar 2014 11:57:50 -0400 Subject: [PATCH] Split _compile method in query_builder class --- classes/query_builder.php | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/classes/query_builder.php b/classes/query_builder.php index de620e9..5fd63a4 100644 --- a/classes/query_builder.php +++ b/classes/query_builder.php @@ -95,7 +95,7 @@ class Query_Builder implements iQuery_Builder { // Whether to do only an explain on the query protected $explain = FALSE; - + // Subclass instances public $db; protected $parser; @@ -1339,13 +1339,13 @@ class Query_Builder implements iQuery_Builder { // -------------------------------------------------------------------------- /** - * String together the sql statements for sending to the db + * Sub-method for generating sql strings * * @param string $type * @param string $table * @return $string */ - protected function _compile($type='', $table='') + protected function _compile_type($type='', $table='') { $table = $this->db->quote_table($table); @@ -1380,6 +1380,23 @@ class Query_Builder implements iQuery_Builder { break; } + return $sql; + } + + // -------------------------------------------------------------------------- + + /** + * String together the sql statements for sending to the db + * + * @param string $type + * @param string $table + * @return $string + */ + protected function _compile($type='', $table='') + { + // Get the base clause for the query + $sql = $this->_compile_type($type, $table); + // Set the where clause if ( ! empty($this->query_map)) {