Commit 3cd8455e764a0e5925bd9a9ea2d7ff509963335f
1 parent
dab0bd7f
add a prefix (type name) to extract_from_web_arg function generation due to collision issues
Showing
2 changed files
with
14 additions
and
14 deletions
Show diff stats
src/generation/fields.anubis
| ... | ... | @@ -83,16 +83,16 @@ public define String |
| 83 | 83 | if t is |
| 84 | 84 | { |
| 85 | 85 | //anubis(_T) then "constant_byte_array(0,0)", |
| 86 | - p_key then "with "+name+" = get_DB_id(lwa, \""+name+"\"),", | |
| 86 | + p_key then "with "+name+" = get_DB_id(lwa, __prefix__+\""+name+"\"),", | |
| 87 | 87 | //binary then "constant_byte_array(0,0)", |
| 88 | - boolean_field then "with "+name+" = get_Bool(lwa, \""+name+"\"),", | |
| 89 | - date_field(attrs) then if attrs = none then "get_DB_date(lwa, \""+name+"\")" else "with "+name+" = get_dummy_DB_date,", | |
| 90 | - time_field(attrs) then if attrs = none then "get_DB_time(lwa, \""+name+"\")" else "with "+name+" = get_dummy_DB_time,", | |
| 91 | - datetime_field(attrs) then if attrs = none then "get_DB_datetime(lwa, \""+name+"\")" else "with "+name+" = get_dummy_DB_datetime,", | |
| 92 | - foreign_key(_,_) then "get_Int(lwa, \""+name+"\")", | |
| 93 | - integer_field then "get_Int(lwa, \""+name+"\")", | |
| 94 | - char_field(_,_) then "get_String(lwa, \""+name+"\")", | |
| 95 | - text_field then "get_String(lwa, \""+name+"\")" | |
| 88 | + boolean_field then "with "+name+" = get_Bool(lwa, __prefix__+\""+name+"\"),", | |
| 89 | + date_field(attrs) then if attrs = none then "get_DB_date(lwa, __prefix__+\""+name+"\")" else "with "+name+" = get_dummy_DB_date,", | |
| 90 | + time_field(attrs) then if attrs = none then "get_DB_time(lwa, __prefix__+\""+name+"\")" else "with "+name+" = get_dummy_DB_time,", | |
| 91 | + datetime_field(attrs) then if attrs = none then "get_DB_datetime(lwa, __prefix__+\""+name+"\")" else "with "+name+" = get_dummy_DB_datetime,", | |
| 92 | + foreign_key(_,_) then "get_Int(lwa, __prefix__+\""+name+"\")", | |
| 93 | + integer_field then "get_Int(lwa, __prefix__+\""+name+"\")", | |
| 94 | + char_field(_,_) then "get_String(lwa, __prefix__+\""+name+"\")", | |
| 95 | + text_field then "get_String(lwa, __prefix__+\""+name+"\")" | |
| 96 | 96 | }. |
| 97 | 97 | |
| 98 | 98 | public define String | ... | ... |
src/generation/types.anubis
| ... | ... | @@ -123,8 +123,8 @@ public define Maybe(One) |
| 123 | 123 | since _generate_extract_web_arg(columns, [], 0) is ((List(String))list_of_web_arg, (Int) nb_closure), |
| 124 | 124 | //generate the type of the table that contain all components |
| 125 | 125 | if write_string(stream, |
| 126 | - "\n\ndefine Maybe("+type_name+")\n"+ | |
| 127 | - " extract_from_web_arg\n"+ | |
| 126 | + "\n\npublic define Maybe("+type_name+")\n"+ | |
| 127 | + " extract_"+type_name+"_from_web_arg\n"+ | |
| 128 | 128 | " (\n"+ |
| 129 | 129 | " List(Web_arg) lwa,\n"+ |
| 130 | 130 | " String __prefix__\n"+ |
| ... | ... | @@ -134,7 +134,7 @@ public define Maybe(One) |
| 134 | 134 | " "+fill(nb_closure, '}')+ //add close } according to number of web arg |
| 135 | 135 | ".\n") is //end of the function |
| 136 | 136 | { |
| 137 | - failure then println("can't write extract_from_web_arg "+type_name); failure, | |
| 137 | + failure then println("can't write extract_"+type_name+"_from_web_arg "+type_name); failure, | |
| 138 | 138 | success(_) then success(unique) |
| 139 | 139 | }. |
| 140 | 140 | |
| ... | ... | @@ -298,9 +298,9 @@ public define Maybe(One) |
| 298 | 298 | " SQLite3DataBase db,\n"+ |
| 299 | 299 | " List(Web_arg) lwa\n"+ |
| 300 | 300 | " )=\n"+ |
| 301 | - " if extract_from_web_arg(lwa, \"\") is\n"+ | |
| 301 | + " if extract_"+type_name+"_from_web_arg(lwa, \"\") is\n"+ | |
| 302 | 302 | " {\n"+ |
| 303 | - " failure then logError(debug_log, \"update_"+name+" extract_from_web_arg is failure\"); failure,\n"+ | |
| 303 | + " failure then logError(debug_log, \"update_"+name+" extract_"+type_name+"_from_web_arg is failure\"); failure,\n"+ | |
| 304 | 304 | " success("+name+") then success(update_"+name+"(db, "+name+"))\n"+ |
| 305 | 305 | " }.\n\n" |
| 306 | 306 | ... | ... |