comparison src/prepare.sml @ 858:346cf1908a17

Avoid using prepared statements for non-persistent protocols
author Adam Chlipala <adamc@hcoop.net>
date Sat, 27 Jun 2009 10:50:45 -0400
parents 8688e01ae469
children 3c7b48040dcf
comparison
equal deleted inserted replaced
857:3d2f6cb6d54a 858:346cf1908a17
194 ((EQuery {exps = exps, tables = tables, rnum = rnum, 194 ((EQuery {exps = exps, tables = tables, rnum = rnum,
195 state = state, query = query, body = body, 195 state = state, query = query, body = body,
196 initial = initial, prepared = NONE}, loc), 196 initial = initial, prepared = NONE}, loc),
197 sns) 197 sns)
198 | SOME (ss, n) => 198 | SOME (ss, n) =>
199 ((EQuery {exps = exps, tables = tables, rnum = rnum, 199 let
200 state = state, query = query, body = body, 200 val s = String.concat (rev ss)
201 initial = initial, prepared = SOME (#2 sns)}, loc), 201 in
202 ((String.concat (rev ss), n) :: #1 sns, #2 sns + 1)) 202 ((EQuery {exps = exps, tables = tables, rnum = rnum,
203 state = state, query = query, body = body,
204 initial = initial, prepared = SOME (#2 sns, s)}, loc),
205 ((s, n) :: #1 sns, #2 sns + 1))
206 end
203 end 207 end
204 208
205 | EDml {dml, ...} => 209 | EDml {dml, ...} =>
206 (case prepString (dml, [], 0) of 210 (case prepString (dml, [], 0) of
207 NONE => (e, sns) 211 NONE => (e, sns)
208 | SOME (ss, n) => 212 | SOME (ss, n) =>
209 ((EDml {dml = dml, prepared = SOME (#2 sns)}, loc), 213 let
210 ((String.concat (rev ss), n) :: #1 sns, #2 sns + 1))) 214 val s = String.concat (rev ss)
215 in
216 ((EDml {dml = dml, prepared = SOME (#2 sns, s)}, loc),
217 ((s, n) :: #1 sns, #2 sns + 1))
218 end)
211 219
212 | ENextval {seq, ...} => 220 | ENextval {seq, ...} =>
213 let 221 let
214 val s = case seq of 222 val s = case seq of
215 (EPrim (Prim.String s), loc) => 223 (EPrim (Prim.String s), loc) =>
222 end 230 end
223 in 231 in
224 case prepString (s, [], 0) of 232 case prepString (s, [], 0) of
225 NONE => (e, sns) 233 NONE => (e, sns)
226 | SOME (ss, n) => 234 | SOME (ss, n) =>
227 ((ENextval {seq = seq, prepared = SOME (#2 sns)}, loc), 235 let
228 ((String.concat (rev ss), n) :: #1 sns, #2 sns + 1)) 236 val s = String.concat (rev ss)
237 in
238 ((ENextval {seq = seq, prepared = SOME (#2 sns, s)}, loc),
239 ((s, n) :: #1 sns, #2 sns + 1))
240 end
229 end 241 end
230 242
231 | EUnurlify (e, t) => 243 | EUnurlify (e, t) =>
232 let 244 let
233 val (e, sns) = prepExp (e, sns) 245 val (e, sns) = prepExp (e, sns)