|
noalyss Version-10
NOALYSS : serveur de comptabilité et ERP (2002)
|
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...
Inheritance diagram for Data_SQL:
Collaboration diagram for Data_SQL:Public Member Functions | |
| __construct (DatabaseCore $p_cn, $p_id=-1) | |
| __get ($cols) | |
| __set ($cols, $p_value) | |
| __toString () | |
| collect_objects ($cond='', $p_array=null) | |
| return an array of objects. | |
| count ($p_where="", $p_array=null) | |
| delete () | |
| exist () | |
| Count the number of record with the id ,. | |
| from_array ($p_array) | |
| Transform an array into object. | |
| get ($cols) | |
| get the value thanks the colum name and not the alias (name). | |
| get_a_virtual_col () | |
| return array of virtual cols (alias calculated, formatted cols) | |
| get_cn () | |
| get_info () | |
| get_name () | |
| get_object ($p_ret, $idx) | |
| get_pk_value () | |
| get_primary_key () | |
| get_type () | |
| getp ($cols) | |
| set the value thanks the alias name instead of the colum name if not found try the column name | |
| insert () | |
| load () | |
| Load the current row return false if not found. | |
| next ($ret, $i) | |
| get_seek return the next object, the return of the query must have all the column of the object including the virtual columns | |
| save () | |
| Insert or update : if the row already exists, update otherwise insert. | |
| seek ($cond='', $p_array=null) | |
| retrieve array of object thanks a condition | |
| set ($cols, $p_value) | |
| set the value thanks the colum name and not the alias (name) | |
| set_cn ($cn) | |
| set_name ($name) | |
| set_pk_value ($p_value) | |
| set_primary_key ($primary_key) | |
| set_type ($type) | |
| set_virtual_col ($col_name, $sql_expression) | |
| add a virtual column (formatted column, sum of 2 col, ...) | |
| setp ($cols, $p_value) | |
| set the value thanks the alias name instead of the colum name, if not found try the column name | |
| to_array ($prefix="") | |
| Turn an object (row) into an array, and the key could be prefixed with $prefix. | |
| to_row ($p_array) | |
| update the data member of current object with the value from the array. | |
| update () | |
| verify () | |
Data Fields | |
| $cn | |
| $date_format | |
| Type of the data. | |
| $default | |
| defaullt date format | |
| $name | |
| Database connection. | |
| $primary_key | |
| Array of logical and real name. | |
| $table | |
| $type | |
| Column name of the primary key. | |
Protected Attributes | |
| $a_virtual_col | |
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 98 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 124 of file data_sql.class.php.
References $p_id, $primary_key, cn, count(), load(), name, and type.
Here is the call graph for this function:| Data_SQL::__get | ( | $cols | ) |
Definition at line 265 of file data_sql.class.php.
References EXC_DATA_SQL, and type.
| Data_SQL::__set | ( | $cols, | |
| $p_value ) |
Definition at line 252 of file data_sql.class.php.
References EXC_DATA_SQL, and type.
| Data_SQL::__toString | ( | ) |
Reimplemented in Table_Data_SQL.
Definition at line 108 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 454 of file data_sql.class.php.
References $i, $max, $p_array, $ret, $x, _, next(), DatabaseCore\num_row(), and seek().
Here is the call graph for this function:
|
abstract |
Reimplemented in Acc_Plan_SQL, Table_Data_SQL, V_Contact_SQL, and V_Currency_Last_Value_SQL.
References $p_array.
Referenced by __construct().
|
abstract |
Reimplemented in Acc_Plan_SQL, Table_Data_SQL, V_Contact_SQL, and V_Currency_Last_Value_SQL.
|
abstract |
Count the number of record with the id ,.
Reimplemented in Acc_Plan_SQL, Table_Data_SQL, V_Contact_SQL, and V_Currency_Last_Value_SQL.
Referenced by save().
| Data_SQL::from_array | ( | $p_array | ) |
| Data_SQL::get | ( | $cols | ) |
get the value thanks the colum name and not the alias (name).
Definition at line 184 of file data_sql.class.php.
References EXC_DATA_SQL, and type.
| Data_SQL::get_a_virtual_col | ( | ) |
return array of virtual cols (alias calculated, formatted cols)
Definition at line 165 of file data_sql.class.php.
References $a_virtual_col.
| Data_SQL::get_cn | ( | ) |
Definition at line 478 of file data_sql.class.php.
References $cn.
Referenced by Operation_Exercice\input_row().
| Data_SQL::get_info | ( | ) |
Definition at line 321 of file data_sql.class.php.
| Data_SQL::get_name | ( | ) |
Definition at line 483 of file data_sql.class.php.
References $name.
| Data_SQL::get_object | ( | $p_ret, | |
| $idx ) |
Definition at line 441 of file data_sql.class.php.
Here is the call graph for this function:| Data_SQL::get_pk_value | ( | ) |
Reimplemented in Acc_Plan_SQL.
Definition at line 286 of file data_sql.class.php.
References $primary_key.
| Data_SQL::get_primary_key | ( | ) |
Definition at line 488 of file data_sql.class.php.
References $primary_key.
| Data_SQL::get_type | ( | ) |
| Data_SQL::getp | ( | $cols | ) |
set the value thanks the alias name instead of the colum name if not found try the column name
Definition at line 215 of file data_sql.class.php.
References $idx, EXC_DATA_SQL, name, and type.
Referenced by Operation_Exercice\input_row().
|
abstract |
Reimplemented in Acc_Plan_SQL, Table_Data_SQL, V_Contact_SQL, and V_Currency_Last_Value_SQL.
Referenced by save().
|
abstract |
Load the current row return false if not found.
Reimplemented in Acc_Plan_SQL, Table_Data_SQL, V_Contact_SQL, and V_Currency_Last_Value_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 including the virtual columns
| $p_ret | is the return value of an exec_sql |
| $idx | is the index |
Definition at line 421 of file data_sql.class.php.
References $array, $i, $ret, cn, and from_array().
Referenced by collect_objects(), and get_object().
Here is the call graph for this function:| Data_SQL::save | ( | ) |
Insert or update : if the row already exists, update otherwise insert.
Definition at line 152 of file data_sql.class.php.
References $count, exist(), insert(), and update().
Here is the call graph for this function:
|
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, Table_Data_SQL, V_Contact_SQL, and V_Currency_Last_Value_SQL.
References $p_array.
Referenced by collect_objects().
| Data_SQL::set | ( | $cols, | |
| $p_value ) |
set the value thanks the colum name and not the alias (name)
Definition at line 200 of file data_sql.class.php.
References EXC_DATA_SQL, and type.
| Data_SQL::set_cn | ( | $cn | ) |
| Data_SQL::set_name | ( | $name | ) |
| Data_SQL::set_pk_value | ( | $p_value | ) |
Definition at line 281 of file data_sql.class.php.
References $primary_key.
| Data_SQL::set_primary_key | ( | $primary_key | ) |
| string | $primary_key |
Definition at line 518 of file data_sql.class.php.
References $primary_key.
| Data_SQL::set_type | ( | $type | ) |
| Data_SQL::set_virtual_col | ( | $col_name, | |
| $sql_expression ) |
add a virtual column (formatted column, sum of 2 col, ...)
| $col_name | (string) name of the column , will be use in get , getp |
| $sql_expression | (string) SQL Expression for the column like "to_char(col1,'DD.MM.YY HH24:MI:SS')", col1+col2, ... |
Definition at line 177 of file data_sql.class.php.
| Data_SQL::setp | ( | $cols, | |
| $p_value ) |
set the value thanks the alias name instead of the colum name, if not found try the column name
Definition at line 237 of file data_sql.class.php.
References $idx, EXC_DATA_SQL, name, and type.
| 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 365 of file data_sql.class.php.
| Data_SQL::to_row | ( | $p_array | ) |
update the data member of current object with the value from the array.
includes the virtual column, usefull if need to update several columns in once
| $p_array | (array) associative key = column_vale, value new value for this col. |
Definition at line 388 of file data_sql.class.php.
References $name, $p_array, and name.
Referenced by V_Contact_SQL\load().
|
abstract |
Reimplemented in Acc_Plan_SQL, Table_Data_SQL, V_Contact_SQL, and V_Currency_Last_Value_SQL.
Referenced by save().
| Data_SQL::verify | ( | ) |
Reimplemented in Menu_Ref.
Definition at line 329 of file data_sql.class.php.
References name, and noalyss_trim().
Referenced by Table_Data_SQL\insert(), and Table_Data_SQL\update().
Here is the call graph for this function:
|
protected |
Definition at line 107 of file data_sql.class.php.
Referenced by get_a_virtual_col().
| Data_SQL::$cn |
Definition at line 100 of file data_sql.class.php.
Referenced by Default_Menu_SQL\__construct(), Stock_Change_Sql\__construct(), Stock_Goods_Sql\__construct(), Stock_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 104 of file data_sql.class.php.
| Data_SQL::$default |
defaullt date format
Definition at line 105 of file data_sql.class.php.
| Data_SQL::$name |
Database connection.
Definition at line 101 of file data_sql.class.php.
Referenced by __toString(), Table_Data_SQL\__toString(), get_name(), set_name(), and to_row().
| Data_SQL::$primary_key |
Array of logical and real name.
Definition at line 102 of file data_sql.class.php.
Referenced by __construct(), Table_Data_SQL\build_query(), Table_Data_SQL\column_update(), Table_Data_SQL\delete(), Table_Data_SQL\exist(), V_Currency_Last_Value_SQL\exist(), get_pk_value(), get_primary_key(), Table_Data_SQL\insert(), Acc_Plan_SQL\load(), Table_Data_SQL\load(), V_Currency_Last_Value_SQL\load(), set_pk_value(), set_primary_key(), and Table_Data_SQL\update().
| Data_SQL::$table |
Definition at line 106 of file data_sql.class.php.
| Data_SQL::$type |
Column name of the primary key.
Definition at line 103 of file data_sql.class.php.
Referenced by get_type(), and set_type().