comparison src/settings.sml @ 2108:1f1575eff4b9

Fix case issue in name mangling for MySQL
author Adam Chlipala <adam@chlipala.net>
date Thu, 22 Jan 2015 11:26:24 -0500
parents 9272476e2a1c
children 8beeb4f761b5
comparison
equal deleted inserted replaced
2107:6700f3700328 2108:1f1575eff4b9
742 fun capitalize s = 742 fun capitalize s =
743 case s of 743 case s of
744 "" => "" 744 "" => ""
745 | _ => str (Char.toUpper (String.sub (s, 0))) ^ String.extract (s, 1, NONE) 745 | _ => str (Char.toUpper (String.sub (s, 0))) ^ String.extract (s, 1, NONE)
746 746
747 val allLower = CharVector.map Char.toLower
748
747 val mangle = ref true 749 val mangle = ref true
748 fun setMangleSql x = mangle := x 750 fun setMangleSql x = mangle := x
749 fun mangleSqlTable s = if !mangle then "uw_" ^ capitalize s 751
750 else if #name (currentDbms ()) = "mysql" then capitalize s 752 fun mangleSqlTable s =
751 else lowercase s 753 if #name (currentDbms ()) = "mysql" then
752 fun mangleSql s = if !mangle then "uw_" ^ s 754 if !mangle then
753 else if #name (currentDbms ()) = "mysql" then lowercase s 755 "uw_" ^ allLower s
754 else lowercase s 756 else
755 fun mangleSqlCatalog s = if !mangle then "uw_" ^ s else lowercase s 757 allLower s
758 else
759 if !mangle then
760 "uw_" ^ capitalize s
761 else
762 lowercase s
763
764 fun mangleSql s =
765 if #name (currentDbms ()) = "mysql" then
766 if !mangle then
767 "uw_" ^ allLower s
768 else
769 allLower s
770 else
771 if !mangle then
772 "uw_" ^ s
773 else
774 lowercase s
775
776 fun mangleSqlCatalog s =
777 if #name (currentDbms ()) = "mysql" then
778 if !mangle then
779 "uw_" ^ allLower s
780 else
781 allLower s
782 else
783 if !mangle then
784 "uw_" ^ s
785 else
786 lowercase s
756 787
757 val html5 = ref false 788 val html5 = ref false
758 fun setIsHtml5 b = html5 := b 789 fun setIsHtml5 b = html5 := b
759 fun getIsHtml5 () = !html5 790 fun getIsHtml5 () = !html5
760 791