Commit 8abaa6f5ddef4dc974b002dd097b09b9fa761f74
1 parent
cb2a37a5
add searchable fields in generation of foreign key
add generation of the hk_table_controller_list
Showing
15 changed files
with
56 additions
and
32 deletions
Show diff stats
calexium_lib @ 27e8cf1ccd9
hayamiki_lib @ c35a0960043
src/check.anubis
| @@ -42,7 +42,8 @@ define Maybe(HK_Model_Column) | @@ -42,7 +42,8 @@ define Maybe(HK_Model_Column) | ||
| 42 | HK_Model_Column col | 42 | HK_Model_Column col |
| 43 | )= | 43 | )= |
| 44 | since col is hk_column(name, type, attrib, help), | 44 | since col is hk_column(name, type, attrib, help), |
| 45 | - if type is foreign_key(fk_app, fk_table) then | 45 | + if type is foreign_key(fk_app, fk_table, fields) then |
| 46 | + //TODO check for searchable fields if exists in foreign table | ||
| 46 | with mb_fk_app = if (fk_app) is | 47 | with mb_fk_app = if (fk_app) is |
| 47 | { | 48 | { |
| 48 | this then println("this found replaced by "+current_app_name+" in app '"+current_app_name+"' table '"+table_name+"' column '"+name+"'"); | 49 | this then println("this found replaced by "+current_app_name+" in app '"+current_app_name+"' table '"+table_name+"' column '"+name+"'"); |
| @@ -58,7 +59,7 @@ define Maybe(HK_Model_Column) | @@ -58,7 +59,7 @@ define Maybe(HK_Model_Column) | ||
| 58 | if mb_fk_app is | 59 | if mb_fk_app is |
| 59 | { | 60 | { |
| 60 | failure then failure, | 61 | failure then failure, |
| 61 | - success(n_fk_app) then success(hk_column(name, foreign_key(if (fk_app) is app_name(_) then app_name(n_fk_app) else fk_app, (if length(n_fk_app)>0 then n_fk_app+"_"else "")+fk_table), attrib, help)) | 62 | + success(n_fk_app) then success(hk_column(name, foreign_key(if (fk_app) is app_name(_) then app_name(n_fk_app) else fk_app, (if length(n_fk_app)>0 then n_fk_app+"_"else "")+fk_table, fields), attrib, help)) |
| 62 | } | 63 | } |
| 63 | else | 64 | else |
| 64 | success(col). | 65 | success(col). |
src/generation/choices_selector.anubis
| @@ -59,7 +59,8 @@ define Maybe(One) | @@ -59,7 +59,8 @@ define Maybe(One) | ||
| 59 | " get_choices_selector_"+table_name+"_"+column_name+"\n"+ | 59 | " get_choices_selector_"+table_name+"_"+column_name+"\n"+ |
| 60 | " (\n"+ | 60 | " (\n"+ |
| 61 | " SQLite3DataBase db,\n"+ | 61 | " SQLite3DataBase db,\n"+ |
| 62 | - " String clause\n"+ | 62 | + " HK_Referer referer, //Not used, only there for compatibility\n"+ |
| 63 | + " String filter //Not used, only there for compatibility\n"+ | ||
| 63 | " )=\n"+ | 64 | " )=\n"+ |
| 64 | " [\n"+ | 65 | " [\n"+ |
| 65 | concat(map((HK_Int_Choice hk_int_choice) |-> | 66 | concat(map((HK_Int_Choice hk_int_choice) |-> |
src/generation/columns.anubis
| @@ -146,7 +146,7 @@ public define Maybe(String) | @@ -146,7 +146,7 @@ public define Maybe(String) | ||
| 146 | auto_now_add then | 146 | auto_now_add then |
| 147 | if insert then success(name) else failure | 147 | if insert then success(name) else failure |
| 148 | }, | 148 | }, |
| 149 | - foreign_key(_,_) then success(name), | 149 | + foreign_key(_,_,_) then success(name), |
| 150 | integer_field(_) then success(name), | 150 | integer_field(_) then success(name), |
| 151 | float_field then success(name), | 151 | float_field then success(name), |
| 152 | char_field(_,_) then success(name), | 152 | char_field(_,_) then success(name), |
| @@ -240,8 +240,12 @@ public define Maybe(String) | @@ -240,8 +240,12 @@ public define Maybe(String) | ||
| 240 | auto_now then success("information(\""+to_upper(col_name)+"\", \""+col_name+"\", "+type_name+"."+col_name+".datetime, 18, "+to_Anubis_source(help)+")"), | 240 | auto_now then success("information(\""+to_upper(col_name)+"\", \""+col_name+"\", "+type_name+"."+col_name+".datetime, 18, "+to_Anubis_source(help)+")"), |
| 241 | auto_now_add then success("information(\""+to_upper(col_name)+"\", \""+col_name+"\", "+type_name+"."+col_name+".datetime, 18, "+to_Anubis_source(help)+")") | 241 | auto_now_add then success("information(\""+to_upper(col_name)+"\", \""+col_name+"\", "+type_name+"."+col_name+".datetime, 18, "+to_Anubis_source(help)+")") |
| 242 | }, | 242 | }, |
| 243 | - foreign_key(app,foreign_table) then success("foreign_text(\""+to_upper(col_name)+"\", \""+col_name+"\", "+type_name+"."+col_name+", hk_form_selector(get_selector_"+foreign_table+"), "+to_Anubis_source(help)+")"), | ||
| 244 | - | 243 | + foreign_key(app,foreign_table,fields) then |
| 244 | + if length(fields) = 0 then | ||
| 245 | + success("foreign_text(\""+to_upper(col_name)+"\", \""+col_name+"\", "+type_name+"."+col_name+", hk_form_selector(get_selector_"+foreign_table+"), "+to_Anubis_source(help)+")") | ||
| 246 | + else | ||
| 247 | + with search_fields = join(", ", map((String field) |-> "\""+field+"\"",fields)), | ||
| 248 | + success("foreign_text_search(\""+to_upper(col_name)+"\", \""+col_name+"\", "+type_name+"."+col_name+", \""+foreign_table+"\", ["+search_fields+"]"+to_Anubis_source(help)+")"), | ||
| 245 | 249 | ||
| 246 | integer_field(choices) then | 250 | integer_field(choices) then |
| 247 | //success("integer(\""+to_upper(name)+"\", \""+name+"\", "+type_name+"."+name+", "+to_Anubis_source(help)+")"), | 251 | //success("integer(\""+to_upper(name)+"\", \""+name+"\", "+type_name+"."+name+", "+to_Anubis_source(help)+")"), |
| @@ -317,7 +321,7 @@ public define String | @@ -317,7 +321,7 @@ public define String | ||
| 317 | date_field(attrs) then "to_String("+current_type_name+"."+name+")", | 321 | date_field(attrs) then "to_String("+current_type_name+"."+name+")", |
| 318 | time_field(attrs) then "to_String("+current_type_name+"."+name+")", | 322 | time_field(attrs) then "to_String("+current_type_name+"."+name+")", |
| 319 | datetime_field(attrs) then "to_String("+current_type_name+"."+name+")" | 323 | datetime_field(attrs) then "to_String("+current_type_name+"."+name+")" |
| 320 | - foreign_key(app,foreign_table) then "get_"+foreign_table+"_show_string(db, "+current_type_name+"."+name+")", | 324 | + foreign_key(app,foreign_table,_) then "get_"+foreign_table+"_show_string(db, "+current_type_name+"."+name+")", |
| 321 | integer_field(_) then "to_String("+current_type_name+"."+name+")", | 325 | integer_field(_) then "to_String("+current_type_name+"."+name+")", |
| 322 | float_field then "float_to_string("+current_type_name+"."+name+",5)", | 326 | float_field then "float_to_string("+current_type_name+"."+name+",5)", |
| 323 | char_field(_,_) then current_type_name+"."+name, | 327 | char_field(_,_) then current_type_name+"."+name, |
src/generation/extractor.anubis
| @@ -25,7 +25,7 @@ public define String | @@ -25,7 +25,7 @@ public define String | ||
| 25 | date_field(_) then "db_date(text"+cursor_index+")", | 25 | date_field(_) then "db_date(text"+cursor_index+")", |
| 26 | time_field(_) then "db_time(text"+cursor_index+")", | 26 | time_field(_) then "db_time(text"+cursor_index+")", |
| 27 | datetime_field(_) then "db_datetime(text"+cursor_index+")", | 27 | datetime_field(_) then "db_datetime(text"+cursor_index+")", |
| 28 | - foreign_key(_,_) then "db_id((Int)db_integer"+cursor_index+")", | 28 | + foreign_key(_,_,_) then "db_id((Int)db_integer"+cursor_index+")", |
| 29 | integer_field(_) then "(Int)db_integer"+cursor_index, | 29 | integer_field(_) then "(Int)db_integer"+cursor_index, |
| 30 | float_field then "db_float"+cursor_index, | 30 | float_field then "db_float"+cursor_index, |
| 31 | char_field(_,_) then "text"+cursor_index, | 31 | char_field(_,_) then "text"+cursor_index, |
src/generation/fields.anubis
| @@ -30,7 +30,7 @@ public define String | @@ -30,7 +30,7 @@ public define String | ||
| 30 | date_field(_) then "DB_date", | 30 | date_field(_) then "DB_date", |
| 31 | time_field(_) then "DB_time", | 31 | time_field(_) then "DB_time", |
| 32 | datetime_field(_) then "DB_datetime", | 32 | datetime_field(_) then "DB_datetime", |
| 33 | - foreign_key(_,_) then "DB_id", | 33 | + foreign_key(_,_,_) then "DB_id", |
| 34 | integer_field(_) then "Int", | 34 | integer_field(_) then "Int", |
| 35 | float_field then "Float", | 35 | float_field then "Float", |
| 36 | char_field(_,_) then "String", | 36 | char_field(_,_) then "String", |
| @@ -55,7 +55,7 @@ public define String | @@ -55,7 +55,7 @@ public define String | ||
| 55 | date_field(_) then "extern_type(\"DB_date\", \"calexium_lib/database/db_types.anubis\")", | 55 | date_field(_) then "extern_type(\"DB_date\", \"calexium_lib/database/db_types.anubis\")", |
| 56 | time_field(_) then "extern_type(\"DB_time\", \"calexium_lib/database/db_types.anubis\")", | 56 | time_field(_) then "extern_type(\"DB_time\", \"calexium_lib/database/db_types.anubis\")", |
| 57 | datetime_field(_) then "extern_type(\"DB_datetime\", \"calexium_lib/database/db_types.anubis\")", | 57 | datetime_field(_) then "extern_type(\"DB_datetime\", \"calexium_lib/database/db_types.anubis\")", |
| 58 | - foreign_key(_,_) then "extern_type(\"DB_id\", \"calexium_lib/database/db_types.anubis\")", | 58 | + foreign_key(_,_,_) then "extern_type(\"DB_id\", \"calexium_lib/database/db_types.anubis\")", |
| 59 | integer_field(_) then "int", | 59 | integer_field(_) then "int", |
| 60 | float_field then "float", | 60 | float_field then "float", |
| 61 | char_field(_,_) then "string", | 61 | char_field(_,_) then "string", |
| @@ -80,7 +80,7 @@ public define String | @@ -80,7 +80,7 @@ public define String | ||
| 80 | date_field(_) then fill("DATE", 15) + format_attributes(attributes), | 80 | date_field(_) then fill("DATE", 15) + format_attributes(attributes), |
| 81 | time_field(_) then fill("TIME", 15) + format_attributes(attributes), | 81 | time_field(_) then fill("TIME", 15) + format_attributes(attributes), |
| 82 | datetime_field(_) then fill("DATETIME", 15) + format_attributes(attributes), | 82 | datetime_field(_) then fill("DATETIME", 15) + format_attributes(attributes), |
| 83 | - foreign_key(app,fk) then fill("INTEGER", 15) + format_attributes(attributes)+" REFERENCES "+fk+"(id) ", | 83 | + foreign_key(app,fk,_) then fill("INTEGER", 15) + format_attributes(attributes)+" REFERENCES "+fk+"(id) ", |
| 84 | integer_field(_) then fill("INTEGER", 15) + format_attributes(attributes), | 84 | integer_field(_) then fill("INTEGER", 15) + format_attributes(attributes), |
| 85 | float_field then fill("DOUBLE", 15) + format_attributes(attributes), | 85 | float_field then fill("DOUBLE", 15) + format_attributes(attributes), |
| 86 | char_field(_,size) then fill("VARCHAR("+size+")", 15) + format_attributes(attributes), | 86 | char_field(_,size) then fill("VARCHAR("+size+")", 15) + format_attributes(attributes), |
| @@ -105,7 +105,7 @@ public define String | @@ -105,7 +105,7 @@ public define String | ||
| 105 | date_field(_) then "db_date(\"\")", | 105 | date_field(_) then "db_date(\"\")", |
| 106 | time_field(_) then "db_time(\"\")", | 106 | time_field(_) then "db_time(\"\")", |
| 107 | datetime_field(_) then "db_datetime(\"\")", | 107 | datetime_field(_) then "db_datetime(\"\")", |
| 108 | - foreign_key(_,_) then "(DB_id)none", | 108 | + foreign_key(_,_,_) then "(DB_id)none", |
| 109 | integer_field(_) then "(Int)0", | 109 | integer_field(_) then "(Int)0", |
| 110 | float_field then "(Float)0.0", | 110 | float_field then "(Float)0.0", |
| 111 | char_field(choices,size) then "\"\"", | 111 | char_field(choices,size) then "\"\"", |
| @@ -146,7 +146,7 @@ public define String | @@ -146,7 +146,7 @@ public define String | ||
| 146 | else | 146 | else |
| 147 | "" | 147 | "" |
| 148 | }, | 148 | }, |
| 149 | - foreign_key(_,_) then "bind_DB_id_or_NULL(\":v_"+name+"\", "+type_name+"."+name+")", | 149 | + foreign_key(_,_,_) then "bind_DB_id_or_NULL(\":v_"+name+"\", "+type_name+"."+name+")", |
| 150 | integer_field(_) then "bind_Int(\":v_"+name+"\", "+type_name+"."+name+")", | 150 | integer_field(_) then "bind_Int(\":v_"+name+"\", "+type_name+"."+name+")", |
| 151 | float_field then "bind_Float(\":v_"+name+"\", "+type_name+"."+name+")", | 151 | float_field then "bind_Float(\":v_"+name+"\", "+type_name+"."+name+")", |
| 152 | char_field(_,_) then "bind_String(\":v_"+name+"\", "+type_name+"."+name+")", | 152 | char_field(_,_) then "bind_String(\":v_"+name+"\", "+type_name+"."+name+")", |
src/generation/files.anubis
| @@ -125,6 +125,7 @@ define Maybe(One) | @@ -125,6 +125,7 @@ define Maybe(One) | ||
| 125 | List(String) edit, | 125 | List(String) edit, |
| 126 | List(String) writer, | 126 | List(String) writer, |
| 127 | List(String) delete, | 127 | List(String) delete, |
| 128 | + List(String) controllers, | ||
| 128 | String dest_dir | 129 | String dest_dir |
| 129 | )= | 130 | )= |
| 130 | with file_name = dest_dir+"database/generated/vtm.anubis", | 131 | with file_name = dest_dir+"database/generated/vtm.anubis", |
| @@ -158,6 +159,10 @@ join("\n", transmit)+"\n\n"+ | @@ -158,6 +159,10 @@ join("\n", transmit)+"\n\n"+ | ||
| 158 | "public define List(TM_delete)\n"+ | 159 | "public define List(TM_delete)\n"+ |
| 159 | " generated_tm_delete_list =\n"+ | 160 | " generated_tm_delete_list =\n"+ |
| 160 | " [\n "+join(",\n ",delete)+"\n"+ | 161 | " [\n "+join(",\n ",delete)+"\n"+ |
| 162 | +" ].\n\n"+ | ||
| 163 | +"public define List(HK_Table_controller)\n"+ | ||
| 164 | +" generated_hk_table_controller_list =\n"+ | ||
| 165 | +" [\n "+join(",\n ",controllers)+"\n"+ | ||
| 161 | " ].\n\n" | 166 | " ].\n\n" |
| 162 | ) is //end of the function | 167 | ) is //end of the function |
| 163 | { | 168 | { |
| @@ -177,6 +182,7 @@ define One | @@ -177,6 +182,7 @@ define One | ||
| 177 | List(String) so_far_edit, | 182 | List(String) so_far_edit, |
| 178 | List(String) so_far_writer, | 183 | List(String) so_far_writer, |
| 179 | List(String) so_far_delete, | 184 | List(String) so_far_delete, |
| 185 | + List(String) so_far_controllers, | ||
| 180 | String dest_dir | 186 | String dest_dir |
| 181 | )= | 187 | )= |
| 182 | if tables is | 188 | if tables is |
| @@ -184,9 +190,9 @@ define One | @@ -184,9 +190,9 @@ define One | ||
| 184 | [] then | 190 | [] then |
| 185 | if apps is | 191 | if apps is |
| 186 | { | 192 | { |
| 187 | - [] then forget(generate_vtm_file(so_far_transmit, so_far_view, so_far_edit, so_far_writer, so_far_delete, dest_dir));println("Generation finished"), | 193 | + [] then forget(generate_vtm_file(so_far_transmit, so_far_view, so_far_edit, so_far_writer, so_far_delete, so_far_controllers, dest_dir));println("Generation finished"), |
| 188 | [app . apps_t] then | 194 | [app . apps_t] then |
| 189 | - _make_vtm(apps_t, app.hk_tables, so_far_transmit, so_far_view, so_far_edit, so_far_writer, so_far_delete, dest_dir) | 195 | + _make_vtm(apps_t, app.hk_tables, so_far_transmit, so_far_view, so_far_edit, so_far_writer, so_far_delete, so_far_controllers, dest_dir) |
| 190 | 196 | ||
| 191 | }, | 197 | }, |
| 192 | 198 | ||
| @@ -197,7 +203,19 @@ define One | @@ -197,7 +203,19 @@ define One | ||
| 197 | with edit = "vtm_edit(\""+name+"\", get_editable_"+name+")", | 203 | with edit = "vtm_edit(\""+name+"\", get_editable_"+name+")", |
| 198 | with writer = "tm_writer(\""+name+"\", update_"+name+"_from_type, update_"+name+"_from_fields)", | 204 | with writer = "tm_writer(\""+name+"\", update_"+name+"_from_type, update_"+name+"_from_fields)", |
| 199 | with delete = "tm_delete(\""+name+"\", delete_"+name+")", | 205 | with delete = "tm_delete(\""+name+"\", delete_"+name+")", |
| 200 | - _make_vtm(apps, t, [transmit . so_far_transmit], [view . so_far_view], [edit . so_far_edit], [writer . so_far_writer], [delete . so_far_delete], dest_dir) | 206 | + with controller = |
| 207 | +"hk_table_controller(\""+name+"\", | ||
| 208 | + //Create | ||
| 209 | + update_"+name+"_from_type, | ||
| 210 | + update_"+name+"_from_fields, | ||
| 211 | + //Read | ||
| 212 | + get_count_"+name+"_by_clause, | ||
| 213 | + get_all_"+name+"_by_clause_to_json, | ||
| 214 | + //Delete | ||
| 215 | + delete_"+name+ | ||
| 216 | +")", | ||
| 217 | + | ||
| 218 | + _make_vtm(apps, t, [transmit . so_far_transmit], [view . so_far_view], [edit . so_far_edit], [writer . so_far_writer], [delete . so_far_delete], [controller . so_far_controllers], dest_dir) | ||
| 201 | }. | 219 | }. |
| 202 | 220 | ||
| 203 | define One | 221 | define One |
| @@ -207,7 +225,7 @@ define One | @@ -207,7 +225,7 @@ define One | ||
| 207 | String dest_dir | 225 | String dest_dir |
| 208 | ) | 226 | ) |
| 209 | = | 227 | = |
| 210 | - _make_vtm(apps, [], [], [], [], [], [], dest_dir). | 228 | + _make_vtm(apps, [], [], [], [], [], [], [], dest_dir). |
| 211 | 229 | ||
| 212 | 230 | ||
| 213 | define Maybe(One) | 231 | define Maybe(One) |
src/generation/header.anubis
| @@ -22,7 +22,7 @@ define Maybe(One) | @@ -22,7 +22,7 @@ define Maybe(One) | ||
| 22 | [] then success(unique), | 22 | [] then success(unique), |
| 23 | [h . t] then | 23 | [h . t] then |
| 24 | since h is hk_column(_, type, _, _), | 24 | since h is hk_column(_, type, _, _), |
| 25 | - if type is foreign_key(app, table_name) then | 25 | + if type is foreign_key(app, table_name, _) then |
| 26 | if write_string(stream, "\nread database/generated/"+table_name+".anubis") is | 26 | if write_string(stream, "\nread database/generated/"+table_name+".anubis") is |
| 27 | { | 27 | { |
| 28 | failure then failure, | 28 | failure then failure, |
src/generation/html.anubis
| @@ -94,7 +94,7 @@ public define String | @@ -94,7 +94,7 @@ public define String | ||
| 94 | date_field(attrs) then to_HTML_cell_text(column, data_name, general_type_name), | 94 | date_field(attrs) then to_HTML_cell_text(column, data_name, general_type_name), |
| 95 | time_field(attrs) then to_HTML_cell_text(column, data_name, general_type_name), | 95 | time_field(attrs) then to_HTML_cell_text(column, data_name, general_type_name), |
| 96 | datetime_field(attrs) then to_HTML_cell_text(column, data_name, general_type_name), | 96 | datetime_field(attrs) then to_HTML_cell_text(column, data_name, general_type_name), |
| 97 | - foreign_key(app, foreign_table) then to_HTML_cell_text(column, data_name, general_type_name), | 97 | + foreign_key(app, foreign_table,_) then to_HTML_cell_text(column, data_name, general_type_name), |
| 98 | integer_field(choices) then to_HTML_cell_text(column, data_name, general_type_name), | 98 | integer_field(choices) then to_HTML_cell_text(column, data_name, general_type_name), |
| 99 | float_field then to_HTML_cell_text(column, data_name, general_type_name), | 99 | float_field then to_HTML_cell_text(column, data_name, general_type_name), |
| 100 | char_field(choices, size) then to_HTML_cell_text(column, data_name, general_type_name), | 100 | char_field(choices, size) then to_HTML_cell_text(column, data_name, general_type_name), |
src/generation/icons.anubis
| @@ -28,7 +28,7 @@ public define String | @@ -28,7 +28,7 @@ public define String | ||
| 28 | date_field(attrs) then icn16_clock, | 28 | date_field(attrs) then icn16_clock, |
| 29 | time_field(attrs) then icn16_clock, | 29 | time_field(attrs) then icn16_clock, |
| 30 | datetime_field(attrs) then icn16_clock, | 30 | datetime_field(attrs) then icn16_clock, |
| 31 | - foreign_key(app,foreign_table) then icn16_question, | 31 | + foreign_key(app,foreign_table,_) then icn16_question, |
| 32 | integer_field(choice) then icn16_question, | 32 | integer_field(choice) then icn16_question, |
| 33 | float_field then icn16_question, | 33 | float_field then icn16_question, |
| 34 | char_field(choice, size) then icn16_question, | 34 | char_field(choice, size) then icn16_question, |
src/generation/json.anubis
| @@ -28,7 +28,7 @@ public define String | @@ -28,7 +28,7 @@ public define String | ||
| 28 | date_field(attrs) then "to_JSON_String(to_String("+current_type_name+"."+name+"))", | 28 | date_field(attrs) then "to_JSON_String(to_String("+current_type_name+"."+name+"))", |
| 29 | time_field(attrs) then "to_JSON_String(to_String("+current_type_name+"."+name+"))", | 29 | time_field(attrs) then "to_JSON_String(to_String("+current_type_name+"."+name+"))", |
| 30 | datetime_field(attrs) then "to_JSON_String(to_String("+current_type_name+"."+name+"))", | 30 | datetime_field(attrs) then "to_JSON_String(to_String("+current_type_name+"."+name+"))", |
| 31 | - foreign_key(app,foreign_table) then "to_JSON_String(get_"+foreign_table+"_show_string(db, "+current_type_name+"."+name+"))", | 31 | + foreign_key(app,foreign_table,_) then "to_JSON_String(get_"+foreign_table+"_show_string(db, "+current_type_name+"."+name+"))", |
| 32 | integer_field(_) then current_type_name+"."+name, | 32 | integer_field(_) then current_type_name+"."+name, |
| 33 | float_field then "float_to_string("+current_type_name+"."+name+",5)", | 33 | float_field then "float_to_string("+current_type_name+"."+name+",5)", |
| 34 | char_field(_,_) then "to_JSON_String("+current_type_name+"."+name+")", | 34 | char_field(_,_) then "to_JSON_String("+current_type_name+"."+name+")", |
| @@ -60,7 +60,7 @@ public define String | @@ -60,7 +60,7 @@ public define String | ||
| 60 | date_field(attrs) then "json_member(\""+name+"\", json_string("+current_type_name+"."+name+"))", | 60 | date_field(attrs) then "json_member(\""+name+"\", json_string("+current_type_name+"."+name+"))", |
| 61 | time_field(attrs) then "json_member(\""+name+"\", json_string("+current_type_name+"."+name+"))", | 61 | time_field(attrs) then "json_member(\""+name+"\", json_string("+current_type_name+"."+name+"))", |
| 62 | datetime_field(attrs) then "json_member(\""+name+"\", json_string("+current_type_name+"."+name+"))", | 62 | datetime_field(attrs) then "json_member(\""+name+"\", json_string("+current_type_name+"."+name+"))", |
| 63 | - foreign_key(app,foreign_table) then "json_member(\""+name+"\", json_string(get_"+foreign_table+"_show_string(db, "+current_type_name+"."+name+")))", | 63 | + foreign_key(app,foreign_table,_) then "json_member(\""+name+"\", json_string(get_"+foreign_table+"_show_string(db, "+current_type_name+"."+name+")))", |
| 64 | integer_field(_) then "json_member(\""+name+"\", json_int("+current_type_name+"."+name+"))", | 64 | integer_field(_) then "json_member(\""+name+"\", json_int("+current_type_name+"."+name+"))", |
| 65 | float_field then "json_member(\""+name+"\", json_float("+current_type_name+"."+name+",5))", | 65 | float_field then "json_member(\""+name+"\", json_float("+current_type_name+"."+name+",5))", |
| 66 | char_field(_,_) then "json_member(\""+name+"\", json_string("+current_type_name+"."+name+"))", | 66 | char_field(_,_) then "json_member(\""+name+"\", json_string("+current_type_name+"."+name+"))", |
| @@ -88,7 +88,7 @@ public define String | @@ -88,7 +88,7 @@ public define String | ||
| 88 | date_field(_) then "json_member(\""+name+"\", json_string(text"+cursor_index+"))", | 88 | date_field(_) then "json_member(\""+name+"\", json_string(text"+cursor_index+"))", |
| 89 | time_field(_) then "json_member(\""+name+"\", json_string(text"+cursor_index+"))", | 89 | time_field(_) then "json_member(\""+name+"\", json_string(text"+cursor_index+"))", |
| 90 | datetime_field(_) then "json_member(\""+name+"\", json_string(text"+cursor_index+"))", | 90 | datetime_field(_) then "json_member(\""+name+"\", json_string(text"+cursor_index+"))", |
| 91 | - foreign_key(app,foreign_table) then "json_member(\""+name+"\", json_string(get_"+foreign_table+"_show_string(db, db_id((Int)db_integer"+cursor_index+"))))", | 91 | + foreign_key(app,foreign_table,_) then "json_member(\""+name+"\", json_string(get_"+foreign_table+"_show_string(db, db_id((Int)db_integer"+cursor_index+"))))", |
| 92 | integer_field(_) then "json_member(\""+name+"\", json_int((Int)db_integer"+cursor_index+"))", | 92 | integer_field(_) then "json_member(\""+name+"\", json_int((Int)db_integer"+cursor_index+"))", |
| 93 | float_field then "json_member(\""+name+"\", json_float(db_float"+cursor_index+",5))", | 93 | float_field then "json_member(\""+name+"\", json_float(db_float"+cursor_index+",5))", |
| 94 | char_field(_,_) then "json_member(\""+name+"\", json_string(text"+cursor_index+"))", | 94 | char_field(_,_) then "json_member(\""+name+"\", json_string(text"+cursor_index+"))", |
src/generation/vt_view.anubis
| @@ -49,7 +49,7 @@ define String | @@ -49,7 +49,7 @@ define String | ||
| 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)+")", |
| 51 | datetime_field(attrs) then "datetime(\""+to_upper(name)+"\", \""+name+"\", "+to_Anubis_source(help)+")", | 51 | datetime_field(attrs) then "datetime(\""+to_upper(name)+"\", \""+name+"\", "+to_Anubis_source(help)+")", |
| 52 | - foreign_key(app,foreign_table) then "foreign_text(\""+to_upper(name)+"\", \""+name+"\", hk_form_selector(get_selector_"+foreign_table+"), "+to_Anubis_source(help)+")", | 52 | + foreign_key(app,foreign_table,_) then "foreign_text(\""+to_upper(name)+"\", \""+name+"\", hk_form_selector(get_selector_"+foreign_table+"), "+to_Anubis_source(help)+")", |
| 53 | integer_field(choices) then | 53 | integer_field(choices) then |
| 54 | if choices is | 54 | if choices is |
| 55 | { | 55 | { |
src/generation/web_args.anubis
| @@ -25,7 +25,7 @@ public define String | @@ -25,7 +25,7 @@ public define String | ||
| 25 | date_field(attrs) then if attrs = none then "get_DB_date(lwa, __prefix__+\""+name+"\")" else "with "+name+" = get_dummy_DB_date,", | 25 | date_field(attrs) then if attrs = none then "get_DB_date(lwa, __prefix__+\""+name+"\")" else "with "+name+" = get_dummy_DB_date,", |
| 26 | time_field(attrs) then if attrs = none then "get_DB_time(lwa, __prefix__+\""+name+"\")" else "with "+name+" = get_dummy_DB_time,", | 26 | time_field(attrs) then if attrs = none then "get_DB_time(lwa, __prefix__+\""+name+"\")" else "with "+name+" = get_dummy_DB_time,", |
| 27 | datetime_field(attrs) then if attrs = none then "get_DB_datetime(lwa, __prefix__+\""+name+"\")" else "with "+name+" = get_dummy_DB_datetime,", | 27 | datetime_field(attrs) then if attrs = none then "get_DB_datetime(lwa, __prefix__+\""+name+"\")" else "with "+name+" = get_dummy_DB_datetime,", |
| 28 | - foreign_key(_,_) then "with "+name+" = get_DB_id(lwa, __prefix__+\""+name+"\"),", | 28 | + foreign_key(_,_,_) then "with "+name+" = get_DB_id(lwa, __prefix__+\""+name+"\"),", |
| 29 | integer_field(_) then "get_Int(lwa, __prefix__+\""+name+"\")", | 29 | integer_field(_) then "get_Int(lwa, __prefix__+\""+name+"\")", |
| 30 | float_field then "get_Float(lwa, __prefix__+\""+name+"\")", | 30 | float_field then "get_Float(lwa, __prefix__+\""+name+"\")", |
| 31 | char_field(_,_) then "get_String(lwa, __prefix__+\""+name+"\")", | 31 | char_field(_,_) then "get_String(lwa, __prefix__+\""+name+"\")", |
| @@ -123,7 +123,7 @@ public define String | @@ -123,7 +123,7 @@ public define String | ||
| 123 | "if get_DB_datetime(lwa, __prefix__+\""+name+"\") is {failure then [], success("+name+") then [field(\""+name+"\", bind_Datetime(\":v_"+name+"\", "+name+"))] }" | 123 | "if get_DB_datetime(lwa, __prefix__+\""+name+"\") is {failure then [], success("+name+") then [field(\""+name+"\", bind_Datetime(\":v_"+name+"\", "+name+"))] }" |
| 124 | else | 124 | else |
| 125 | "[]", | 125 | "[]", |
| 126 | - foreign_key(_,_) then //"with "+name+" = get_DB_id(lwa, __prefix__+\""+name+"\"),", | 126 | + foreign_key(_,_,_) then //"with "+name+" = get_DB_id(lwa, __prefix__+\""+name+"\"),", |
| 127 | "if get_mb_DB_id(lwa, __prefix__+\""+name+"\") is {failure then [], success("+name+") then [field(\""+name+"\", bind_DB_id_or_NULL(\":v_"+name+"\", "+name+"))] }" | 127 | "if get_mb_DB_id(lwa, __prefix__+\""+name+"\") is {failure then [], success("+name+") then [field(\""+name+"\", bind_DB_id_or_NULL(\":v_"+name+"\", "+name+"))] }" |
| 128 | integer_field(_) then //"get_Int(lwa, __prefix__+\""+name+"\")", | 128 | integer_field(_) then //"get_Int(lwa, __prefix__+\""+name+"\")", |
| 129 | "if get_Int(lwa, __prefix__+\""+name+"\") is {failure then [], success("+name+") then [field(\""+name+"\", bind_Int(\":v_"+name+"\", "+name+"))] }" | 129 | "if get_Int(lwa, __prefix__+\""+name+"\") is {failure then [], success("+name+") then [field(\""+name+"\", bind_Int(\":v_"+name+"\", "+name+"))] }" |
src/model.3.0.0.anubis
| @@ -118,7 +118,7 @@ public define HK_Table production_production_table = | @@ -118,7 +118,7 @@ public define HK_Table production_production_table = | ||
| 118 | [ | 118 | [ |
| 119 | 119 | ||
| 120 | hk_column("date", date_field(none), []), | 120 | hk_column("date", date_field(none), []), |
| 121 | - hk_column("assembler_id", foreign_key(app_name("staff"),"staff"), []), | 121 | + hk_column("assembler_id", foreign_key(app_name("staff"),"staff", []), []), |
| 122 | hk_column("type_ref_id", foreign_key("type_number"), []), | 122 | hk_column("type_ref_id", foreign_key("type_number"), []), |
| 123 | hk_column("product_ref_id", foreign_key("product_reference"), []), | 123 | hk_column("product_ref_id", foreign_key("product_reference"), []), |
| 124 | hk_column("site_id", foreign_key("production_site"), []), | 124 | hk_column("site_id", foreign_key("production_site"), []), |
| @@ -176,7 +176,7 @@ public define HK_Table production_purchase_table = | @@ -176,7 +176,7 @@ public define HK_Table production_purchase_table = | ||
| 176 | hk_model( | 176 | hk_model( |
| 177 | [ | 177 | [ |
| 178 | hk_column("date", date_field(none), []), | 178 | hk_column("date", date_field(none), []), |
| 179 | - hk_column("buyer_id", foreign_key(app_name("staff"),"staff"), []), | 179 | + hk_column("buyer_id", foreign_key(app_name("staff"),"staff", []), []), |
| 180 | hk_column("supplier_id", foreign_key("supplier"), []), | 180 | hk_column("supplier_id", foreign_key("supplier"), []), |
| 181 | hk_column("order_ref", char_field(50), []), // | 181 | hk_column("order_ref", char_field(50), []), // |
| 182 | hk_column("description", char_field(200), []), // description of the purchase | 182 | hk_column("description", char_field(200), []), // description of the purchase |
| @@ -243,7 +243,7 @@ public define HK_Table production_supplier_table = | @@ -243,7 +243,7 @@ public define HK_Table production_supplier_table = | ||
| 243 | [ | 243 | [ |
| 244 | 244 | ||
| 245 | hk_column("company", char_field(100), []), | 245 | hk_column("company", char_field(100), []), |
| 246 | - hk_column("contact_id", foreign_key(none, "address_book_contact"), []), | 246 | + hk_column("contact_id", foreign_key(none, "address_book_contact", []), []), |
| 247 | hk_column("address1", char_field(100), []), | 247 | hk_column("address1", char_field(100), []), |
| 248 | hk_column("address2", char_field(100), []), | 248 | hk_column("address2", char_field(100), []), |
| 249 | hk_column("zipcode", char_field(10), []), | 249 | hk_column("zipcode", char_field(10), []), |
| @@ -334,7 +334,7 @@ public define HK_Table staff_table = | @@ -334,7 +334,7 @@ public define HK_Table staff_table = | ||
| 334 | hk_model( | 334 | hk_model( |
| 335 | [ | 335 | [ |
| 336 | 336 | ||
| 337 | - hk_column("contact_id", foreign_key(none, "address_book_contact"), []), | 337 | + hk_column("contact_id", foreign_key(none, "address_book_contact", []), []), |
| 338 | hk_column("department_id", foreign_key("department"), []), | 338 | hk_column("department_id", foreign_key("department"), []), |
| 339 | hk_column("role_id", foreign_key("role"), []), | 339 | hk_column("role_id", foreign_key("role"), []), |
| 340 | hk_column("email", email_field, []), | 340 | hk_column("email", email_field, []), |