noalyss Version-9
|
Interface : this wrapper is used to created easily a wrapper to a table (ORM) You must create a class extending this one, in the constructor these variables have to be defined. More...
Inherits Data_SQL.
Inherited by Acc_Other_Tax_SQL, Action_Gestion_Comment_SQL, Action_Gestion_SQL, Anc_Key_Activity_SQL, Anc_Key_Detail_SQL, Anc_Key_Ledger_SQL, Anc_Key_SQL, Attr_Def_SQL, Contact_option_ref_SQL, Currency_SQL, Currency_history_SQL, Default_Menu_SQL, Document_State_SQL, Document_type_SQL, Fiche_def_ref_SQL, Forecast_Category_SQL, Forecast_Item_SQL, Forecast_SQL, Form_Definition_SQL, Form_Detail_SQL, Jrn_Note_SQL, Jrn_Tax_SQL, Jrn_def_SQL, Jrn_periode_SQL, Menu_Ref_SQL, Noalyss_SQL, Op_Predef_SQL, Operation_Exercice_Detail_SQL, Operation_Exercice_SQL, Operation_currency_SQL, Parameter_Extra_SQL, Parm_periode_SQL, Payment_method_SQL, Poste_analytique_SQL, Profile_Menu_sql, Profile_Mobile_SQL, Profile_sql, Quant_Fin_SQL, Quant_Purchase_SQL, Quant_Sold_SQL, Stock_Change_Sql, Stock_Goods_Sql, Stock_Sql, Tag_SQL, Tag_group_SQL, Tmp_Pcmn_SQL, Tva_Rate_SQL, User_filter_SQL, and V_Tva_Rate_SQL.
Public Member Functions | |
__construct ($p_cn, $p_id=-1) | |
build_query () | |
Build the SQL select statement for querying the object and returns it. More... | |
column_update ($column_expr, $value) | |
update the value of a column with an expression for $value for the current record More... | |
count ($p_where="", $p_array=null) | |
return the number of count in the table corresponding to the where condition More... | |
delete () | |
exist () | |
Count the number of record with the id ,. More... | |
get_all_to_array ($p_key_col, $p_cond="", $p_array=NULL) | |
Get all the row and use the p_key_code are the key value of array. More... | |
insert () | |
load () | |
Load the current row return false if not found. More... | |
seek ($cond='', $p_array=null) | |
retrieve array of object thanks a condition More... | |
update () | |
Public Member Functions inherited from Data_SQL | |
__construct (DatabaseCore $p_cn, $p_id=-1) | |
__toString () | |
collect_objects ($cond='', $p_array=null) | |
return an array of objects. More... | |
count ($p_where="", $p_array=null) | |
delete () | |
exist () | |
Count the number of record with the id ,. More... | |
from_array ($p_array) | |
Transform an array into object. More... | |
get ($p_string) | |
get the value thanks the colum name and not the alias (name). More... | |
get_cn () | |
get_info () | |
get_name () | |
get_object ($p_ret, $idx) | |
get_pk_value () | |
get_primary_key () | |
get_type () | |
getp ($p_string) | |
set the value thanks the alias name instead of the colum name More... | |
insert () | |
load () | |
Load the current row return false if not found. More... | |
next ($ret, $i) | |
get_seek return the next object, the return of the query must have all the column of the object More... | |
save () | |
Insert or update : if the row already exists, update otherwise insert. More... | |
seek ($cond='', $p_array=null) | |
retrieve array of object thanks a condition More... | |
set ($p_string, $p_value) | |
set the value thanks the colum name and not the alias (name) More... | |
set_cn ($cn) | |
set_name ($name) | |
set_pk_value ($p_value) | |
set_primary_key ($primary_key) | |
set_type ($type) | |
setp ($p_string, $p_value) | |
set the value thanks the alias name instead of the colum name More... | |
to_array ($prefix="") | |
Turn an object (row) into an array, and the key could be prefixed with $prefix. More... | |
to_row ($p_array) | |
turns a row fetched from the DB into a SQL object in updating all his attribute More... | |
update () | |
verify () | |
Additional Inherited Members | |
Data Fields inherited from Data_SQL | |
$cn | |
$date_format | |
Type of the data. More... | |
$default | |
defaullt date format More... | |
$name | |
Database connection. More... | |
$primary_key | |
Array of logical and real name. More... | |
$table | |
$type | |
Column name of the primary key. More... | |
Interface : this wrapper is used to created easily a wrapper to a table (ORM) You must create a class extending this one, in the constructor these variables have to be defined.
Match a table or a view into an object, you need to add the code for each table.
After you call the parent constructor
Definition at line 89 of file table_data_sql.class.php.
Table_Data_SQL::__construct | ( | $p_cn, | |
$p_id = -1 |
|||
) |
Reimplemented in Stock_Goods_Sql, Stock_Change_Sql, Stock_Sql, Profile_Menu, Anc_Key_SQL, Anc_Key_Activity_SQL, and Tmp_Pcmn_SQL.
Definition at line 93 of file table_data_sql.class.php.
References $p_id.
Table_Data_SQL::build_query | ( | ) |
Build the SQL select statement for querying the object and returns it.
Definition at line 257 of file table_data_sql.class.php.
References Data_SQL\$primary_key, $sep, $sql, name, and type.
Referenced by load().
Table_Data_SQL::column_update | ( | $column_expr, | |
$value | |||
) |
update the value of a column with an expression for $value for the current record
$column_exp | string like column = $1 or column=function($1) |
$value | value replacing $1 |
Definition at line 152 of file table_data_sql.class.php.
References Data_SQL\$primary_key, $sql, $value, and cn.
Table_Data_SQL::count | ( | $p_where = "" , |
|
$p_array = null |
|||
) |
return the number of count in the table corresponding to the where condition
string | $p_where | the condition appended to the SQL select query , where must be given |
array | $p_array | variable from the $p_where condition |
Reimplemented from Data_SQL.
Definition at line 239 of file table_data_sql.class.php.
References $count, $p_array, and cn.
Referenced by get_all_to_array(), and Stock_Goods\take_last_inventory().
Table_Data_SQL::delete | ( | ) |
Reimplemented from Data_SQL.
Definition at line 137 of file table_data_sql.class.php.
References Data_SQL\$primary_key, $sql, and cn.
Table_Data_SQL::exist | ( | ) |
Count the number of record with the id ,.
Reimplemented from Data_SQL.
Definition at line 247 of file table_data_sql.class.php.
References $count, Data_SQL\$primary_key, cn, and table.
Table_Data_SQL::get_all_to_array | ( | $p_key_col, | |
$p_cond = "" , |
|||
$p_array = NULL |
|||
) |
Get all the row and use the p_key_code are the key value of array.
The key column is usually the primary key or any unique key. the returns looks like
string | $p_key_col | existing and unique key |
string | $p_cond | sql cond |
array | $p_array | array of value for the SQL condition |
Definition at line 294 of file table_data_sql.class.php.
References $i, $nb_array, $p_array, $ret, count(), DatabaseCore\fetch_all(), record_log(), and seek().
Table_Data_SQL::insert | ( | ) |
Reimplemented from Data_SQL.
Definition at line 100 of file table_data_sql.class.php.
References $array, $idx, Data_SQL\$primary_key, $sep, $sql, $value, cn, name, type, and Data_SQL\verify().
Table_Data_SQL::load | ( | ) |
Load the current row return false if not found.
Reimplemented from Data_SQL.
Definition at line 192 of file table_data_sql.class.php.
References Data_SQL\$primary_key, $result, $sql, $value, build_query(), and cn.
Table_Data_SQL::seek | ( | $cond = '' , |
|
$p_array = null |
|||
) |
retrieve array of object thanks a condition
$cond | condition (where clause) (optional by default all the rows are fetched) you can use this parameter for the order or subselect |
$p_array | array for the SQL stmt |
Reimplemented from Data_SQL.
Definition at line 225 of file table_data_sql.class.php.
References $p_array, $ret, $sql, and cn.
Referenced by get_all_to_array().
Table_Data_SQL::update | ( | ) |
Reimplemented from Data_SQL.
Definition at line 159 of file table_data_sql.class.php.
References $array, $idx, Data_SQL\$primary_key, $sep, $sql, $value, cn, name, type, and Data_SQL\verify().