Mercurial > urweb
comparison src/sql.sml @ 2245:27899da8780b
Sqlcache allows any expression injected into SQL.
author | Ziv Scully <ziv@mit.edu> |
---|---|
date | Sun, 02 Aug 2015 18:25:42 -0700 |
parents | f70a91f7810d |
children | 565da55a4e18 |
comparison
equal
deleted
inserted
replaced
2244:e4a7e3cd6f11 | 2245:27899da8780b |
---|---|
303 (EPrim (Prim.String (Prim.Normal, "FALSE")), _))], _), _) :: chs => | 303 (EPrim (Prim.String (Prim.Normal, "FALSE")), _))], _), _) :: chs => |
304 SOME (e, chs) | 304 SOME (e, chs) |
305 | 305 |
306 | _ => NONE | 306 | _ => NONE |
307 | 307 |
308 fun sqlifySqlcache chs = | 308 (* For sqlcache, we only care that we can do string equality on injected Mono |
309 case chs of | 309 expressions, so accept any expression without modifying it. *) |
310 (* Could have variables or constants as well as FFIs. *) | 310 val sqlifySqlcache = |
311 Exp (e as (ERel _, _)) :: chs => SOME (e, chs) | 311 fn Exp e :: chs => SOME (e, chs) |
312 (* If it is an FFI, match the entire expression. *) | 312 | _ => None |
313 | Exp (e as (EFfiApp ("Basis", f, [(_, _)]), _)) :: chs => | |
314 if String.isPrefix "sqlify" f then | |
315 SOME (e, chs) | |
316 else | |
317 NONE | |
318 | _ => sqlify chs | |
319 | 313 |
320 fun constK s = wrap (const s) (fn () => s) | 314 fun constK s = wrap (const s) (fn () => s) |
321 | 315 |
322 val funcName = altL [constK "COUNT", | 316 val funcName = altL [constK "COUNT", |
323 constK "MIN", | 317 constK "MIN", |