comparison src/sql.sml @ 2209:0ca11d57c175

Cleans up interface (it's now a command line option) and renames project to "sqlcache" in the all-one-word style. Still has issues to do with concurrency, retrying transactions, and foreign function calls that either rely on state or have side effects.
author Ziv Scully <ziv@mit.edu>
date Sat, 31 May 2014 03:08:16 -0400
parents 01c8aceac480
children ef766ef6e242
comparison
equal deleted inserted replaced
2208:cb74460f046a 2209:0ca11d57c175
175 SOME (str (Char.toUpper (String.sub (s, 3))) 175 SOME (str (Char.toUpper (String.sub (s, 3)))
176 ^ String.extract (s, 4, NONE)) 176 ^ String.extract (s, 4, NONE))
177 else 177 else
178 NONE) 178 NONE)
179 179
180 val field = wrap (follow t_ident 180 val field = wrap (follow (opt (follow t_ident (const ".")))
181 (follow (const ".") 181 uw_ident)
182 uw_ident)) 182 (fn (SOME (t, ()), f) => (t, f)
183 (fn (t, ((), f)) => (t, f)) 183 | (NONE, f) => ("T", f)) (* Should probably deal with this MySQL/SQLite case better some day. *)
184 184
185 datatype Rel = 185 datatype Rel =
186 Exps of exp * exp -> prop 186 Exps of exp * exp -> prop
187 | Props of prop * prop -> prop 187 | Props of prop * prop -> prop
188 188
394 handle ListPair.UnequalLengths => NONE)) 394 handle ListPair.UnequalLengths => NONE))
395 395
396 val delete = log "delete" 396 val delete = log "delete"
397 (wrap (follow (const "DELETE FROM ") 397 (wrap (follow (const "DELETE FROM ")
398 (follow uw_ident 398 (follow uw_ident
399 (follow (const " AS T_T WHERE ") 399 (follow (follow (opt (const " AS T_T")) (const " WHERE "))
400 sqexp))) 400 sqexp)))
401 (fn ((), (tab, ((), es))) => (tab, es))) 401 (fn ((), (tab, (_, es))) => (tab, es)))
402 402
403 val setting = log "setting" 403 val setting = log "setting"
404 (wrap (follow uw_ident (follow (const " = ") sqexp)) 404 (wrap (follow uw_ident (follow (const " = ") sqexp))
405 (fn (f, ((), e)) => (f, e))) 405 (fn (f, ((), e)) => (f, e)))
406 406
407 val update = log "update" 407 val update = log "update"
408 (wrap (follow (const "UPDATE ") 408 (wrap (follow (const "UPDATE ")
409 (follow uw_ident 409 (follow uw_ident
410 (follow (const " AS T_T SET ") 410 (follow (follow (opt (const " AS T_T")) (const " SET "))
411 (follow (list setting) 411 (follow (list setting)
412 (follow (ws (const "WHERE ")) 412 (follow (ws (const "WHERE "))
413 sqexp))))) 413 sqexp)))))
414 (fn ((), (tab, ((), (fs, ((), e))))) => 414 (fn ((), (tab, (_, (fs, ((), e))))) =>
415 (tab, fs, e))) 415 (tab, fs, e)))
416 416
417 val dml = log "dml" 417 val dml = log "dml"
418 (altL [wrap insert Insert, 418 (altL [wrap insert Insert,
419 wrap delete Delete, 419 wrap delete Delete,