[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb:[3996] branches/1.3/sql/upgrade/1.2-1.3-manual.sql



Revision: 3996
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3996&view=rev
Author:   tshvr
Date:     2011-11-13 20:01:39 +0000 (Sun, 13 Nov 2011)
Log Message:
-----------
respect address1 constraint location_line_one_check

Modified Paths:
--------------
    branches/1.3/sql/upgrade/1.2-1.3-manual.sql

Modified: branches/1.3/sql/upgrade/1.2-1.3-manual.sql
===================================================================
--- branches/1.3/sql/upgrade/1.2-1.3-manual.sql	2011-11-13 18:33:31 UTC (rev 3995)
+++ branches/1.3/sql/upgrade/1.2-1.3-manual.sql	2011-11-13 20:01:39 UTC (rev 3996)
@@ -183,13 +183,15 @@
 
 INSERT INTO public.country (id, name, short_name) VALUES (-1, 'Invalid Country', 'XX');
 
+--tshvr address1 constraint "location_line_one_check"
 INSERT INTO eca_to_location(credit_id, location_class, location_id)
 SELECT eca.id, 1,
     min(location_save(NULL,
 
     case 
-        when oa.address1 = '' then 'Null' 
         when oa.address1 is null then 'Null'
+        when trim(oa.address1) = '' then 'Null' 
+        when oa.address1 !~ '[[:alnum:]_]' then 'Invalid' 
         else oa.address1 
     end,
     oa.address2, 
@@ -226,9 +228,10 @@
 SELECT eca.id, 1,
     min(location_save(NULL,
 
-    case 
-        when oa.address1 = '' then 'Null' 
+    case
         when oa.address1 is null then 'Null'
+        when trim(oa.address1) = '' then 'Null' 
+        when oa.address1 !~ '[[:alnum:]_]' then 'Invalid' 
         else oa.address1 
     end,
     oa.address2, 

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.