This commit is contained in:
Antonio de la Rosa 2016-04-08 04:40:32 +02:00
parent 545286bd4e
commit 82c5f8b7a0
3 changed files with 29 additions and 6 deletions

View file

@ -4,6 +4,7 @@ namespace PhangoApp\PhaModels\CoreFields;
use PhangoApp\PhaModels\CoreFields\CharField; use PhangoApp\PhaModels\CoreFields\CharField;
use PhangoApp\PhaUtils\Utils; use PhangoApp\PhaUtils\Utils;
use PhangoApp\PhaI18n\I18n;
class IpField extends CharField { class IpField extends CharField {
@ -29,4 +30,4 @@ class IpField extends CharField {
} }
?> ?>

View file

@ -50,6 +50,13 @@ class SQLClass {
return $num_rows; return $num_rows;
} }
static public function free_result($result)
{
}
static public function webtsys_close( $idconnection ) static public function webtsys_close( $idconnection )
{ {

View file

@ -521,7 +521,7 @@ class Webmodel {
public function connect_to_db() public function connect_to_db()
{ {
include(__DIR__.'/Databases/'.Webmodel::$type_db.'.php'); include_once(__DIR__.'/Databases/'.Webmodel::$type_db.'.php');
if(!SQLClass::webtsys_connect( Webmodel::$host_db[$this->db_selected], Webmodel::$login_db[$this->db_selected], Webmodel::$pass_db[$this->db_selected] , $this->db_selected)) if(!SQLClass::webtsys_connect( Webmodel::$host_db[$this->db_selected], Webmodel::$login_db[$this->db_selected], Webmodel::$pass_db[$this->db_selected] , $this->db_selected))
{ {
@ -863,7 +863,7 @@ class Webmodel {
public function insert($post, $safe_query=0, $cache_name='') public function insert($post, $safe_query=0, $cache_name='')
{ {
$this->post=&$post; //$this->post=$post;
$this->set_phango_connection(); $this->set_phango_connection();
@ -887,7 +887,7 @@ class Webmodel {
if( $fields=$this->check_all($post, $safe_query) ) if( $fields=$this->check_all($post, $safe_query) )
{ {
if( !( $query=SQLClass::webtsys_query($this->prepare_insert_sql($fields), $this->db_selected) ) ) if( !( $query=SQLClass::webtsys_query($this->prepare_insert_sql($fields), $this->db_selected) ) )
{ {
@ -944,7 +944,7 @@ class Webmodel {
public function update($post, $safe_query=0, $cache_name='') public function update($post, $safe_query=0, $cache_name='')
{ {
$this->post=&$post; $this->post=$post;
$this->set_phango_connection(); $this->set_phango_connection();
@ -956,6 +956,7 @@ class Webmodel {
$arr_fields=array(); $arr_fields=array();
//Unset the id field from the model for security //Unset the id field from the model for security
if(!$this->modify_id) if(!$this->modify_id)
@ -1836,7 +1837,7 @@ class Webmodel {
} }
$arr_components=array(); $arr_components=array();
$set_error=0; $set_error=0;
$arr_std_error=array(); $arr_std_error=array();
@ -2340,6 +2341,20 @@ class Webmodel {
} }
/**
* Close connection, you need this if use ReactPHP or some
*
*/
public function close()
{
Webmodel::$connection_func[$this->db_selected]='connect_to_db';
return SQLClass::webtsys_close(Webmodel::$connection[$this->db_selected]);
}
} }