Added method for raw queries
This commit is contained in:
parent
3a8a077774
commit
a85e3ced05
1 changed files with 37 additions and 3 deletions
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue