Commit dab0bd7f2271670ef283168f3810809de6338f1c
1 parent
210cb395
fix potential issue with the "prefix" argument of "extract_from_web_arg" functio…
…n being masked by another symbol which could be specified by the user (in short, rename "prefix" as "__prefix__") add logging of errors on "extract_from_web_arg" failure and "update" table queries
Showing
1 changed file
with
6 additions
and
4 deletions
Show diff stats
src/generation/types.anubis
| @@ -127,7 +127,7 @@ public define Maybe(One) | @@ -127,7 +127,7 @@ public define Maybe(One) | ||
| 127 | " extract_from_web_arg\n"+ | 127 | " extract_from_web_arg\n"+ |
| 128 | " (\n"+ | 128 | " (\n"+ |
| 129 | " List(Web_arg) lwa,\n"+ | 129 | " List(Web_arg) lwa,\n"+ |
| 130 | - " String prefix\n"+ | 130 | + " String __prefix__\n"+ |
| 131 | " )=\n"+ //head of the definition | 131 | " )=\n"+ //head of the definition |
| 132 | to_String(list_of_web_arg)+ //all editable components of the type | 132 | to_String(list_of_web_arg)+ //all editable components of the type |
| 133 | " success(\n"+generate_constructor(name, columns, " ")+")\n"+ //generate type construction with values got from web arg | 133 | " success(\n"+generate_constructor(name, columns, " ")+")\n"+ //generate type construction with values got from web arg |
| @@ -283,12 +283,14 @@ public define Maybe(One) | @@ -283,12 +283,14 @@ public define Maybe(One) | ||
| 283 | " \"update_"+name+" (INSERT)\")),\n"+ | 283 | " \"update_"+name+" (INSERT)\")),\n"+ |
| 284 | //UPDATE SQL query | 284 | //UPDATE SQL query |
| 285 | " db_id(idx) then\n"+ | 285 | " db_id(idx) then\n"+ |
| 286 | - " forget(sql_query_timeout(db,\n"+ | 286 | + " if sql_query_timeout(db,\n"+ |
| 287 | " \"UPDATE "+name+" SET\n"+ | 287 | " \"UPDATE "+name+" SET\n"+ |
| 288 | update_values(columns, " ")+"\n"+ | 288 | update_values(columns, " ")+"\n"+ |
| 289 | " WHERE id = \"+idx+\";\",\n"+ | 289 | " WHERE id = \"+idx+\";\",\n"+ |
| 290 | generate_Bind_list(columns, name, " ", false)+",\n"+ | 290 | generate_Bind_list(columns, name, " ", false)+",\n"+ |
| 291 | - " \"update_"+name+" (UPDATE)\"))\n"+ | 291 | + " \"update_"+name+" (UPDATE)\") is { \n"+ |
| 292 | + " error(sql_error)\n"+ | ||
| 293 | + " then logError(debug_log, db_error(sql_error, \"update_"+name+"\")), ok(_, _, _) then unique }\n"+ | ||
| 292 | " }.\n\n"+ | 294 | " }.\n\n"+ |
| 293 | "public define Maybe(One)\n"+ | 295 | "public define Maybe(One)\n"+ |
| 294 | " update_"+name+"\n"+ | 296 | " update_"+name+"\n"+ |
| @@ -298,7 +300,7 @@ public define Maybe(One) | @@ -298,7 +300,7 @@ public define Maybe(One) | ||
| 298 | " )=\n"+ | 300 | " )=\n"+ |
| 299 | " if extract_from_web_arg(lwa, \"\") is\n"+ | 301 | " if extract_from_web_arg(lwa, \"\") is\n"+ |
| 300 | " {\n"+ | 302 | " {\n"+ |
| 301 | - " failure then failure,\n"+ | 303 | + " failure then logError(debug_log, \"update_"+name+" extract_from_web_arg is failure\"); failure,\n"+ |
| 302 | " success("+name+") then success(update_"+name+"(db, "+name+"))\n"+ | 304 | " success("+name+") then success(update_"+name+"(db, "+name+"))\n"+ |
| 303 | " }.\n\n" | 305 | " }.\n\n" |
| 304 | 306 |