Commit 6429553ee88a5ba15c274fa205023a61a45ab337

Authored by totoro
1 parent 18ac3754

update to be conform to last hayamiki_lib

calexium_lib @ 8b4b368f40f
1 -Subproject commit 27e8cf1ccd9efc33d9c8bf4a247dfc0d3e5dbe7a 1 +Subproject commit 8b4b368f40fb62c5583b14081d817309aa56337a
hayamiki_lib @ 601f9714449
1 -Subproject commit c35a09600434ab87f1e00cb454b97dd668d99ccb 1 +Subproject commit 601f9714449737d52f05351db81e3c22fd0b27a7
src/generation/SQL_get_all.anubis
@@ -110,19 +110,19 @@ public define Maybe(One) @@ -110,19 +110,19 @@ public define Maybe(One)
110 " success(cursor) then _get_all_"+name+"(cursor, [])\n"+ 110 " success(cursor) then _get_all_"+name+"(cursor, [])\n"+
111 " }\n"+ 111 " }\n"+
112 ".\n"+ 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 "public define List(JsonValue)\n"+ 127 "public define List(JsonValue)\n"+
128 " _get_all_"+name+"_to_json\n"+ 128 " _get_all_"+name+"_to_json\n"+
@@ -144,21 +144,23 @@ public define Maybe(One) @@ -144,21 +144,23 @@ public define Maybe(One)
144 " (\n"+ 144 " (\n"+
145 " SQLite3DataBase db,\n"+ 145 " SQLite3DataBase db,\n"+
146 " List(String) columns,\n"+ 146 " List(String) columns,\n"+
  147 +" Bool resolve_fk,\n"+
147 " HK_Referer referer,\n"+ 148 " HK_Referer referer,\n"+
148 " String filter,\n"+ 149 " String filter,\n"+
149 " String order_by\n"+ 150 " String order_by\n"+
150 " )=\n"+ 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 " with _and_ = if length(ref_clause) > 0 & length(filter) > 0 then \" AND \" else \"\",\n"+ 154 " with _and_ = if length(ref_clause) > 0 & length(filter) > 0 then \" AND \" else \"\",\n"+
153 " if get_all_"+name+"_by_clause(db, ref_clause+_and_+filter+\" \"+order_by) is\n"+ 155 " if get_all_"+name+"_by_clause(db, ref_clause+_and_+filter+\" \"+order_by) is\n"+
154 " {\n"+ 156 " {\n"+
155 " failure then json_array([]),\n"+ 157 " failure then json_array([]),\n"+
156 " success(cursor) then\n"+ 158 " success(cursor) then\n"+
157 " json_array(\n"+ 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 " )\n"+ 164 " )\n"+
163 " }\n"+ 165 " }\n"+
164 ".\n" 166 ".\n"
src/generation/extractor.anubis
@@ -174,20 +174,20 @@ public define Maybe(One) @@ -174,20 +174,20 @@ public define Maybe(One)
174 //generate the type of the table that contain all components 174 //generate the type of the table that contain all components
175 if write_string(stream, 175 if write_string(stream,
176 "\n\n"+ 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 "public define Maybe(JsonValue)\n"+ 191 "public define Maybe(JsonValue)\n"+
192 " extract_"+name+"_cursor_to_json\n"+ 192 " extract_"+name+"_cursor_to_json\n"+
193 " (\n"+ 193 " (\n"+
@@ -211,6 +211,7 @@ public define Maybe(One) @@ -211,6 +211,7 @@ public define Maybe(One)
211 " (\n"+ 211 " (\n"+
212 " SQLite3DataBase db,\n"+ 212 " SQLite3DataBase db,\n"+
213 " String component_name,\n"+ 213 " String component_name,\n"+
  214 +" Bool resolve_fk\n"+
214 " )=\n"+generate_json_extractor(name, "cursor", columns, " ")+ 215 " )=\n"+generate_json_extractor(name, "cursor", columns, " ")+
215 "\n.\n\n"+ 216 "\n.\n\n"+
216 217
@@ -218,9 +219,10 @@ public define Maybe(One) @@ -218,9 +219,10 @@ public define Maybe(One)
218 " make_json_extractor\n"+ 219 " make_json_extractor\n"+
219 " (\n"+ 220 " (\n"+
220 " SQLite3DataBase db,\n"+ 221 " SQLite3DataBase db,\n"+
221 -" List(String) columns\n"+ 222 +" List(String) columns,\n"+
  223 +" Bool resolve_fk\n"+
222 " )=\n"+ 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 ".\n" 226 ".\n"
225 ) is //end of the function 227 ) is //end of the function
226 { 228 {
src/generation/fields.anubis
@@ -77,9 +77,15 @@ public define String @@ -77,9 +77,15 @@ public define String
77 //anubis(_T) then "ByteArray", 77 //anubis(_T) then "ByteArray",
78 p_key then fill("INTEGER", 15) + " PRIMARY KEY", 78 p_key then fill("INTEGER", 15) + " PRIMARY KEY",
79 boolean_field then fill("BOOL", 15) + format_attributes(attributes), 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 foreign_key(app,fk,_) then fill("INTEGER", 15) + format_attributes(attributes)+" REFERENCES "+fk+"(id) ", 89 foreign_key(app,fk,_) then fill("INTEGER", 15) + format_attributes(attributes)+" REFERENCES "+fk+"(id) ",
84 integer_field(_) then fill("INTEGER", 15) + format_attributes(attributes), 90 integer_field(_) then fill("INTEGER", 15) + format_attributes(attributes),
85 float_field then fill("DOUBLE", 15) + format_attributes(attributes), 91 float_field then fill("DOUBLE", 15) + format_attributes(attributes),
src/generation/files.anubis
@@ -124,7 +124,7 @@ define Maybe(One) @@ -124,7 +124,7 @@ define Maybe(One)
124 List(String) transmit, 124 List(String) transmit,
125 List(String) view, 125 List(String) view,
126 List(String) edit, 126 List(String) edit,
127 - List(String) writer, 127 +// List(String) writer,
128 List(String) delete, 128 List(String) delete,
129 List(String) controllers, 129 List(String) controllers,
130 String dest_dir 130 String dest_dir
@@ -143,7 +143,8 @@ define Maybe(One) @@ -143,7 +143,8 @@ define Maybe(One)
143 * 143 *
144 */ 144 */
145 read tools/basis.anubis 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 join("\n", transmit)+"\n\n"+ 148 join("\n", transmit)+"\n\n"+
148 "public define List(VTM_view)\n"+ 149 "public define List(VTM_view)\n"+
149 " generated_vtm_view_list =\n"+ 150 " generated_vtm_view_list =\n"+
@@ -153,10 +154,10 @@ join("\n", transmit)+"\n\n"+ @@ -153,10 +154,10 @@ join("\n", transmit)+"\n\n"+
153 " generated_vtm_edit_list =\n"+ 154 " generated_vtm_edit_list =\n"+
154 " [\n "+join(",\n ",edit)+"\n"+ 155 " [\n "+join(",\n ",edit)+"\n"+
155 " ].\n\n"+ 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 "public define List(TM_delete)\n"+ 161 "public define List(TM_delete)\n"+
161 " generated_tm_delete_list =\n"+ 162 " generated_tm_delete_list =\n"+
162 " [\n "+join(",\n ",delete)+"\n"+ 163 " [\n "+join(",\n ",delete)+"\n"+
@@ -181,7 +182,7 @@ define One @@ -181,7 +182,7 @@ define One
181 List(String) so_far_transmit, 182 List(String) so_far_transmit,
182 List(String) so_far_view, 183 List(String) so_far_view,
183 List(String) so_far_edit, 184 List(String) so_far_edit,
184 - List(String) so_far_writer, 185 +// List(String) so_far_writer,
185 List(String) so_far_delete, 186 List(String) so_far_delete,
186 List(String) so_far_controllers, 187 List(String) so_far_controllers,
187 String dest_dir 188 String dest_dir
@@ -191,9 +192,9 @@ define One @@ -191,9 +192,9 @@ define One
191 [] then 192 [] then
192 if apps is 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 [app . apps_t] then 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,7 +203,7 @@ define One
202 with transmit = "transmit "+name+".anubis", 203 with transmit = "transmit "+name+".anubis",
203 with view = "vtm_view(\""+name+"\", get_viewable_"+name+", get_all_"+name+"_view_name)", 204 with view = "vtm_view(\""+name+"\", get_viewable_"+name+", get_all_"+name+"_view_name)",
204 with edit = "vtm_edit(\""+name+"\", get_editable_"+name+")", 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 with delete = "tm_delete(\""+name+"\", delete_"+name+")", 207 with delete = "tm_delete(\""+name+"\", delete_"+name+")",
207 with controller = 208 with controller =
208 "hk_table_controller(\""+name+"\", 209 "hk_table_controller(\""+name+"\",
@@ -210,14 +211,18 @@ define One @@ -210,14 +211,18 @@ define One
210 update_"+name+"_from_type, 211 update_"+name+"_from_type,
211 update_"+name+"_from_fields, 212 update_"+name+"_from_fields,
212 //Read 213 //Read
213 - get_count_"+name+"_by_clause, 214 + (SQLite3DataBase db, String clause) |-> get_count_by_clause(db, \""+name+"\", clause),
214 get_one_"+name+"_to_json, 215 get_one_"+name+"_to_json,
215 get_all_"+name+"_by_clause_to_json, 216 get_all_"+name+"_by_clause_to_json,
216 //Delete 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 define One 228 define One
@@ -227,7 +232,7 @@ define One @@ -227,7 +232,7 @@ define One
227 String dest_dir 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 define Maybe(One) 238 define Maybe(One)
src/generation/json.anubis
@@ -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+"\", if resolve_fk then json_string(get_"+foreign_table+"_show_string(db, "+current_type_name+"."+name+"))) else json_int("+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,11 @@ public define String @@ -88,7 +88,11 @@ 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
  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 integer_field(_) then "json_member(\""+name+"\", json_int((Int)db_integer"+cursor_index+"))", 96 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))", 97 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+"))", 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,7 +95,7 @@ public define Maybe(One)
95 failure then println("can't write get_default "+type_name); failure, 95 failure then println("can't write get_default "+type_name); failure,
96 success(_) then success(unique) 96 success(_) then success(unique)
97 }. 97 }.
98 - 98 +
99 99
100 public define Maybe(One) 100 public define Maybe(One)
101 generate_columns_list 101 generate_columns_list
@@ -116,14 +116,8 @@ public define Maybe(One) @@ -116,14 +116,8 @@ public define Maybe(One)
116 failure then println("can't write generate_columns_list "+type_name); failure, 116 failure then println("can't write generate_columns_list "+type_name); failure,
117 success(_) then success(unique) 117 success(_) then success(unique)
118 }. 118 }.
119 -  
120 -  
121 119
122 120
123 -  
124 -  
125 -  
126 -  
127 public define Maybe(One) 121 public define Maybe(One)
128 generate_get_one 122 generate_get_one
129 ( 123 (
@@ -192,11 +186,12 @@ public define Maybe(One) @@ -192,11 +186,12 @@ public define Maybe(One)
192 "public define JsonValue\n"+ 186 "public define JsonValue\n"+
193 " get_one_"+name+"_to_json\n"+ 187 " get_one_"+name+"_to_json\n"+
194 " (\n"+ 188 " (\n"+
195 -" SQLite3DataBase db,\n"+ 189 +" SQLite3DataBase db,\n"+
196 " List(String) columns,\n"+ 190 " List(String) columns,\n"+
  191 +" Bool resolve_fk,\n"+
197 " DB_id idx\n"+ 192 " DB_id idx\n"+
198 " )=\n"+ 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 " with error = json_object(map((String col_name) |-> json_member(col_name, json_null), final_columns)),\n"+ 195 " with error = json_object(map((String col_name) |-> json_member(col_name, json_null), final_columns)),\n"+
201 "\n"+ 196 "\n"+
202 " if idx is\n"+ 197 " if idx is\n"+
@@ -207,18 +202,18 @@ public define Maybe(One) @@ -207,18 +202,18 @@ public define Maybe(One)
207 " {\n"+ 202 " {\n"+
208 " failure then error,\n"+ 203 " failure then error,\n"+
209 " success(cursor) then\n"+ 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 " }\n"+ 217 " }\n"+
223 " }\n"+ 218 " }\n"+
224 ".\n\n" 219 ".\n\n"
src/generation/web_args.anubis
@@ -107,22 +107,28 @@ public define String @@ -107,22 +107,28 @@ public define String
107 //anubis(_T) then "constant_byte_array(0,0)", 107 //anubis(_T) then "constant_byte_array(0,0)",
108 p_key then "[]", 108 p_key then "[]",
109 boolean_field then 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 date_field(attrs) then 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 time_field(attrs) then 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 datetime_field(attrs) then 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 foreign_key(_,_,_) then //"with "+name+" = get_DB_id(lwa, __prefix__+\""+name+"\"),", 132 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+"))] }" 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 integer_field(_) then //"get_Int(lwa, __prefix__+\""+name+"\")", 134 integer_field(_) then //"get_Int(lwa, __prefix__+\""+name+"\")",