Commit 3a2d3aaafe8ceaa80c501bb104d847bb6efa544d
1 parent
1a8c198b
add support of float_field
Showing
4 changed files
with
22 additions
and
10 deletions
Show diff stats
src/generation/columns.anubis
| @@ -145,6 +145,7 @@ public define Maybe(String) | @@ -145,6 +145,7 @@ public define Maybe(String) | ||
| 145 | }, | 145 | }, |
| 146 | foreign_key(_,_) then success(name), | 146 | foreign_key(_,_) then success(name), |
| 147 | integer_field(_) then success(name), | 147 | integer_field(_) then success(name), |
| 148 | + float_field then success(name), | ||
| 148 | char_field(_,_) then success(name), | 149 | char_field(_,_) then success(name), |
| 149 | password_field(_) then success(name), | 150 | password_field(_) then success(name), |
| 150 | text_field(_) then success(name) | 151 | text_field(_) then success(name) |
| @@ -246,7 +247,8 @@ public define Maybe(String) | @@ -246,7 +247,8 @@ public define Maybe(String) | ||
| 246 | else | 247 | else |
| 247 | success("integer(\""+to_upper(name)+"\", \""+name+"\", "+type_name+"."+name+", "+to_Anubis_source(help)+")"), | 248 | success("integer(\""+to_upper(name)+"\", \""+name+"\", "+type_name+"."+name+", "+to_Anubis_source(help)+")"), |
| 248 | } | 249 | } |
| 249 | - | 250 | + float_field then success("float(\""+to_upper(name)+"\", \""+name+"\", "+type_name+"."+name+", "+to_Anubis_source(help)+")"), |
| 251 | + | ||
| 250 | //TODO make choices selection if need | 252 | //TODO make choices selection if need |
| 251 | char_field(choices,_) then | 253 | char_field(choices,_) then |
| 252 | if choices is | 254 | if choices is |
| @@ -329,6 +331,7 @@ public define String | @@ -329,6 +331,7 @@ public define String | ||
| 329 | datetime_field(attrs) then "to_String("+current_type_name+"."+name+")" | 331 | datetime_field(attrs) then "to_String("+current_type_name+"."+name+")" |
| 330 | foreign_key(app,foreign_table) then "get_"+foreign_table+"_show_string(db, "+current_type_name+"."+name+")", | 332 | foreign_key(app,foreign_table) then "get_"+foreign_table+"_show_string(db, "+current_type_name+"."+name+")", |
| 331 | integer_field(_) then "to_String("+current_type_name+"."+name+")", | 333 | integer_field(_) then "to_String("+current_type_name+"."+name+")", |
| 334 | + float_field then "float_to_string("+current_type_name+"."+name+",5)", | ||
| 332 | char_field(_,_) then current_type_name+"."+name, | 335 | char_field(_,_) then current_type_name+"."+name, |
| 333 | password_field(_) then current_type_name+"."+name, | 336 | password_field(_) then current_type_name+"."+name, |
| 334 | text_field(_) then current_type_name+"."+name | 337 | text_field(_) then current_type_name+"."+name |
src/generation/fields.anubis
| @@ -32,6 +32,7 @@ public define String | @@ -32,6 +32,7 @@ public define String | ||
| 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 | char_field(_,_) then "String", | 36 | char_field(_,_) then "String", |
| 36 | password_field(_) then "String", | 37 | password_field(_) then "String", |
| 37 | text_field(_) then "String" | 38 | text_field(_) then "String" |
| @@ -55,6 +56,7 @@ public define String | @@ -55,6 +56,7 @@ public define String | ||
| 55 | datetime_field(_) then "extern_type(\"DB_datetime\", \"calexium_lib/database/db_types.anubis\")", | 56 | datetime_field(_) then "extern_type(\"DB_datetime\", \"calexium_lib/database/db_types.anubis\")", |
| 56 | foreign_key(_,_) then "extern_type(\"DB_id\", \"calexium_lib/database/db_types.anubis\")", | 57 | foreign_key(_,_) then "extern_type(\"DB_id\", \"calexium_lib/database/db_types.anubis\")", |
| 57 | integer_field(_) then "int", | 58 | integer_field(_) then "int", |
| 59 | + float_field then "float", | ||
| 58 | char_field(_,_) then "string", | 60 | char_field(_,_) then "string", |
| 59 | password_field(_) then "string", | 61 | password_field(_) then "string", |
| 60 | text_field(_) then "string" | 62 | text_field(_) then "string" |
| @@ -69,16 +71,17 @@ public define String | @@ -69,16 +71,17 @@ public define String | ||
| 69 | if t is | 71 | if t is |
| 70 | { | 72 | { |
| 71 | //anubis(_T) then "ByteArray", | 73 | //anubis(_T) then "ByteArray", |
| 72 | - p_key then fill("INTEGER", 15) +" PRIMARY KEY", | ||
| 73 | - boolean_field then fill("BOOL", 15) +format_attributes(attributes), | ||
| 74 | - date_field(_) then fill("DATE", 15) +format_attributes(attributes), | ||
| 75 | - time_field(_) then fill("TIME", 15) +format_attributes(attributes), | ||
| 76 | - datetime_field(_) then fill("DATETIME", 15)+format_attributes(attributes), | ||
| 77 | - foreign_key(app,fk) then fill("INTEGER", 15) +format_attributes(attributes)+" REFERENCES "+fk+"(id) ", | ||
| 78 | - integer_field(_) then fill("INTEGER", 15) +format_attributes(attributes), | 74 | + p_key then fill("INTEGER", 15) + " PRIMARY KEY", |
| 75 | + boolean_field then fill("BOOL", 15) + format_attributes(attributes), | ||
| 76 | + date_field(_) then fill("DATE", 15) + format_attributes(attributes), | ||
| 77 | + time_field(_) then fill("TIME", 15) + format_attributes(attributes), | ||
| 78 | + datetime_field(_) then fill("DATETIME", 15) + format_attributes(attributes), | ||
| 79 | + foreign_key(app,fk) then fill("INTEGER", 15) + format_attributes(attributes)+" REFERENCES "+fk+"(id) ", | ||
| 80 | + integer_field(_) then fill("INTEGER", 15) + format_attributes(attributes), | ||
| 81 | + float_field then fill("DOUBLE", 15) + format_attributes(attributes), | ||
| 79 | char_field(_,size) then fill("VARCHAR("+size+")", 15) +format_attributes(attributes), | 82 | char_field(_,size) then fill("VARCHAR("+size+")", 15) +format_attributes(attributes), |
| 80 | - password_field(_) then fill("TEXT", 15) +format_attributes(attributes), | ||
| 81 | - text_field(_) then fill("TEXT", 15) +format_attributes(attributes), | 83 | + password_field(_) then fill("TEXT", 15) + format_attributes(attributes), |
| 84 | + text_field(_) then fill("TEXT", 15) + format_attributes(attributes), | ||
| 82 | }. | 85 | }. |
| 83 | 86 | ||
| 84 | public define String | 87 | public define String |
| @@ -97,6 +100,7 @@ public define String | @@ -97,6 +100,7 @@ public define String | ||
| 97 | datetime_field(_) then "db_datetime(\"\")", | 100 | datetime_field(_) then "db_datetime(\"\")", |
| 98 | foreign_key(_,_) then "(DB_id)none", | 101 | foreign_key(_,_) then "(DB_id)none", |
| 99 | integer_field(_) then "(Int)0", | 102 | integer_field(_) then "(Int)0", |
| 103 | + float_field then "(Float)0.0", | ||
| 100 | char_field(choices,size) then "\"\"", | 104 | char_field(choices,size) then "\"\"", |
| 101 | password_field(min_size) then "\"\"", | 105 | password_field(min_size) then "\"\"", |
| 102 | text_field(_) then "\"\"" | 106 | text_field(_) then "\"\"" |
| @@ -119,6 +123,7 @@ public define String | @@ -119,6 +123,7 @@ public define String | ||
| 119 | datetime_field(attrs) then if attrs = none then "get_DB_datetime(lwa, __prefix__+\""+name+"\")" else "with "+name+" = get_dummy_DB_datetime,", | 123 | datetime_field(attrs) then if attrs = none then "get_DB_datetime(lwa, __prefix__+\""+name+"\")" else "with "+name+" = get_dummy_DB_datetime,", |
| 120 | foreign_key(_,_) then "with "+name+" = get_DB_id(lwa, __prefix__+\""+name+"\"),", | 124 | foreign_key(_,_) then "with "+name+" = get_DB_id(lwa, __prefix__+\""+name+"\"),", |
| 121 | integer_field(_) then "get_Int(lwa, __prefix__+\""+name+"\")", | 125 | integer_field(_) then "get_Int(lwa, __prefix__+\""+name+"\")", |
| 126 | + float_field then "get_Float(lwa, __prefix__+\""+name+"\")", | ||
| 122 | char_field(_,_) then "get_String(lwa, __prefix__+\""+name+"\")", | 127 | char_field(_,_) then "get_String(lwa, __prefix__+\""+name+"\")", |
| 123 | password_field(min_size) then "get_String(lwa, __prefix__+\""+name+"_1\")", | 128 | password_field(min_size) then "get_String(lwa, __prefix__+\""+name+"_1\")", |
| 124 | text_field(_) then "get_String(lwa, __prefix__+\""+name+"\")" | 129 | text_field(_) then "get_String(lwa, __prefix__+\""+name+"\")" |
| @@ -141,6 +146,7 @@ public define String | @@ -141,6 +146,7 @@ public define String | ||
| 141 | datetime_field(_) then "db_datetime(text"+cursor_index+")", | 146 | datetime_field(_) then "db_datetime(text"+cursor_index+")", |
| 142 | foreign_key(_,_) then "db_id((Int)db_integer"+cursor_index+")", | 147 | foreign_key(_,_) then "db_id((Int)db_integer"+cursor_index+")", |
| 143 | integer_field(_) then "(Int)db_integer"+cursor_index, | 148 | integer_field(_) then "(Int)db_integer"+cursor_index, |
| 149 | + float_field then "db_float"+cursor_index, | ||
| 144 | char_field(_,_) then "text"+cursor_index, | 150 | char_field(_,_) then "text"+cursor_index, |
| 145 | password_field(_) then "text"+cursor_index, | 151 | password_field(_) then "text"+cursor_index, |
| 146 | text_field(_) then "text"+cursor_index | 152 | text_field(_) then "text"+cursor_index |
| @@ -174,6 +180,7 @@ public define String | @@ -174,6 +180,7 @@ public define String | ||
| 174 | }, | 180 | }, |
| 175 | foreign_key(_,_) then "bind_DB_id_or_NULL(\":v_"+name+"\", "+type_name+"."+name+")", | 181 | foreign_key(_,_) then "bind_DB_id_or_NULL(\":v_"+name+"\", "+type_name+"."+name+")", |
| 176 | integer_field(_) then "bind_Int(\":v_"+name+"\", "+type_name+"."+name+")", | 182 | integer_field(_) then "bind_Int(\":v_"+name+"\", "+type_name+"."+name+")", |
| 183 | + float_field then "bind_Float(\":v_"+name+"\", "+type_name+"."+name+")", | ||
| 177 | char_field(_,_) then "bind_String(\":v_"+name+"\", "+type_name+"."+name+")", | 184 | char_field(_,_) then "bind_String(\":v_"+name+"\", "+type_name+"."+name+")", |
| 178 | password_field(_) then "bind_String(\":v_"+name+"\", "+type_name+"."+name+")", | 185 | password_field(_) then "bind_String(\":v_"+name+"\", "+type_name+"."+name+")", |
| 179 | text_field(_) then "bind_String(\":v_"+name+"\", "+type_name+"."+name+")" | 186 | text_field(_) then "bind_String(\":v_"+name+"\", "+type_name+"."+name+")" |
src/generation/html.anubis
| @@ -94,6 +94,7 @@ public define String | @@ -94,6 +94,7 @@ public define String | ||
| 94 | datetime_field(attrs) then to_HTML_cell_text(column, data_name, general_type_name), | 94 | datetime_field(attrs) then to_HTML_cell_text(column, data_name, general_type_name), |
| 95 | foreign_key(app, foreign_table) then to_HTML_cell_text(column, data_name, general_type_name), | 95 | foreign_key(app, foreign_table) then to_HTML_cell_text(column, data_name, general_type_name), |
| 96 | integer_field(choices) then to_HTML_cell_text(column, data_name, general_type_name), | 96 | integer_field(choices) then to_HTML_cell_text(column, data_name, general_type_name), |
| 97 | + float_field then to_HTML_cell_text(column, data_name, general_type_name), | ||
| 97 | char_field(choices, size) then to_HTML_cell_text(column, data_name, general_type_name), | 98 | char_field(choices, size) then to_HTML_cell_text(column, data_name, general_type_name), |
| 98 | password_field(min_size) then to_HTML_cell_text(column, data_name, general_type_name), | 99 | password_field(min_size) then to_HTML_cell_text(column, data_name, general_type_name), |
| 99 | text_field(attrs) then to_HTML_cell_text(column, data_name, general_type_name), | 100 | text_field(attrs) then to_HTML_cell_text(column, data_name, general_type_name), |
src/generation/icons.anubis
| @@ -30,6 +30,7 @@ public define String | @@ -30,6 +30,7 @@ public define String | ||
| 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 | char_field(choice, size) then icn16_question, | 34 | char_field(choice, size) then icn16_question, |
| 34 | password_field(min_size) then icn16_question, | 35 | password_field(min_size) then icn16_question, |
| 35 | text_field(_) then icn16_question | 36 | text_field(_) then icn16_question |