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.
|
* 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;
|
//Webmodel::$root_model='app/'.$name_model.'/'.Webmodel::$model_path;
|
||||||
|
|
@ -264,8 +264,18 @@ class Webmodel {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->cache=$cache;
|
||||||
|
$this->type_cache=$type_cache;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method for load models from a project.
|
* 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.
|
* This method insert a row in database using model how mirage of table.
|
||||||
*
|
*
|
||||||
|
|
@ -798,8 +821,19 @@ class Webmodel {
|
||||||
$arr_distinct[0]='';
|
$arr_distinct[0]='';
|
||||||
$arr_distinct[1]=' DISTINCT ';
|
$arr_distinct[1]=' DISTINCT ';
|
||||||
|
|
||||||
|
if($this->cache==0)
|
||||||
|
{
|
||||||
|
|
||||||
$query=SQLClass::webtsys_query('select '.$arr_distinct[$this->distinct].' '.$fields.' from '.$selected_models.' '.$conditions, $this->db_selected);
|
$query=SQLClass::webtsys_query('select '.$arr_distinct[$this->distinct].' '.$fields.' from '.$selected_models.' '.$conditions, $this->db_selected);
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
$this->distinct=0;
|
$this->distinct=0;
|
||||||
|
|
||||||
return $query;
|
return $query;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue