From a85e3ced05dfbc3267d735d29ceb0a194a53fe7c Mon Sep 17 00:00:00 2001 From: Antonio de la Rosa Date: Mon, 29 Jun 2015 15:04:34 +0200 Subject: [PATCH] Added method for raw queries --- src/Webmodel.php | 40 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/src/Webmodel.php b/src/Webmodel.php index 42b1375..eae4f4e 100644 --- a/src/Webmodel.php +++ b/src/Webmodel.php @@ -219,7 +219,7 @@ class Webmodel { * */ - public $type_cache=''; + public $type_cache='fileCache'; /** * Property that define if id is modified. @@ -247,7 +247,7 @@ class Webmodel { * */ - public function __construct($name_model) + public function __construct($name_model, $cache=0, $type_cache='fileCache') { //Webmodel::$root_model='app/'.$name_model.'/'.Webmodel::$model_path; @@ -263,9 +263,19 @@ class Webmodel { Webmodel::$connection_func[$this->db_selected]='connect_to_db'; } + + $this->cache=$cache; + $this->type_cache=$type_cache; + + } + /** + * + * + */ + /** * Method for load models from a project. * @@ -467,6 +477,19 @@ class Webmodel { } + /** + * This method is used for make raw string queries. + * + */ + + public function query($sql_query) + { + + $this->set_phango_connection(); + + return SQLClass::webtsys_query($sql_query, $this->db_selected); + } + /** * This method insert a row in database using model how mirage of table. * @@ -798,7 +821,18 @@ class Webmodel { $arr_distinct[0]=''; $arr_distinct[1]=' DISTINCT '; - $query=SQLClass::webtsys_query('select '.$arr_distinct[$this->distinct].' '.$fields.' from '.$selected_models.' '.$conditions, $this->db_selected); + if($this->cache==0) + { + + $query=SQLClass::webtsys_query('select '.$arr_distinct[$this->distinct].' '.$fields.' from '.$selected_models.' '.$conditions, $this->db_selected); + + } + else + { + + + + } $this->distinct=0;