Mercurial > urweb
comparison src/cjr_print.sml @ 1381:bf58ca871c00
Detect missing 'database' directive; don't compile garbage C files
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Thu, 06 Jan 2011 09:14:06 -0500 |
parents | 44a12a321150 |
children | 86d23010ea74 |
comparison
equal
deleted
inserted
replaced
1380:ede95ecb4000 | 1381:bf58ca871c00 |
---|---|
2754 (x, sql_type_in env t)) xts) :: !views | 2754 (x, sql_type_in env t)) xts) :: !views |
2755 | DSequence s => sequences := s :: !sequences | 2755 | DSequence s => sequences := s :: !sequences |
2756 | DPreparedStatements ss => prepped := ss | 2756 | DPreparedStatements ss => prepped := ss |
2757 | _ => ()) ds | 2757 | _ => ()) ds |
2758 | 2758 |
2759 val hasDb = !hasDb | 2759 val hasDb = !hasDb |
2760 | |
2761 fun expDb (e, _) = | |
2762 case e of | |
2763 ECon (_, _, SOME e) => expDb e | |
2764 | ESome (_, e) => expDb e | |
2765 | EFfiApp (_, _, es) => List.exists expDb es | |
2766 | EApp (e, es) => expDb e orelse List.exists expDb es | |
2767 | EUnop (_, e) => expDb e | |
2768 | EBinop (_, e1, e2) => expDb e1 orelse expDb e2 | |
2769 | ERecord (_, xes) => List.exists (expDb o #2) xes | |
2770 | EField (e, _) => expDb e | |
2771 | ECase (e, pes, _) => expDb e orelse List.exists (expDb o #2) pes | |
2772 | EError (e, _) => expDb e | |
2773 | EReturnBlob {blob = e1, mimeType = e2, ...} => expDb e1 orelse expDb e2 | |
2774 | ERedirect (e, _) => expDb e | |
2775 | EWrite e => expDb e | |
2776 | ESeq (e1, e2) => expDb e1 orelse expDb e2 | |
2777 | ELet (_, _, e1, e2) => expDb e1 orelse expDb e2 | |
2778 | EQuery _ => true | |
2779 | EDml _ => true | |
2780 | ENextval _ => true | |
2781 | ESetval _ => true | |
2782 | EUnurlify (e, _, _) => expDb e | |
2783 | _ => false | |
2784 | |
2785 fun declDb (d, _) = | |
2786 case d of | |
2787 DVal (_, _, _, e) => expDb e | |
2788 | DFun (_, _, _, _, e) => expDb e | |
2789 | DFunRec vis => List.exists (expDb o #5) vis | |
2790 | _ => false | |
2791 | |
2792 val () = if not hasDb andalso List.exists declDb ds then | |
2793 ErrorMsg.error "Application uses a database but has none configured with 'database' in .urp file." | |
2794 else | |
2795 () | |
2760 | 2796 |
2761 val cookies = List.mapPartial (fn (DCookie s, _) => SOME s | _ => NONE) ds | 2797 val cookies = List.mapPartial (fn (DCookie s, _) => SOME s | _ => NONE) ds |
2762 | 2798 |
2763 val cookieCode = foldl (fn (cookie, acc) => | 2799 val cookieCode = foldl (fn (cookie, acc) => |
2764 SOME (case acc of | 2800 SOME (case acc of |