roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject svn commit: r1160041 - in /roller/trunk/weblogger-business/src/main: java/org/apache/roller/weblogger/business/jpa/JPAWeblogManagerImpl.java resources/sql/400-to-500-migration.vm resources/sql/createdb.vm resources/sql/macros.vm
Date Sun, 21 Aug 2011 19:45:04 GMT
Author: snoopdave
Date: Sun Aug 21 19:45:04 2011
New Revision: 1160041

URL: http://svn.apache.org/viewvc?rev=1160041&view=rev
Log:
Committing patch for "Roller 5 MSSQL Issues/Fixes" ROL-1927, contributed by Nick Padilla.
Thanks Nick!

   https://issues.apache.org/jira/browse/ROL-1927

Modified:
    roller/trunk/weblogger-business/src/main/java/org/apache/roller/weblogger/business/jpa/JPAWeblogManagerImpl.java
    roller/trunk/weblogger-business/src/main/resources/sql/400-to-500-migration.vm
    roller/trunk/weblogger-business/src/main/resources/sql/createdb.vm
    roller/trunk/weblogger-business/src/main/resources/sql/macros.vm

Modified: roller/trunk/weblogger-business/src/main/java/org/apache/roller/weblogger/business/jpa/JPAWeblogManagerImpl.java
URL: http://svn.apache.org/viewvc/roller/trunk/weblogger-business/src/main/java/org/apache/roller/weblogger/business/jpa/JPAWeblogManagerImpl.java?rev=1160041&r1=1160040&r2=1160041&view=diff
==============================================================================
--- roller/trunk/weblogger-business/src/main/java/org/apache/roller/weblogger/business/jpa/JPAWeblogManagerImpl.java
(original)
+++ roller/trunk/weblogger-business/src/main/java/org/apache/roller/weblogger/business/jpa/JPAWeblogManagerImpl.java
Sun Aug 21 19:45:04 2011
@@ -357,6 +357,11 @@ public class JPAWeblogManagerImpl implem
                 }
             }
         }
+
+        roller.getMediaFileManager().createRootMediaFileDirectory(newWeblog);
+        
+        // flush so that all data up to this point can be available in db
+        this.strategy.flush();
         
         // add any auto enabled ping targets
         PingTargetManager pingTargetMgr = roller.getPingTargetManager();
@@ -374,8 +379,6 @@ public class JPAWeblogManagerImpl implem
             }
         }
 
-        roller.getMediaFileManager().createRootMediaFileDirectory(newWeblog);
-
     }
     
     public Weblog getWeblog(String id) throws WebloggerException {

Modified: roller/trunk/weblogger-business/src/main/resources/sql/400-to-500-migration.vm
URL: http://svn.apache.org/viewvc/roller/trunk/weblogger-business/src/main/resources/sql/400-to-500-migration.vm?rev=1160041&r1=1160040&r2=1160041&view=diff
==============================================================================
--- roller/trunk/weblogger-business/src/main/resources/sql/400-to-500-migration.vm (original)
+++ roller/trunk/weblogger-business/src/main/resources/sql/400-to-500-migration.vm Sun Aug
21 19:45:04 2011
@@ -18,7 +18,7 @@ create table roller_permission (
    objectid        varchar(48),           
    objecttype      varchar(255),          
    pending         $db.BOOLEAN_SQL_TYPE_TRUE,         
-   datecreated     timestamp not null
+   datecreated     $db.TIMESTAMP_SQL_TYPE not null
 );
 
 insert into roller_permission (id,username,actions,objectid,objecttype,pending,datecreated)

@@ -43,23 +43,23 @@ insert into roller_permission (id,userna
 #dropNotNullFromColumn("website" "userid" "varchar(48)")
 
 #addColumnNull("website" "creator" "varchar(255)")
-update website as w set 
+update website set 
     lastmodified = lastmodified,
     datecreated = datecreated,
-    creator = (select u.username from rolleruser as u where u.id = w.userid);
+    creator = (select u.username from rolleruser as u where u.id = userid);
 
 #dropNotNullFromColumn("weblogentry" "userid" "varchar(48)")
 #addColumnNull("weblogentry" "creator" "varchar(255)")
-update weblogentry as w set
+update weblogentry set
     pubtime = pubtime,
     updatetime = updatetime, 
-    creator = (select u.username from rolleruser as u where u.id = w.userid);
+    creator = (select u.username from rolleruser as u where u.id = userid);
 
 #dropNotNullFromColumn("roller_weblogentrytag" "userid" "varchar(48)")
 #addColumnNull("roller_weblogentrytag" "creator" "varchar(255)")
-update roller_weblogentrytag as w set 
+update roller_weblogentrytag set 
     time = time,
-    creator = (select u.username from rolleruser as u where u.id = w.userid);
+    creator = (select u.username from rolleruser as u where u.id = userid);
 
 
 -- USER ATTRIBUTE

Modified: roller/trunk/weblogger-business/src/main/resources/sql/createdb.vm
URL: http://svn.apache.org/viewvc/roller/trunk/weblogger-business/src/main/resources/sql/createdb.vm?rev=1160041&r1=1160040&r2=1160041&view=diff
==============================================================================
--- roller/trunk/weblogger-business/src/main/resources/sql/createdb.vm (original)
+++ roller/trunk/weblogger-business/src/main/resources/sql/createdb.vm Sun Aug 21 19:45:04
2011
@@ -51,7 +51,7 @@ create table roller_permission (
    objectid        varchar(48),           
    objecttype      varchar(255), 
    pending         $db.BOOLEAN_SQL_TYPE_TRUE,         
-   datecreated     timestamp not null
+   datecreated     $db.TIMESTAMP_SQL_TYPE not null
 );
 
 -- Audit log records time and comment about change

Modified: roller/trunk/weblogger-business/src/main/resources/sql/macros.vm
URL: http://svn.apache.org/viewvc/roller/trunk/weblogger-business/src/main/resources/sql/macros.vm?rev=1160041&r1=1160040&r2=1160041&view=diff
==============================================================================
--- roller/trunk/weblogger-business/src/main/resources/sql/macros.vm (original)
+++ roller/trunk/weblogger-business/src/main/resources/sql/macros.vm Sun Aug 21 19:45:04 2011
@@ -3,7 +3,7 @@
 Special macro to add table column with default null
 **#
 #macro(addColumnNull $table $column $type)
-#if ($db.DBTYPE == "ORACLE")
+#if ($db.DBTYPE == "ORACLE" || $db.DBTYPE == "MSSQL")
     alter table $table add $column $type default null;
 #else
     alter table $table add column $column $type default null;
@@ -26,7 +26,7 @@ Special macro to add table column with n
     alter table $table add column $column $type default $default not null; 
 #elseif ($db.DBTYPE == "DERBY" || $db.DBTYPE == "DB2")
     alter table $table add column $column $type with default $default not null;
-#elseif ($db.DBTYPE == "ORACLE")
+#elseif ($db.DBTYPE == "ORACLE" || $db.DBTYPE == "MSSQL")
     alter table $table add $column $type default $default not null;  
 #end
 #end
@@ -61,7 +61,7 @@ Special macro to drop NOT NULL requireme
     alter table $table modify $colname $coltype null;
 #elseif ($db.DBTYPE == "POSTGRESQL")
     alter table $table  alter column $colname drop not null;
-#elseif ($db.DBTYPE == "HSQLDB")
+#elseif ($db.DBTYPE == "HSQLDB" || $db.DBTYPE == "MSSQL")
     alter table $table alter column $colname $coltype null;
 #elseif ($db.DBTYPE == "DERBY" || $db.DBTYPE == "DB2")
     alter table $table alter column $colname null;
@@ -116,4 +116,12 @@ drop table if exists $tableName;
 #end
 
 
-#macro(concat $s1 $s2) #if ($db.DBTYPE != "MYSQL") $s1 || $s2 #else concat($s1, $s2) #end
#end
+#macro(concat $s1 $s2) 
+#if ($db.DBTYPE == "MSSQL") 
+	$s1 + $s2 
+#elseif ($db.DBTYPE != "MYSQL")
+	$s1 || $s2 
+#else 
+	concat($s1, $s2) 
+#end 
+#end



Mime
View raw message