4 | SECall
of string and list sqlexpr
10 value compare_ident a b
=
11 Pervasives.compare
(String.uppercase a
) (String.uppercase b
)
16 [ Create_table
of string and list sqlcolspec
17 | Insert
of string and list
string and list sqlexpr
19 and sqlcolspec
= (string * string * option (int * int)) (* name, type, wid *)
23 value (int_of_sqlnum
: string -> int) sn
=
32 value string_of_ident i
= i
35 value rec string_of_sqlexpr e
=
37 [ SENum s
-> sprintf
"Num(%s)" s
38 | SEStr s
-> sprintf
"Str(%S)" s
43 (String.concat
", " (List.map string_of_sqlexpr el
))
44 | SEIdent s
-> sprintf
"Ident(%s)" s
49 value string_of_colspec cs
=
50 let (nam
, ty
, optsz
) = cs
in
54 | Some
(wid
, dec
) -> sprintf
"(%i, %i)" wid dec
57 sprintf
"%s %s %s" nam ty
sz
61 value string_of_sqlcmd sc
=
63 [ Create_table n cs
->
64 sprintf
"Create_table(%s,%s);\n"
66 (String.concat
"" (List.map
(fun s
-> sprintf
" %s\n" (string_of_colspec s
)) cs
))
68 sprintf
"Insert(%s,\n%s\n%s\n);\n"
70 (String.concat
", " (List.map string_of_ident cs
))
71 (String.concat
", " (List.map string_of_sqlexpr vs
))
76 value (execute_sql_command_val
: ref (sqlcmd
-> unit)) =
77 ref (fun _
-> failwith
"execute_sql_command_val not defined")