Commit 6429553ee88a5ba15c274fa205023a61a45ab337
1 parent
18ac3754
update to be conform to last hayamiki_lib
Showing
9 changed files
with
109 additions
and
89 deletions
Show diff stats
calexium_lib @ 8b4b368f40f
hayamiki_lib @ 601f9714449
src/generation/SQL_get_all.anubis
| ... | ... | @@ -110,19 +110,19 @@ public define Maybe(One) |
| 110 | 110 | " success(cursor) then _get_all_"+name+"(cursor, [])\n"+ |
| 111 | 111 | " }\n"+ |
| 112 | 112 | ".\n"+ |
| 113 | - "public define List(JsonValue)\n"+ | |
| 114 | - " _get_all_"+name+"_to_json\n"+ | |
| 115 | - " (\n"+ | |
| 116 | - " SQLite3DataBase db,\n"+ | |
| 117 | - " One -> SQLite3Row table_cursor,\n"+ | |
| 118 | - " List(JsonValue) so_far\n"+ | |
| 119 | - " ) =\n"+ | |
| 120 | - " if extract_"+name+"_cursor_to_json(db, table_cursor) is\n"+ | |
| 121 | - " {\n"+ | |
| 122 | - " failure then reverse(so_far),\n"+ | |
| 123 | - " success(data) then _get_all_"+name+"_to_json(db, table_cursor, [data . so_far])\n"+ | |
| 124 | - " }\n"+ | |
| 125 | - ".\n"+ | |
| 113 | +// "public define List(JsonValue)\n"+ | |
| 114 | +// " _get_all_"+name+"_to_json\n"+ | |
| 115 | +// " (\n"+ | |
| 116 | +// " SQLite3DataBase db,\n"+ | |
| 117 | +// " One -> SQLite3Row table_cursor,\n"+ | |
| 118 | +// " List(JsonValue) so_far\n"+ | |
| 119 | +// " ) =\n"+ | |
| 120 | +// " if extract_"+name+"_cursor_to_json(db, table_cursor) is\n"+ | |
| 121 | +// " {\n"+ | |
| 122 | +// " failure then reverse(so_far),\n"+ | |
| 123 | +// " success(data) then _get_all_"+name+"_to_json(db, table_cursor, [data . so_far])\n"+ | |
| 124 | +// " }\n"+ | |
| 125 | +// ".\n"+ | |
| 126 | 126 | |
| 127 | 127 | "public define List(JsonValue)\n"+ |
| 128 | 128 | " _get_all_"+name+"_to_json\n"+ |
| ... | ... | @@ -144,21 +144,23 @@ public define Maybe(One) |
| 144 | 144 | " (\n"+ |
| 145 | 145 | " SQLite3DataBase db,\n"+ |
| 146 | 146 | " List(String) columns,\n"+ |
| 147 | +" Bool resolve_fk,\n"+ | |
| 147 | 148 | " HK_Referer referer,\n"+ |
| 148 | 149 | " String filter,\n"+ |
| 149 | 150 | " String order_by\n"+ |
| 150 | 151 | " )=\n"+ |
| 151 | -" with ref_clause = referer_to_sql_clause(referer, \""+name+"\", "+name+"_columns),\n\n"+ | |
| 152 | +" with ref_clause = referer_to_sql_clause(referer, \""+name+"\", "+name+"_columns),\n"+ | |
| 153 | +" with final_columns = if length(columns) = 0 then [\"id\". "+name+"_columns] else columns,\n\n"+ | |
| 152 | 154 | " with _and_ = if length(ref_clause) > 0 & length(filter) > 0 then \" AND \" else \"\",\n"+ |
| 153 | 155 | " if get_all_"+name+"_by_clause(db, ref_clause+_and_+filter+\" \"+order_by) is\n"+ |
| 154 | 156 | " {\n"+ |
| 155 | 157 | " failure then json_array([]),\n"+ |
| 156 | 158 | " success(cursor) then\n"+ |
| 157 | 159 | " json_array(\n"+ |
| 158 | -" if length(columns) = 0 then\n"+ | |
| 159 | -" _get_all_"+name+"_to_json(db, cursor, [])\n"+ | |
| 160 | -" else\n"+ | |
| 161 | -" _get_all_"+name+"_to_json(db, make_json_extractor(db, columns), cursor, [])\n"+ | |
| 160 | +//" if length(columns) = 0 then\n"+ | |
| 161 | +//" _get_all_"+name+"_to_json(db, cursor, [])\n"+ | |
| 162 | +//" else\n"+ | |
| 163 | +" _get_all_"+name+"_to_json(db, make_json_extractor(db, final_columns, resolve_fk), cursor, [])\n"+ | |
| 162 | 164 | " )\n"+ |
| 163 | 165 | " }\n"+ |
| 164 | 166 | ".\n" | ... | ... |
src/generation/extractor.anubis
| ... | ... | @@ -174,20 +174,20 @@ public define Maybe(One) |
| 174 | 174 | //generate the type of the table that contain all components |
| 175 | 175 | if write_string(stream, |
| 176 | 176 | "\n\n"+ |
| 177 | - "public define Maybe(JsonValue)\n"+ | |
| 178 | - " extract_"+name+"_cursor_to_json\n"+ | |
| 179 | - " (\n"+ | |
| 180 | - " SQLite3DataBase db,\n"+ | |
| 181 | - " One -> SQLite3Row table_cursor\n"+ | |
| 182 | - " ) =\n"+ | |
| 183 | - " if table_cursor(unique) is\n"+ | |
| 184 | - " {\n"+ | |
| 185 | - " error(sql_error) then println(db_error(sql_error, \"extract_"+name+"\")); failure,\n"+ | |
| 186 | - " no_more_row then failure,\n"+ | |
| 187 | - " row(cursor) then\n"+ | |
| 188 | - " success("+generate_json_object_from_cursor(name, "cursor", columns, " ")+")\n"+ //generate type construction with values got from web arg | |
| 189 | - " }\n.\n"+ | |
| 190 | - "\n\n"+ | |
| 177 | +// "public define Maybe(JsonValue)\n"+ | |
| 178 | +// " extract_"+name+"_cursor_to_json\n"+ | |
| 179 | +// " (\n"+ | |
| 180 | +// " SQLite3DataBase db,\n"+ | |
| 181 | +// " One -> SQLite3Row table_cursor\n"+ | |
| 182 | +// " ) =\n"+ | |
| 183 | +// " if table_cursor(unique) is\n"+ | |
| 184 | +// " {\n"+ | |
| 185 | +// " error(sql_error) then println(db_error(sql_error, \"extract_"+name+"\")); failure,\n"+ | |
| 186 | +// " no_more_row then failure,\n"+ | |
| 187 | +// " row(cursor) then\n"+ | |
| 188 | +// " success("+generate_json_object_from_cursor(name, "cursor", columns, " ")+")\n"+ //generate type construction with values got from web arg | |
| 189 | +// " }\n.\n"+ | |
| 190 | +// "\n\n"+ | |
| 191 | 191 | "public define Maybe(JsonValue)\n"+ |
| 192 | 192 | " extract_"+name+"_cursor_to_json\n"+ |
| 193 | 193 | " (\n"+ |
| ... | ... | @@ -211,6 +211,7 @@ public define Maybe(One) |
| 211 | 211 | " (\n"+ |
| 212 | 212 | " SQLite3DataBase db,\n"+ |
| 213 | 213 | " String component_name,\n"+ |
| 214 | +" Bool resolve_fk\n"+ | |
| 214 | 215 | " )=\n"+generate_json_extractor(name, "cursor", columns, " ")+ |
| 215 | 216 | "\n.\n\n"+ |
| 216 | 217 | |
| ... | ... | @@ -218,9 +219,10 @@ public define Maybe(One) |
| 218 | 219 | " make_json_extractor\n"+ |
| 219 | 220 | " (\n"+ |
| 220 | 221 | " SQLite3DataBase db,\n"+ |
| 221 | -" List(String) columns\n"+ | |
| 222 | +" List(String) columns,\n"+ | |
| 223 | +" Bool resolve_fk\n"+ | |
| 222 | 224 | " )=\n"+ |
| 223 | -" map((String column) |-> get_extractor(db, column), columns)\n"+ | |
| 225 | +" map((String column) |-> get_extractor(db, column, resolve_fk), columns)\n"+ | |
| 224 | 226 | ".\n" |
| 225 | 227 | ) is //end of the function |
| 226 | 228 | { | ... | ... |
src/generation/fields.anubis
| ... | ... | @@ -77,9 +77,15 @@ public define String |
| 77 | 77 | //anubis(_T) then "ByteArray", |
| 78 | 78 | p_key then fill("INTEGER", 15) + " PRIMARY KEY", |
| 79 | 79 | boolean_field then fill("BOOL", 15) + format_attributes(attributes), |
| 80 | - date_field(_) then fill("DATE", 15) + format_attributes(attributes), | |
| 81 | - time_field(_) then fill("TIME", 15) + format_attributes(attributes), | |
| 82 | - datetime_field(_) then fill("DATETIME", 15) + format_attributes(attributes), | |
| 80 | + date_field(dt_attrs) then | |
| 81 | + with new_attributes = if dt_attrs is auto_now_add then [default("(date('now', 'LOCALTIME'))")] else attributes, | |
| 82 | + fill("DATE", 15) + format_attributes(attributes), | |
| 83 | + time_field(dt_attrs) then | |
| 84 | + with new_attributes = if dt_attrs is auto_now_add then [default("(time('now', 'LOCALTIME'))")] else attributes, | |
| 85 | + fill("TIME", 15) + format_attributes(new_attributes), | |
| 86 | + datetime_field(dt_attrs) then | |
| 87 | + with new_attributes = if dt_attrs is auto_now_add then [default("(datetime('now', 'LOCALTIME'))")] else attributes, | |
| 88 | + fill("DATETIME", 15) + format_attributes(new_attributes), | |
| 83 | 89 | foreign_key(app,fk,_) then fill("INTEGER", 15) + format_attributes(attributes)+" REFERENCES "+fk+"(id) ", |
| 84 | 90 | integer_field(_) then fill("INTEGER", 15) + format_attributes(attributes), |
| 85 | 91 | float_field then fill("DOUBLE", 15) + format_attributes(attributes), | ... | ... |
src/generation/files.anubis
| ... | ... | @@ -124,7 +124,7 @@ define Maybe(One) |
| 124 | 124 | List(String) transmit, |
| 125 | 125 | List(String) view, |
| 126 | 126 | List(String) edit, |
| 127 | - List(String) writer, | |
| 127 | +// List(String) writer, | |
| 128 | 128 | List(String) delete, |
| 129 | 129 | List(String) controllers, |
| 130 | 130 | String dest_dir |
| ... | ... | @@ -143,7 +143,8 @@ define Maybe(One) |
| 143 | 143 | * |
| 144 | 144 | */ |
| 145 | 145 | read tools/basis.anubis |
| 146 | -read hayamiki_lib/view/view_table_manager_types.anubis\n"+ | |
| 146 | +read hayamiki_lib/view/view_table_manager_types.anubis\n | |
| 147 | +read hayamiki_lib/controller/hk_sql_utils.anubis\n"+ | |
| 147 | 148 | join("\n", transmit)+"\n\n"+ |
| 148 | 149 | "public define List(VTM_view)\n"+ |
| 149 | 150 | " generated_vtm_view_list =\n"+ |
| ... | ... | @@ -153,10 +154,10 @@ join("\n", transmit)+"\n\n"+ |
| 153 | 154 | " generated_vtm_edit_list =\n"+ |
| 154 | 155 | " [\n "+join(",\n ",edit)+"\n"+ |
| 155 | 156 | " ].\n\n"+ |
| 156 | -"public define List(TM_writer)\n"+ | |
| 157 | -" generated_tm_writer_list =\n"+ | |
| 158 | -" [\n "+join(",\n ",writer)+"\n"+ | |
| 159 | -" ].\n\n"+ | |
| 157 | +//"public define List(TM_writer)\n"+ | |
| 158 | +//" generated_tm_writer_list =\n"+ | |
| 159 | +//" [\n "+join(",\n ",writer)+"\n"+ | |
| 160 | +//" ].\n\n"+ | |
| 160 | 161 | "public define List(TM_delete)\n"+ |
| 161 | 162 | " generated_tm_delete_list =\n"+ |
| 162 | 163 | " [\n "+join(",\n ",delete)+"\n"+ |
| ... | ... | @@ -181,7 +182,7 @@ define One |
| 181 | 182 | List(String) so_far_transmit, |
| 182 | 183 | List(String) so_far_view, |
| 183 | 184 | List(String) so_far_edit, |
| 184 | - List(String) so_far_writer, | |
| 185 | +// List(String) so_far_writer, | |
| 185 | 186 | List(String) so_far_delete, |
| 186 | 187 | List(String) so_far_controllers, |
| 187 | 188 | String dest_dir |
| ... | ... | @@ -191,9 +192,9 @@ define One |
| 191 | 192 | [] then |
| 192 | 193 | if apps is |
| 193 | 194 | { |
| 194 | - [] 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"), | |
| 195 | + [] then forget(generate_vtm_file(so_far_transmit, so_far_view, so_far_edit, so_far_delete, so_far_controllers, dest_dir));println("Generation finished"), | |
| 195 | 196 | [app . apps_t] then |
| 196 | - _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) | |
| 197 | + _make_vtm(apps_t, app.hk_tables, so_far_transmit, so_far_view, so_far_edit, so_far_delete, so_far_controllers, dest_dir) | |
| 197 | 198 | |
| 198 | 199 | }, |
| 199 | 200 | |
| ... | ... | @@ -202,7 +203,7 @@ define One |
| 202 | 203 | with transmit = "transmit "+name+".anubis", |
| 203 | 204 | with view = "vtm_view(\""+name+"\", get_viewable_"+name+", get_all_"+name+"_view_name)", |
| 204 | 205 | with edit = "vtm_edit(\""+name+"\", get_editable_"+name+")", |
| 205 | - with writer = "tm_writer(\""+name+"\", update_"+name+"_from_type, update_"+name+"_from_fields)", | |
| 206 | +// with writer = "tm_writer(\""+name+"\", update_"+name+"_from_type, update_"+name+"_from_fields)", | |
| 206 | 207 | with delete = "tm_delete(\""+name+"\", delete_"+name+")", |
| 207 | 208 | with controller = |
| 208 | 209 | "hk_table_controller(\""+name+"\", |
| ... | ... | @@ -210,14 +211,18 @@ define One |
| 210 | 211 | update_"+name+"_from_type, |
| 211 | 212 | update_"+name+"_from_fields, |
| 212 | 213 | //Read |
| 213 | - get_count_"+name+"_by_clause, | |
| 214 | + (SQLite3DataBase db, String clause) |-> get_count_by_clause(db, \""+name+"\", clause), | |
| 214 | 215 | get_one_"+name+"_to_json, |
| 215 | 216 | get_all_"+name+"_by_clause_to_json, |
| 216 | 217 | //Delete |
| 217 | - delete_"+name+ | |
| 218 | + delete_"+name+", | |
| 219 | + | |
| 220 | + //view interface | |
| 221 | + //selector | |
| 222 | + get_selector_"+name+"\n"+ | |
| 218 | 223 | ")", |
| 219 | 224 | |
| 220 | - _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) | |
| 225 | + _make_vtm(apps, t, [transmit . so_far_transmit], [view . so_far_view], [edit . so_far_edit], [delete . so_far_delete], [controller . so_far_controllers], dest_dir) | |
| 221 | 226 | }. |
| 222 | 227 | |
| 223 | 228 | define One |
| ... | ... | @@ -227,7 +232,7 @@ define One |
| 227 | 232 | String dest_dir |
| 228 | 233 | ) |
| 229 | 234 | = |
| 230 | - _make_vtm(apps, [], [], [], [], [], [], [], dest_dir). | |
| 235 | + _make_vtm(apps, [], [], [], [], [], [], dest_dir). | |
| 231 | 236 | |
| 232 | 237 | |
| 233 | 238 | define Maybe(One) | ... | ... |
src/generation/json.anubis
| ... | ... | @@ -60,7 +60,7 @@ public define String |
| 60 | 60 | date_field(attrs) then "json_member(\""+name+"\", json_string("+current_type_name+"."+name+"))", |
| 61 | 61 | time_field(attrs) then "json_member(\""+name+"\", json_string("+current_type_name+"."+name+"))", |
| 62 | 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+"\", if resolve_fk then json_string(get_"+foreign_table+"_show_string(db, "+current_type_name+"."+name+"))) else json_int("+current_type_name+"."+name+")", | |
| 64 | 64 | integer_field(_) then "json_member(\""+name+"\", json_int("+current_type_name+"."+name+"))", |
| 65 | 65 | float_field then "json_member(\""+name+"\", json_float("+current_type_name+"."+name+",5))", |
| 66 | 66 | char_field(_,_) then "json_member(\""+name+"\", json_string("+current_type_name+"."+name+"))", |
| ... | ... | @@ -88,7 +88,11 @@ public define String |
| 88 | 88 | date_field(_) then "json_member(\""+name+"\", json_string(text"+cursor_index+"))", |
| 89 | 89 | time_field(_) then "json_member(\""+name+"\", json_string(text"+cursor_index+"))", |
| 90 | 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 | |
| 92 | + " if resolve_fk then\n"+ | |
| 93 | + " json_member(\""+name+"\", json_string(get_"+foreign_table+"_show_string(db, db_id((Int)db_integer"+cursor_index+"))))\n"+ | |
| 94 | + " else\n"+ | |
| 95 | + " json_member(\""+name+"\", json_int((Int)db_integer"+cursor_index+"))", | |
| 92 | 96 | integer_field(_) then "json_member(\""+name+"\", json_int((Int)db_integer"+cursor_index+"))", |
| 93 | 97 | float_field then "json_member(\""+name+"\", json_float(db_float"+cursor_index+",5))", |
| 94 | 98 | char_field(_,_) then "json_member(\""+name+"\", json_string(text"+cursor_index+"))", | ... | ... |
src/generation/types.anubis
| ... | ... | @@ -95,7 +95,7 @@ public define Maybe(One) |
| 95 | 95 | failure then println("can't write get_default "+type_name); failure, |
| 96 | 96 | success(_) then success(unique) |
| 97 | 97 | }. |
| 98 | - | |
| 98 | + | |
| 99 | 99 | |
| 100 | 100 | public define Maybe(One) |
| 101 | 101 | generate_columns_list |
| ... | ... | @@ -116,14 +116,8 @@ public define Maybe(One) |
| 116 | 116 | failure then println("can't write generate_columns_list "+type_name); failure, |
| 117 | 117 | success(_) then success(unique) |
| 118 | 118 | }. |
| 119 | - | |
| 120 | - | |
| 121 | 119 | |
| 122 | 120 | |
| 123 | - | |
| 124 | - | |
| 125 | - | |
| 126 | - | |
| 127 | 121 | public define Maybe(One) |
| 128 | 122 | generate_get_one |
| 129 | 123 | ( |
| ... | ... | @@ -192,11 +186,12 @@ public define Maybe(One) |
| 192 | 186 | "public define JsonValue\n"+ |
| 193 | 187 | " get_one_"+name+"_to_json\n"+ |
| 194 | 188 | " (\n"+ |
| 195 | -" SQLite3DataBase db,\n"+ | |
| 189 | +" SQLite3DataBase db,\n"+ | |
| 196 | 190 | " List(String) columns,\n"+ |
| 191 | +" Bool resolve_fk,\n"+ | |
| 197 | 192 | " DB_id idx\n"+ |
| 198 | 193 | " )=\n"+ |
| 199 | -" with final_columns = if length(columns) = 0 then "+name+"_columns else columns,\n"+ | |
| 194 | +" with final_columns = if length(columns) = 0 then [\"id\". "+name+"_columns] else columns,\n"+ | |
| 200 | 195 | " with error = json_object(map((String col_name) |-> json_member(col_name, json_null), final_columns)),\n"+ |
| 201 | 196 | "\n"+ |
| 202 | 197 | " if idx is\n"+ |
| ... | ... | @@ -207,18 +202,18 @@ public define Maybe(One) |
| 207 | 202 | " {\n"+ |
| 208 | 203 | " failure then error,\n"+ |
| 209 | 204 | " success(cursor) then\n"+ |
| 210 | -" if length(columns) = 0 then\n"+ | |
| 211 | -" if extract_"+name+"_cursor_to_json(db, cursor) is\n"+ | |
| 212 | -" {\n"+ | |
| 213 | -" failure then error,\n"+ | |
| 214 | -" success(result) then result\n"+ | |
| 215 | -" }\n"+ | |
| 216 | -" else\n"+ | |
| 217 | -" if extract_"+name+"_cursor_to_json(db, make_json_extractor(db, columns), cursor) is\n"+ | |
| 218 | -" {\n"+ | |
| 219 | -" failure then error,\n"+ | |
| 220 | -" success(result) then result\n"+ | |
| 221 | -" }\n"+ | |
| 205 | +//" if length(columns) = 0 then\n"+ | |
| 206 | +//" if extract_"+name+"_cursor_to_json(db, cursor) is\n"+ | |
| 207 | +//" {\n"+ | |
| 208 | +//" failure then error,\n"+ | |
| 209 | +//" success(result) then result\n"+ | |
| 210 | +//" }\n"+ | |
| 211 | +//" else\n"+ | |
| 212 | +" if extract_"+name+"_cursor_to_json(db, make_json_extractor(db, final_columns, resolve_fk), cursor) is\n"+ | |
| 213 | +" {\n"+ | |
| 214 | +" failure then error,\n"+ | |
| 215 | +" success(result) then result\n"+ | |
| 216 | +" }\n"+ | |
| 222 | 217 | " }\n"+ |
| 223 | 218 | " }\n"+ |
| 224 | 219 | ".\n\n" | ... | ... |
src/generation/web_args.anubis
| ... | ... | @@ -107,22 +107,28 @@ public define String |
| 107 | 107 | //anubis(_T) then "constant_byte_array(0,0)", |
| 108 | 108 | p_key then "[]", |
| 109 | 109 | boolean_field then |
| 110 | - "[field(\""+name+"\", bind_Bool(\":v_"+name+"\", get_Bool(lwa, __prefix__+\""+name+"\")))]", | |
| 110 | + "if get_mb_Bool(lwa, __prefix__+\""+name+"\") is {failure then [], success("+name+") then [field(\""+name+"\", bind_Bool(\":v_"+name+"\", "+name+"))] }", | |
| 111 | 111 | date_field(attrs) then |
| 112 | - if attrs = none then | |
| 113 | - "if get_DB_date(lwa, __prefix__+\""+name+"\") is {failure then [], success("+name+") then [field(\""+name+"\", bind_Date(\":v_"+name+"\", "+name+"))] }" | |
| 114 | - else | |
| 115 | - "[]", | |
| 112 | + if attrs is | |
| 113 | + { | |
| 114 | + none then "if get_DB_date(lwa, __prefix__+\""+name+"\") is {failure then [], success("+name+") then [field(\""+name+"\", bind_Date(\":v_"+name+"\", "+name+"))] }", | |
| 115 | + auto_now then "[field(\""+name+"\", bind_Date(\":v_"+name+"\", now))]", | |
| 116 | + auto_now_add then "[]" | |
| 117 | + }, | |
| 116 | 118 | time_field(attrs) then |
| 117 | - if attrs = none then | |
| 118 | - "if get_DB_time(lwa, __prefix__+\""+name+"\") is {failure then [], success("+name+") then [field(\""+name+"\", bind_Time(\":v_"+name+"\", "+name+"))] }" | |
| 119 | - else | |
| 120 | - "[]", | |
| 119 | + if attrs is | |
| 120 | + { | |
| 121 | + none then "if get_DB_time(lwa, __prefix__+\""+name+"\") is {failure then [], success("+name+") then [field(\""+name+"\", bind_Time(\":v_"+name+"\", "+name+"))] }", | |
| 122 | + auto_now then "[field(\""+name+"\", bind_Time(\":v_"+name+"\", now))]", | |
| 123 | + auto_now_add then "[]" | |
| 124 | + }, | |
| 121 | 125 | datetime_field(attrs) then |
| 122 | - if attrs = none then | |
| 123 | - "if get_DB_datetime(lwa, __prefix__+\""+name+"\") is {failure then [], success("+name+") then [field(\""+name+"\", bind_Datetime(\":v_"+name+"\", "+name+"))] }" | |
| 124 | - else | |
| 125 | - "[]", | |
| 126 | + if attrs is | |
| 127 | + { | |
| 128 | + none then "if get_DB_datetime(lwa, __prefix__+\""+name+"\") is {failure then [], success("+name+") then [field(\""+name+"\", bind_Datetime(\":v_"+name+"\", "+name+"))] }", | |
| 129 | + auto_now then "[field(\""+name+"\", bind_Datetime(\":v_"+name+"\", now))]", | |
| 130 | + auto_now_add then "[]" | |
| 131 | + }, | |
| 126 | 132 | foreign_key(_,_,_) then //"with "+name+" = get_DB_id(lwa, __prefix__+\""+name+"\"),", |
| 127 | 133 | "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 | 134 | integer_field(_) then //"get_Int(lwa, __prefix__+\""+name+"\")", | ... | ... |