During a compile with the latest Ur/Web release (7b508cd0dbf9), the
compiler mangled the definition [table tname] project [projectname] into
the MySQL name [uw_Projectname_tname] at one point in the binary rather
than [uw_projectname_tname], thus causing the compiled binary to fail.

Upon further investigation, it appeared that the problem was in
monoize.sml:4685, which simply prefixed "uw_" rather than calling
[Settings.mangleSql].  I've attached a patch (suitable for use with [hg
import]) which fixes this individual problem, but I'm not sure if
similar issues might exist elsewhere.  It might be nice if the compiler
used SML's type system to protect against table names being used
directly in SQL without being blessed through [mangleSql], but I suspect
that would be too large of a change to be practical.

-- 
Istvan Chung
((lambda (x)
   (list x (list (quote quote) x)))
 (quote
  (lambda (x)
    (list x (list (quote quote) x)))))
# HG changeset patch
# User Istvan Chung <[email protected]>
# Date 1429821435 14400
# Node ID e722bcc42eab08be18b12011bdd5d8bcd25e0d18
# Parent  7b508cd0dbf98dbe782d1027b9f56331bcca59c0
Fix missing SQL name-mangling in table initialization

diff --git a/src/monoize.sml b/src/monoize.sml
--- a/src/monoize.sml
+++ b/src/monoize.sml
@@ -4682,8 +4682,8 @@
                                      (L'.EDml (str
                                                    (foldl (fn ((x, _), s) =>
                                                               s ^ ", " ^ Settings.mangleSql x ^ " = NULL")
-                                                          ("UPDATE uw_"
-                                                           ^ tab
+                                                          ("UPDATE "
+                                                           ^ Settings.mangleSql tab
                                                            ^ " SET "
                                                            ^ Settings.mangleSql x
                                                                       ^ " = NULL")

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Ur mailing list
[email protected]
http://www.impredicative.com/cgi-bin/mailman/listinfo/ur

Reply via email to