Commit a64900e4b5e04eaf0850b5d9cf65bd1558eb4912
1 parent
77230f8d
add update row from lwa according to provided VTM
Showing
4 changed files
with
41 additions
and
2 deletions
Show diff stats
controller/hk_rows_import.anubis
| @@ -344,7 +344,7 @@ public define Result(String, String) | @@ -344,7 +344,7 @@ public define Result(String, String) | ||
| 344 | //file | 344 | //file |
| 345 | //csv_sep | 345 | //csv_sep |
| 346 | //col_x = 'target_col', where x is the column number in csv file and target_col is name of the column in the table | 346 | //col_x = 'target_col', where x is the column number in csv file and target_col is name of the column in the table |
| 347 | - //with _T = make_translate_function(_session.language), | 347 | + //with _T = make_translate_function(_session), |
| 348 | with lwa = *_session.web_request.lwa, | 348 | with lwa = *_session.web_request.lwa, |
| 349 | with separator = get_String(lwa, "csv_sep", ";"), | 349 | with separator = get_String(lwa, "csv_sep", ";"), |
| 350 | with csv_db_columns = get_columns_list(lwa), | 350 | with csv_db_columns = get_columns_list(lwa), |
| 1 | +/* | ||
| 2 | + * Created by PyramIDE. | ||
| 3 | + * User: フランスのトトロ aka (David RENÉ) | ||
| 4 | + * Date: 19/04/2020 | ||
| 5 | + * Time: 18:35 | ||
| 6 | + * © David RENÉ | ||
| 7 | + */ | ||
| 8 | + | ||
| 9 | +read xlib/web/CXM_web_arg_utils.anubis | ||
| 10 | + | ||
| 11 | +read hayamiki_lib/view/view_table_manager_types.anubis | ||
| 12 | +read hayamiki_lib/types/hayamiki.anubis | ||
| 13 | + | ||
| 14 | +public define Maybe(Int) | ||
| 15 | + update_row | ||
| 16 | + ( | ||
| 17 | + SQLite3DataBase db, | ||
| 18 | + VTM _vtm, | ||
| 19 | + List(Web_arg) _lwa | ||
| 20 | + )= | ||
| 21 | + | ||
| 22 | + with table_name = get_String(_lwa, "table_name", ""), // table name | ||
| 23 | + | ||
| 24 | + if get_hk_controller(_vtm.hk_controllers, table_name) is | ||
| 25 | + { | ||
| 26 | + failure then println("can't get writer for "+table_name);failure, | ||
| 27 | + success(controller) then | ||
| 28 | + //forget(map((HK_Trigger trigger) |-> println("call trigger before update "+trigger.trigger_name+" ON table "+table_name); trigger.trigger_call_back(db, _session), *controller.triggers.before_update)); | ||
| 29 | + | ||
| 30 | + if controller.write_from_fields(db, _lwa) is | ||
| 31 | + { | ||
| 32 | + failure then failure, | ||
| 33 | + success(inserted_idx) then | ||
| 34 | + //replace_Int(_session.fields, "hk_last_insert_idx", inserted_idx); | ||
| 35 | + //forget(map((HK_Trigger trigger) |-> println("call trigger after update "+trigger.trigger_name+" ON table "+table_name); trigger.trigger_call_back(db, _session), *controller.triggers.after_update)); | ||
| 36 | + success(inserted_idx) | ||
| 37 | + } | ||
| 38 | + } | ||
| 39 | +. |
model/load_dbm.anubis
| @@ -36,6 +36,7 @@ public define List(Migration) | @@ -36,6 +36,7 @@ public define List(Migration) | ||
| 36 | String app_name | 36 | String app_name |
| 37 | ) | 37 | ) |
| 38 | = | 38 | = |
| 39 | + println("all_migrations files from "+app_dbm_path+" application "+app_name); | ||
| 39 | with files = directory_list(app_dbm_path, app_name+"_dbm_to_v*.adm"), | 40 | with files = directory_list(app_dbm_path, app_name+"_dbm_to_v*.adm"), |
| 40 | all_list = map_select((String file_name) |-> load_dbm(app_dbm_path+file_name), files), | 41 | all_list = map_select((String file_name) |-> load_dbm(app_dbm_path+file_name), files), |
| 41 | merge_sort(all_list, migration_less) | 42 | merge_sort(all_list, migration_less) |
model/utils.anubis