Commit 53075ced7a6faa784f08a4bd38bc46ed76f92c1e

Authored by David RENÉ
1 parent 0dc1ce02

add label and column name in primary_key alternative. This allows to see and edi…

…t the DB_id other than the first "id"
update the fs_file database
hayamiki_lib @ d169d6079aa
1 -Subproject commit d57036b4baa16371f6eedbf8ff6e4361f4e89081 1 +Subproject commit d169d6079aaa2b2a29f999b0047feb3d057f84b1
src/generation/vt_view.anubis
@@ -44,7 +44,7 @@ define String @@ -44,7 +44,7 @@ define String
44 since col is hk_column(name, col_type, _, help), 44 since col is hk_column(name, col_type, _, help),
45 if col_type is 45 if col_type is
46 { 46 {
47 - p_key then "primary_key", 47 + p_key then "primary_key(\""+to_upper(name)+"\", \""+name+"\")",
48 boolean_field then "boolean(\""+to_upper(name)+"\", \""+name+"\", "+to_Anubis_source(help)+")", 48 boolean_field then "boolean(\""+to_upper(name)+"\", \""+name+"\", "+to_Anubis_source(help)+")",
49 date_field(attrs) then "date(\""+to_upper(name)+"\", \""+name+"\", "+to_Anubis_source(help)+")", 49 date_field(attrs) then "date(\""+to_upper(name)+"\", \""+name+"\", "+to_Anubis_source(help)+")",
50 time_field(attrs) then "time(\""+to_upper(name)+"\", \""+name+"\", "+to_Anubis_source(help)+")", 50 time_field(attrs) then "time(\""+to_upper(name)+"\", \""+name+"\", "+to_Anubis_source(help)+")",
src/web_controller/database/generated/fs_file.anubis
1 /* 1 /*
2 * Created by 早見木 (Hayamiki). 2 * Created by 早見木 (Hayamiki).
3 * Database generator written by フランスのトトロ aka (David RENÉ) 3 * Database generator written by フランスのトトロ aka (David RENÉ)
4 - * Date: 2020-04-11  
5 - * Time: 10:13:41 4 + * Date: 2022-10-23
  5 + * Time: 17:24:03
6 * 6 *
7 */ 7 */
8 transmit tools/basis.anubis 8 transmit tools/basis.anubis
@@ -135,6 +135,7 @@ public define List(SQLite3_update_field) @@ -135,6 +135,7 @@ public define List(SQLite3_update_field)
135 List(Web_arg) lwa, 135 List(Web_arg) lwa,
136 String __prefix__ 136 String __prefix__
137 )= 137 )=
  138 + (List(SQLite3_update_field))
138 []+ 139 []+
139 []+ 140 []+
140 [field("write_date", bind_Datetime(":v_write_date", db_now))]+ 141 [field("write_date", bind_Datetime(":v_write_date", db_now))]+
@@ -165,7 +166,7 @@ public define Maybe(Fs_file) @@ -165,7 +166,7 @@ public define Maybe(Fs_file)
165 row(cursor) then 166 row(cursor) then
166 success( 167 success(
167 fs_file( 168 fs_file(
168 - db_id((Int)db_integer(cursor)(0)) /* id */, 169 + db_id_or_null(cursor)(0) /* id */,
169 db_datetime(text(cursor)(1)) /* create_date */, 170 db_datetime(text(cursor)(1)) /* create_date */,
170 db_datetime(text(cursor)(2)) /* write_date */, 171 db_datetime(text(cursor)(2)) /* write_date */,
171 text(cursor)(3) /* res_model */, 172 text(cursor)(3) /* res_model */,
@@ -427,9 +428,14 @@ public define Maybe(Int) @@ -427,9 +428,14 @@ public define Maybe(Int)
427 }, 428 },
428 db_id(idx) then 429 db_id(idx) then
429 if sql_query_timeout(db, 430 if sql_query_timeout(db,
430 - "UPDATE fs_file SET 431 + "INSERT INTO fs_file
  432 + (\"id\", \"create_date\", \"write_date\", \"res_model\", \"res_name\", \"file_size\", \"res_id\", \"description\", \"res_field\", \"mimetype\", \"name\", \"url\", \"checksum\", \"datas_fname\", \"path\")
  433 + VALUES
  434 + (:v_id, :v_create_date, :v_write_date, :v_res_model, :v_res_name, :v_file_size, :v_res_id, :v_description, :v_res_field, :v_mimetype, :v_name, :v_url, :v_checksum, :v_datas_fname, :v_path)
  435 + ON CONFLICT( \"id\") DO UPDATE SET
431 \"write_date\" = :v_write_date, \"res_model\" = :v_res_model, \"res_name\" = :v_res_name, \"file_size\" = :v_file_size, \"res_id\" = :v_res_id, \"description\" = :v_description, \"res_field\" = :v_res_field, \"mimetype\" = :v_mimetype, \"name\" = :v_name, \"url\" = :v_url, \"checksum\" = :v_checksum, \"datas_fname\" = :v_datas_fname, \"path\" = :v_path 436 \"write_date\" = :v_write_date, \"res_model\" = :v_res_model, \"res_name\" = :v_res_name, \"file_size\" = :v_file_size, \"res_id\" = :v_res_id, \"description\" = :v_description, \"res_field\" = :v_res_field, \"mimetype\" = :v_mimetype, \"name\" = :v_name, \"url\" = :v_url, \"checksum\" = :v_checksum, \"datas_fname\" = :v_datas_fname, \"path\" = :v_path
432 - WHERE id = "+idx+";", 437 + WHERE id = :v_id;",
  438 + [bind_Int(":v_id", idx)]+
433 [ 439 [
434 bind_Datetime(":v_write_date", db_now), 440 bind_Datetime(":v_write_date", db_now),
435 bind_String_or_NULL(":v_res_model", fs_file.res_model), 441 bind_String_or_NULL(":v_res_model", fs_file.res_model),
@@ -458,7 +464,7 @@ public define Maybe(Int) @@ -458,7 +464,7 @@ public define Maybe(Int)
458 )= 464 )=
459 if extract_Fs_file_from_web_arg(lwa, "") is 465 if extract_Fs_file_from_web_arg(lwa, "") is
460 { 466 {
461 - failure then logError("update_fs_file extract_Fs_file_from_web_arg is failure"); failure, 467 + failure then logError("update_fs_file extract_Fs_file_from_web_arg is failure"); failure,
462 success(fs_file) then update_fs_file(db, fs_file) 468 success(fs_file) then update_fs_file(db, fs_file)
463 }. 469 }.
464 470
@@ -488,7 +494,17 @@ public define String @@ -488,7 +494,17 @@ public define String
488 failure then default_select, 494 failure then default_select,
489 success(obj) then obj.name 495 success(obj) then obj.name
490 } 496 }
491 - }. 497 + }
  498 +.
  499 +
  500 +public define String
  501 + get_fs_file_show_string
  502 + (
  503 + SQLite3DataBase db,
  504 + Fs_file obj
  505 + )=
  506 + obj.name
  507 +.
492 508
493 define List((List(CoreAttrs), WebArgValue, String)) 509 define List((List(CoreAttrs), WebArgValue, String))
494 _get_selector_fs_file 510 _get_selector_fs_file
@@ -501,11 +517,7 @@ define List((List(CoreAttrs), WebArgValue, String)) @@ -501,11 +517,7 @@ define List((List(CoreAttrs), WebArgValue, String))
501 { 517 {
502 [] then [selector_default_entry . reverse(so_far)], 518 [] then [selector_default_entry . reverse(so_far)],
503 [ h . t ] then 519 [ h . t ] then
504 - if h.id is  
505 - {  
506 - none then [selector_default_entry],  
507 - db_id(_id) then _get_selector_fs_file(db, t, [([], wav(to_String(_id)), get_fs_file_show_string(db, h.id)) . so_far])  
508 - } 520 + _get_selector_fs_file(db, t, [([], wav(to_String(h.id)), get_fs_file_show_string(db, h)) . so_far])
509 }. 521 }.
510 522
511 public define List((List(CoreAttrs), WebArgValue, String)) 523 public define List((List(CoreAttrs), WebArgValue, String))
@@ -552,7 +564,7 @@ define VT_view @@ -552,7 +564,7 @@ define VT_view
552 text("PATH") 564 text("PATH")
553 ]), 565 ]),
554 with model = vt_view_model([ 566 with model = vt_view_model([
555 - primary_key, 567 + primary_key("ID", "id"),
556 datetime("CREATE_DATE", "create_date", no_help_text), 568 datetime("CREATE_DATE", "create_date", no_help_text),
557 datetime("WRITE_DATE", "write_date", no_help_text), 569 datetime("WRITE_DATE", "write_date", no_help_text),
558 text("RES_MODEL", "res_model", no_help_text), 570 text("RES_MODEL", "res_model", no_help_text),
src/web_controller/hkc_files_management.anubis
@@ -64,7 +64,7 @@ public define (WEB_Session) -> WEB_Controller_Result @@ -64,7 +64,7 @@ public define (WEB_Session) -> WEB_Controller_Result
64 set_file(db, "hkc", hkc_file_id, filename, "file", filename, "hkc/"+to_fs_folder(hkc_file_id)); 64 set_file(db, "hkc", hkc_file_id, filename, "file", filename, "hkc/"+to_fs_folder(hkc_file_id));
65 ajax(json(http_ok, json_object([json_member("uploaded", json_int(1)), 65 ajax(json(http_ok, json_object([json_member("uploaded", json_int(1)),
66 json_member("fileName", json_string(filename)), 66 json_member("fileName", json_string(filename)),
67 - json_member("url", json_string("?aws_controller=hk_c&aws_action=download&file="+hkc_file_id))]))) 67 + json_member("url", json_string("?aws_c=hk_c&aws_a=download&file="+hkc_file_id))])))
68 else 68 else
69 println("move_file error from ["+temp_filepath+"] to ["+final_filename+"]"); 69 println("move_file error from ["+temp_filepath+"] to ["+final_filename+"]");
70 ajax(json(http_ok, json_object([json_member("uploaded", json_int(0)), 70 ajax(json(http_ok, json_object([json_member("uploaded", json_int(0)),
src/web_controller/types/generated/fs_file.anubis
1 /* 1 /*
2 * Created by 伝作 (Densaku). 2 * Created by 伝作 (Densaku).
3 * Types & Messages generator written by フランスのトトロ aka (David RENÉ) 3 * Types & Messages generator written by フランスのトトロ aka (David RENÉ)
4 - * Date: 2020-04-11  
5 - * Time: 10:14:04 4 + * Date: 2022-10-05
  5 + * Time: 23:24:45
6 * 6 *
7 */ 7 */
8 8
xlib @ 5b6fb40914b
1 -Subproject commit 18c01f914e2129eb9289c945d180fb45bc53b0d8 1 +Subproject commit 5b6fb40914b98ea594417dcdf319d98abd19a0b4