comparison src/prepare.sml @ 338:e976b187d73a

SQL sequences
author Adam Chlipala <adamc@hcoop.net>
date Sun, 14 Sep 2008 11:02:18 -0400
parents aa89b73d83e4
children 7abb28e9d51f
comparison
equal deleted inserted replaced
337:18d5affa790d 338:e976b187d73a
161 NONE => (e, sns) 161 NONE => (e, sns)
162 | SOME (ss, n) => 162 | SOME (ss, n) =>
163 ((EDml {dml = dml, prepared = SOME (#2 sns)}, loc), 163 ((EDml {dml = dml, prepared = SOME (#2 sns)}, loc),
164 ((String.concat (rev ss), n) :: #1 sns, #2 sns + 1))) 164 ((String.concat (rev ss), n) :: #1 sns, #2 sns + 1)))
165 165
166 | ENextval {seq, ...} =>
167 let
168 val s = (EFfiApp ("Basis", "strcat", [seq, (EPrim (Prim.String "')"), loc)]), loc)
169 val s = (EFfiApp ("Basis", "strcat", [(EPrim (Prim.String "SELECT NEXTVAL('"), loc), s]), loc)
170 in
171 case prepString (s, [], 0) of
172 NONE => (e, sns)
173 | SOME (ss, n) =>
174 ((ENextval {seq = seq, prepared = SOME (#2 sns)}, loc),
175 ((String.concat (rev ss), n) :: #1 sns, #2 sns + 1))
176 end
177
166 fun prepDecl (d as (_, loc), sns) = 178 fun prepDecl (d as (_, loc), sns) =
167 case #1 d of 179 case #1 d of
168 DStruct _ => (d, sns) 180 DStruct _ => (d, sns)
169 | DDatatype _ => (d, sns) 181 | DDatatype _ => (d, sns)
170 | DDatatypeForward _ => (d, sns) 182 | DDatatypeForward _ => (d, sns)
191 in 203 in
192 ((DFunRec fs, loc), sns) 204 ((DFunRec fs, loc), sns)
193 end 205 end
194 206
195 | DTable _ => (d, sns) 207 | DTable _ => (d, sns)
208 | DSequence _ => (d, sns)
196 | DDatabase _ => (d, sns) 209 | DDatabase _ => (d, sns)
197 | DPreparedStatements _ => (d, sns) 210 | DPreparedStatements _ => (d, sns)
198 211
199 fun prepare (ds, ps) = 212 fun prepare (ds, ps) =
200 let 213 let