noalyss Version-9
|
this an abstract class , all the SQL class, like noalyss_sql (table), Acc_Plan_SQL (based on a SQL not a table) or a view. More...
Public Member Functions | |
__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 () | |
Data Fields | |
$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... | |
this an abstract class , all the SQL class, like noalyss_sql (table), Acc_Plan_SQL (based on a SQL not a table) or a view.
You must create a class extending this one, in the constructor these variables have to be defined
if you give a SQL or a View you have to give a primary key, usually , the best is to use a key composed of different PK of the tables Example : in this SQL (or view) the PK is id and it is composed with the PK f_id and sg_id , remember that the pk cannot be null and must be unique ! For SQL , the value is computed , so you need a subselect like this
For SQL , the value is computed , so you need a subselect like this
the type is an array , key = column name , value = type
Definition at line 96 of file data_sql.class.php.
Data_SQL::__construct | ( | DatabaseCore | $p_cn, |
$p_id = -1 |
|||
) |
Reimplemented in Acc_Other_Tax_SQL, Action_Gestion_Comment_SQL, Action_Gestion_SQL, Attr_Def_SQL, Contact_option_ref_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_def_SQL, Jrn_Note_SQL, Jrn_periode_SQL, Jrn_Tax_SQL, Op_Predef_SQL, Operation_Exercice_Detail_SQL, Operation_Exercice_SQL, Parameter_Extra_SQL, Parm_periode_SQL, Payment_method_SQL, Poste_analytique_SQL, Profile_Mobile_SQL, Quant_Fin_SQL, Quant_Purchase_SQL, Quant_Sold_SQL, Tag_group_SQL, Tva_Rate_SQL, User_filter_SQL, and V_Tva_Rate_SQL.
Definition at line 121 of file data_sql.class.php.
References $p_id, $primary_key, cn, count(), load(), name, and type.
Data_SQL::__toString | ( | ) |
Definition at line 106 of file data_sql.class.php.
Data_SQL::collect_objects | ( | $cond = '' , |
|
$p_array = null |
|||
) |
return an array of objects.
Do not use this function if they are too many objects, it takes a lot of memory, and could slow down your application.
$cond | condition, order... |
$p_array | array to use for a condition |
Definition at line 362 of file data_sql.class.php.
References $i, $max, $p_array, $ret, next(), DatabaseCore\num_row(), and seek().
|
abstract |
Reimplemented in Acc_Plan_SQL, V_Contact_SQL, V_Currency_Last_Value_SQL, and Table_Data_SQL.
Referenced by __construct().
|
abstract |
Reimplemented in Acc_Plan_SQL, V_Contact_SQL, V_Currency_Last_Value_SQL, and Table_Data_SQL.
|
abstract |
Count the number of record with the id ,.
Reimplemented in Acc_Plan_SQL, V_Contact_SQL, V_Currency_Last_Value_SQL, and Table_Data_SQL.
Referenced by save().
Data_SQL::from_array | ( | $p_array | ) |
Data_SQL::get | ( | $p_string | ) |
get the value thanks the colum name and not the alias (name).
Definition at line 161 of file data_sql.class.php.
References type.
Data_SQL::get_cn | ( | ) |
Definition at line 384 of file data_sql.class.php.
References $cn.
Referenced by Operation_Exercice\input_row().
Data_SQL::get_info | ( | ) |
Definition at line 257 of file data_sql.class.php.
Data_SQL::get_name | ( | ) |
Definition at line 389 of file data_sql.class.php.
References $name.
Data_SQL::get_object | ( | $p_ret, | |
$idx | |||
) |
Definition at line 349 of file data_sql.class.php.
Data_SQL::get_pk_value | ( | ) |
Reimplemented in Acc_Plan_SQL.
Definition at line 222 of file data_sql.class.php.
References $primary_key.
Data_SQL::get_primary_key | ( | ) |
Definition at line 394 of file data_sql.class.php.
References $primary_key.
Data_SQL::get_type | ( | ) |
Data_SQL::getp | ( | $p_string | ) |
set the value thanks the alias name instead of the colum name
Definition at line 187 of file data_sql.class.php.
Referenced by Operation_Exercice\input_row().
|
abstract |
Reimplemented in Acc_Plan_SQL, V_Contact_SQL, V_Currency_Last_Value_SQL, and Table_Data_SQL.
Referenced by save().
|
abstract |
Load the current row return false if not found.
Reimplemented in Acc_Plan_SQL, V_Contact_SQL, V_Currency_Last_Value_SQL, and Table_Data_SQL.
Referenced by __construct().
Data_SQL::next | ( | $ret, | |
$i | |||
) |
get_seek return the next object, the return of the query must have all the column of the object
$p_ret | is the return value of an exec_sql |
$idx | is the index |
Definition at line 340 of file data_sql.class.php.
References $array, $i, $ret, cn, and from_array().
Referenced by collect_objects(), and get_object().
Data_SQL::save | ( | ) |
Insert or update : if the row already exists, update otherwise insert.
Definition at line 148 of file data_sql.class.php.
References $count, exist(), insert(), and update().
|
abstract |
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 in Acc_Plan_SQL, V_Contact_SQL, V_Currency_Last_Value_SQL, and Table_Data_SQL.
Referenced by collect_objects().
Data_SQL::set | ( | $p_string, | |
$p_value | |||
) |
set the value thanks the colum name and not the alias (name)
Definition at line 174 of file data_sql.class.php.
References type.
Data_SQL::set_cn | ( | $cn | ) |
Data_SQL::set_name | ( | $name | ) |
Data_SQL::set_pk_value | ( | $p_value | ) |
Definition at line 217 of file data_sql.class.php.
References $primary_key.
Data_SQL::set_primary_key | ( | $primary_key | ) |
string | $primary_key |
Definition at line 424 of file data_sql.class.php.
References $primary_key.
Data_SQL::set_type | ( | $type | ) |
Data_SQL::setp | ( | $p_string, | |
$p_value | |||
) |
set the value thanks the alias name instead of the colum name
Definition at line 201 of file data_sql.class.php.
Data_SQL::to_array | ( | $prefix = "" | ) |
Turn an object (row) into an array, and the key could be prefixed with $prefix.
string | $prefix | before the key |
Definition at line 301 of file data_sql.class.php.
Data_SQL::to_row | ( | $p_array | ) |
turns a row fetched from the DB into a SQL object in updating all his attribute
$p_array |
Definition at line 317 of file data_sql.class.php.
References $name, $p_array, and name.
Referenced by V_Contact_SQL\load().
|
abstract |
Reimplemented in Acc_Plan_SQL, V_Contact_SQL, V_Currency_Last_Value_SQL, and Table_Data_SQL.
Referenced by save().
Data_SQL::verify | ( | ) |
Reimplemented in Menu_Ref.
Definition at line 265 of file data_sql.class.php.
References name, and noalyss_trim().
Referenced by Table_Data_SQL\insert(), and Table_Data_SQL\update().
Data_SQL::$cn |
Definition at line 98 of file data_sql.class.php.
Referenced by Stock_Goods_Sql\__construct(), Stock_Change_Sql\__construct(), Stock_Sql\__construct(), Default_Menu_SQL\__construct(), Stock\build_tmp_table(), Stock\create_query_histo(), get_cn(), Stock_Goods\input(), Stock_Goods\record_save(), set_cn(), Stock\summary(), and Stock_Goods\take_last_inventory().
Data_SQL::$date_format |
Type of the data.
Definition at line 102 of file data_sql.class.php.
Data_SQL::$default |
defaullt date format
Definition at line 103 of file data_sql.class.php.
Data_SQL::$name |
Database connection.
Definition at line 99 of file data_sql.class.php.
Referenced by __toString(), get_name(), set_name(), and to_row().
Data_SQL::$primary_key |
Array of logical and real name.
Definition at line 100 of file data_sql.class.php.
Referenced by __construct(), Table_Data_SQL\build_query(), Table_Data_SQL\column_update(), Table_Data_SQL\delete(), V_Currency_Last_Value_SQL\exist(), Table_Data_SQL\exist(), get_pk_value(), get_primary_key(), Table_Data_SQL\insert(), Acc_Plan_SQL\load(), V_Currency_Last_Value_SQL\load(), Table_Data_SQL\load(), set_pk_value(), set_primary_key(), and Table_Data_SQL\update().
Data_SQL::$table |
Definition at line 104 of file data_sql.class.php.
Data_SQL::$type |
Column name of the primary key.
Definition at line 101 of file data_sql.class.php.
Referenced by get_type(), and set_type().