Commit 3a2d3aaafe8ceaa80c501bb104d847bb6efa544d

Authored by totoro
1 parent 1a8c198b

add support of float_field

src/generation/columns.anubis
... ... @@ -145,6 +145,7 @@ public define Maybe(String)
145 145 },
146 146 foreign_key(_,_) then success(name),
147 147 integer_field(_) then success(name),
  148 + float_field then success(name),
148 149 char_field(_,_) then success(name),
149 150 password_field(_) then success(name),
150 151 text_field(_) then success(name)
... ... @@ -246,7 +247,8 @@ public define Maybe(String)
246 247 else
247 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 252 //TODO make choices selection if need
251 253 char_field(choices,_) then
252 254 if choices is
... ... @@ -329,6 +331,7 @@ public define String
329 331 datetime_field(attrs) then "to_String("+current_type_name+"."+name+")"
330 332 foreign_key(app,foreign_table) then "get_"+foreign_table+"_show_string(db, "+current_type_name+"."+name+")",
331 333 integer_field(_) then "to_String("+current_type_name+"."+name+")",
  334 + float_field then "float_to_string("+current_type_name+"."+name+",5)",
332 335 char_field(_,_) then current_type_name+"."+name,
333 336 password_field(_) then current_type_name+"."+name,
334 337 text_field(_) then current_type_name+"."+name
... ...
src/generation/fields.anubis
... ... @@ -32,6 +32,7 @@ public define String
32 32 datetime_field(_) then "DB_datetime",
33 33 foreign_key(_,_) then "DB_id",
34 34 integer_field(_) then "Int",
  35 + float_field then "Float",
35 36 char_field(_,_) then "String",
36 37 password_field(_) then "String",
37 38 text_field(_) then "String"
... ... @@ -55,6 +56,7 @@ public define String
55 56 datetime_field(_) then "extern_type(\"DB_datetime\", \"calexium_lib/database/db_types.anubis\")",
56 57 foreign_key(_,_) then "extern_type(\"DB_id\", \"calexium_lib/database/db_types.anubis\")",
57 58 integer_field(_) then "int",
  59 + float_field then "float",
58 60 char_field(_,_) then "string",
59 61 password_field(_) then "string",
60 62 text_field(_) then "string"
... ... @@ -69,16 +71,17 @@ public define String
69 71 if t is
70 72 {
71 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 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 87 public define String
... ... @@ -97,6 +100,7 @@ public define String
97 100 datetime_field(_) then "db_datetime(\"\")",
98 101 foreign_key(_,_) then "(DB_id)none",
99 102 integer_field(_) then "(Int)0",
  103 + float_field then "(Float)0.0",
100 104 char_field(choices,size) then "\"\"",
101 105 password_field(min_size) then "\"\"",
102 106 text_field(_) then "\"\""
... ... @@ -119,6 +123,7 @@ public define String
119 123 datetime_field(attrs) then if attrs = none then "get_DB_datetime(lwa, __prefix__+\""+name+"\")" else "with "+name+" = get_dummy_DB_datetime,",
120 124 foreign_key(_,_) then "with "+name+" = get_DB_id(lwa, __prefix__+\""+name+"\"),",
121 125 integer_field(_) then "get_Int(lwa, __prefix__+\""+name+"\")",
  126 + float_field then "get_Float(lwa, __prefix__+\""+name+"\")",
122 127 char_field(_,_) then "get_String(lwa, __prefix__+\""+name+"\")",
123 128 password_field(min_size) then "get_String(lwa, __prefix__+\""+name+"_1\")",
124 129 text_field(_) then "get_String(lwa, __prefix__+\""+name+"\")"
... ... @@ -141,6 +146,7 @@ public define String
141 146 datetime_field(_) then "db_datetime(text"+cursor_index+")",
142 147 foreign_key(_,_) then "db_id((Int)db_integer"+cursor_index+")",
143 148 integer_field(_) then "(Int)db_integer"+cursor_index,
  149 + float_field then "db_float"+cursor_index,
144 150 char_field(_,_) then "text"+cursor_index,
145 151 password_field(_) then "text"+cursor_index,
146 152 text_field(_) then "text"+cursor_index
... ... @@ -174,6 +180,7 @@ public define String
174 180 },
175 181 foreign_key(_,_) then "bind_DB_id_or_NULL(\":v_"+name+"\", "+type_name+"."+name+")",
176 182 integer_field(_) then "bind_Int(\":v_"+name+"\", "+type_name+"."+name+")",
  183 + float_field then "bind_Float(\":v_"+name+"\", "+type_name+"."+name+")",
177 184 char_field(_,_) then "bind_String(\":v_"+name+"\", "+type_name+"."+name+")",
178 185 password_field(_) then "bind_String(\":v_"+name+"\", "+type_name+"."+name+")",
179 186 text_field(_) then "bind_String(\":v_"+name+"\", "+type_name+"."+name+")"
... ...
src/generation/html.anubis
... ... @@ -94,6 +94,7 @@ public define String
94 94 datetime_field(attrs) then to_HTML_cell_text(column, data_name, general_type_name),
95 95 foreign_key(app, foreign_table) then to_HTML_cell_text(column, data_name, general_type_name),
96 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 98 char_field(choices, size) then to_HTML_cell_text(column, data_name, general_type_name),
98 99 password_field(min_size) then to_HTML_cell_text(column, data_name, general_type_name),
99 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 30 datetime_field(attrs) then icn16_clock,
31 31 foreign_key(app,foreign_table) then icn16_question,
32 32 integer_field(choice) then icn16_question,
  33 + float_field then icn16_question,
33 34 char_field(choice, size) then icn16_question,
34 35 password_field(min_size) then icn16_question,
35 36 text_field(_) then icn16_question
... ...