[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [skrooge/Feature] skgbasemodeler: Correction tests
From:       Stephane Mankowski <stephane () mankowski ! fr>
Date:       2011-08-31 22:28:39
Message-ID: 20110831222839.B1969A6078 () git ! kde ! org
[Download RAW message or body]

Git commit f4368cea3d99c5841cffd14368d458deada295cd by Stephane Mankowski.
Committed on 01/09/2011 at 00:28.
Pushed by smankowski into branch 'Feature'.

Correction tests

M  +9    -5    skgbasemodeler/skgdocument.cpp

http://commits.kde.org/skrooge/f4368cea3d99c5841cffd14368d458deada295cd

diff --git a/skgbasemodeler/skgdocument.cpp b/skgbasemodeler/skgdocument.cpp
index 5d87017..887f706 100644
--- a/skgbasemodeler/skgdocument.cpp
+++ b/skgbasemodeler/skgdocument.cpp
@@ -1172,6 +1172,10 @@ SKGError SKGDocument::refreshViewsIndexesAndTriggers()
     /**
     * This constant is used to initialized the data model (trigger creation)
     */
+    QString rd_node_id = "r_node_id";
+    double v = SKGServices::stringToDouble(getParameter("SKG_DB_VERSION"));
+    if(v == 0 || v >= 1.4) rd_node_id = "rd_node_id";
+
     QStringList InitialDataModelTrigger;
     InitialDataModelTrigger
     DELETECASCADEPARAMETER("parameters")
@@ -1188,17 +1192,17 @@ SKGError SKGDocument::refreshViewsIndexesAndTriggers()
             << "CREATE TRIGGER cpt_node_fullname1 "
             "AFTER INSERT ON node BEGIN "
             "UPDATE node SET t_fullname="
-            "CASE WHEN new.rd_node_id IS NULL OR new.rd_node_id='' OR \
new.rd_node_id=0 THEN new.t_name ELSE (SELECT c.t_fullname from node c where \
c.id=new.rd_node_id)||'" % OBJECTSEPARATOR % "'||new.t_name END " +            "CASE \
WHEN new.rd_node_id IS NULL OR new." % rd_node_id % "='' OR new." % rd_node_id % "=0 \
THEN new.t_name ELSE (SELECT c.t_fullname from node c where c.id=new." % rd_node_id % \
")||'" % OBJECTSEPARATOR % "'||new.t_name END "  "WHERE id=new.id;"
             "END"
 
             << "DROP TRIGGER IF EXISTS cpt_node_fullname2"
             << "CREATE TRIGGER cpt_node_fullname2 "
-            "AFTER UPDATE OF t_name, rd_node_id ON node BEGIN "
+            "AFTER UPDATE OF t_name, " % rd_node_id % " ON node BEGIN "
             "UPDATE node SET t_fullname="
-            "CASE WHEN new.rd_node_id IS NULL OR new.rd_node_id='' OR \
new.rd_node_id=0 THEN new.t_name ELSE (SELECT c.t_fullname from node c where \
c.id=new.rd_node_id)||'" % OBJECTSEPARATOR % "'||new.t_name END " +            "CASE \
WHEN new." % rd_node_id % " IS NULL OR new." % rd_node_id % "='' OR new." % \
rd_node_id % "=0 THEN new.t_name ELSE (SELECT c.t_fullname from node c where \
c.id=new." % rd_node_id % ")||'" % OBJECTSEPARATOR % "'||new.t_name END "  "WHERE \
                id=new.id;"
-            "UPDATE node SET t_name=t_name WHERE rd_node_id=new.id;"
+            "UPDATE node SET t_name=t_name WHERE " % rd_node_id % "=new.id;"
             "END"
 
             << "DROP TRIGGER IF EXISTS fkdc_node_parent_id_node_id"
@@ -1212,7 +1216,7 @@ SKGError SKGDocument::refreshViewsIndexesAndTriggers()
                           << "CREATE UNIQUE INDEX uidx_parameters_uuid_parent_name \
ON parameters (t_uuid_parent, t_name)"  
                           << "DROP INDEX IF EXISTS uidx_node_parent_id_name"
-                          << "CREATE UNIQUE INDEX uidx_node_parent_id_name ON \
node(t_name,rd_node_id)" +                          << "CREATE UNIQUE INDEX \
uidx_node_parent_id_name ON node(t_name," % rd_node_id % ")"  
                           << "DROP INDEX IF EXISTS uidx_node_fullname"
                           << "CREATE UNIQUE INDEX uidx_node_fullname ON \
node(t_fullname)"


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic