Permalink
Browse files

в процессе

  • Loading branch information...
1 parent 2029bab commit 0f930b9a4657fd01f149fb23ff0b87f26038e479 @voidlizard committed Mar 22, 2011
Showing with 16 additions and 3 deletions.
  1. +1 −0 src/parser.mly
  2. +3 −1 src/report.ml
  3. +2 −0 src/report_builder.ml
  4. +9 −1 src/t/busreport.rep
  5. +1 −1 src/t/busreport.tmpl
View
@@ -191,6 +191,7 @@ filt_bin_arg:
filt_arg:
| NUMBER { B.number_constant $1 }
| STRING { B.string_constant $1 }
+// | source { B.var_filt_arg $1 }
filt_like_arg:
| OBR STRING CBR { B.string_constant $2 }
View
@@ -49,7 +49,7 @@ and fun_call_t = { fun_ns: fun_ns_t; fun_name: string; fun_args: fun_arg_t list
and field_t = { field_alias: string; field_source: field_src_t; field_flt: (filt_op_t * string) list}
and field_src_t = FIELD_FUN_CALL of fun_call_t
-and val_t = STR_CONST of string | NUM_CONST of string | VAR_REF of string
+and val_t = STR_CONST of string | NUM_CONST of string | VAR_REF of string | SRC of source_t
let ident i s = P.sprintf "%s %s" i s
@@ -207,6 +207,7 @@ let str_of_val = function
| NUM_CONST(s) -> s
| STR_CONST(s) -> s
| VAR_REF(s) -> P.sprintf "${%s}" s
+ | SRC _ -> failwith "Unsupported yet filter arg (var)"
let rec emit_sql_fun fn args =
let argz = List.map (fun a -> emit_sql_fun_arg a) args |> String.join ","
@@ -240,6 +241,7 @@ and quote = function
| STR_CONST(s) -> P.sprintf "'%s'" s
| NUM_CONST(v) -> v
| VAR_REF(n) -> P.sprintf "${%s}" n
+ | SRC(x) -> failwith "Unsupported yet filter arg (var)"
and val_of = function
| LIKE(v) | GT(v) | LT(v) | GE(v)
| LE(v) | LE(v) | NE(v) | EQ(v) -> v
View
@@ -61,6 +61,8 @@ let string_constant s = STR_CONST(s)
let number_constant v = NUM_CONST(v)
+let var_filt_arg x = SRC x
+
let with_column cattr report =
let col = List.fold_left (fun c f -> f c)
{ col_name = None;
View
@@ -1,6 +1,6 @@
%% ТЕСТОВЫЙ ОТЧЕТ 3
-CONNECTION db1 "dbname=mososm2"
+CONNECTION db1 "dbname=tambov_prod"
TEMPLATE_DIRS "t:/home/dmz/templates"
@@ -40,3 +40,11 @@ COLUMN
%% FOLD YES
END
+COLUMN
+ SOURCE SQL.bus_mileage(v.gos_number, "2010-11-01", "2010-12-31")
+ ALIAS mileage
+ NAME "пробег"
+ %% SORT ASC
+ %% FOLD YES
+END
+
View
@@ -3,7 +3,7 @@ Report column: ${header.busn}
Report column: ${header.driver}
#foreach (row in rows)
-${row.busn} : ${row.year} : ${row.driver} : ${row.speeding}
+${row.obj.busn} : ${row.obj.year} : ${row.obj.driver} : ${row.obj.speeding} : ${row.obj.mileage}
#end
${SQL}

0 comments on commit 0f930b9

Please sign in to comment.