roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject svn commit: r332312 - in /incubator/roller/trunk: ./ metadata/database/ metadata/database/hibernate/ src/org/roller/business/ src/org/roller/business/hibernate/ src/org/roller/pojos/
Date Thu, 10 Nov 2005 15:56:06 GMT
Author: snoopdave
Date: Thu Nov 10 07:55:56 2005
New Revision: 332312

URL: http://svn.apache.org/viewcvs?rev=332312&view=rev
Log:
Oracle patch from Max Rudman. Tested against PostgreSQL, HSQLDB and MySQL

Added:
    incubator/roller/trunk/metadata/database/db_oracle.properties
Modified:
    incubator/roller/trunk/build.xml
    incubator/roller/trunk/metadata/database/130-to-200-migration-raw.sql
    incubator/roller/trunk/metadata/database/createdb-raw.sql
    incubator/roller/trunk/metadata/database/droptables.sql
    incubator/roller/trunk/metadata/database/hibernate/hibernate.cfg.xml
    incubator/roller/trunk/src/org/roller/business/RefererManagerImpl.java
    incubator/roller/trunk/src/org/roller/business/hibernate/HibernateRefererManagerImpl.java
    incubator/roller/trunk/src/org/roller/pojos/CommentData.java
    incubator/roller/trunk/src/org/roller/pojos/ObjectAuditData.java

Modified: incubator/roller/trunk/build.xml
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/build.xml?rev=332312&r1=332311&r2=332312&view=diff
==============================================================================
--- incubator/roller/trunk/build.xml (original)
+++ incubator/roller/trunk/build.xml Thu Nov 10 07:55:56 2005
@@ -533,6 +533,19 @@
       <mapper type="glob" from="*-raw.sql" to="*.sql" />
     </copy>	
 	
+	<!-- Oracle -->
+	<copy toDir="${dbscripts}/oracle">
+      &custom-dbscripts;
+      <fileset dir="./metadata/database">
+        <include name="*.sql" />
+        <exclude name="droptables.sql" />
+      </fileset>
+      <filterset>
+        <filtersfile file="./metadata/database/db_oracle.properties"/>
+      </filterset>
+      <mapper type="glob" from="*-raw.sql" to="*.sql" />
+    </copy>
+	
 </target>
 
 <!-- ********************************************************************* -->

Modified: incubator/roller/trunk/metadata/database/130-to-200-migration-raw.sql
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/metadata/database/130-to-200-migration-raw.sql?rev=332312&r1=332311&r2=332312&view=diff
==============================================================================
--- incubator/roller/trunk/metadata/database/130-to-200-migration-raw.sql (original)
+++ incubator/roller/trunk/metadata/database/130-to-200-migration-raw.sql Thu Nov 10 07:55:56
2005
@@ -260,3 +260,10 @@
 
 alter table pingcategory add constraint pc_categoryid_fk
     foreign key (categoryid) references weblogcategory(id) @ADDL_FK_PARAMS@ ;
+    
+-- Oracle compatability DDL
+alter table comment rename to roller_comment;
+alter table roller_audit_log add column comment_text varchar(255);
+update roller_audit_log set comment_text = comment;
+alter table roller_audit_log modify comment_text varchar(255) not null;
+alter table roller_audit_log drop column comment;

Modified: incubator/roller/trunk/metadata/database/createdb-raw.sql
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/metadata/database/createdb-raw.sql?rev=332312&r1=332311&r2=332312&view=diff
==============================================================================
--- incubator/roller/trunk/metadata/database/createdb-raw.sql (original)
+++ incubator/roller/trunk/metadata/database/createdb-raw.sql Thu Nov 10 07:55:56 2005
@@ -5,6 +5,7 @@
 -- * For MySQL run the script createdb.sql found in the mysql directory.
 -- * For PostgreSQL run the script createdb.sql found in the postgresql directory.
 -- * For HSQLDB run the script createdb.sql found in the hsqldb directory.
+-- * For Oracle run the script createdb.sql found in the oracle directory.
 -- 
 -- For those who grabbed Roller source from CVS, don't try to run the script 
 -- named createdb-raw.sql, it is the source from which the above scripts are 
@@ -57,7 +58,7 @@
     user_id         varchar(48) not null,  
     object_id       varchar(48),           
     object_class    varchar(255),          
-    comment         varchar(255) not null, 
+    comment_text    varchar(255) not null, 
     change_time     timestamp              
 );
 
@@ -204,7 +205,7 @@
 create index nf_websiteid_idx on newsfeed( websiteid );
 
 
-create table comment (
+create table roller_comment (
     id      varchar(48) not null primary key,
     entryid varchar(48) not null,
     name    varchar(255),
@@ -216,7 +217,7 @@
     notify  @BOOLEAN_SQL_TYPE_FALSE@ not null,
     remotehost varchar(128)
 );
-create index co_entryid_idx on comment( entryid );
+create index co_entryid_idx on roller_comment( entryid );
 
 -- Ping Feature Tables
 -- name: short descriptive name of the ping target
@@ -434,7 +435,7 @@
 alter table weblogcategory add constraint wc_websiteid_fk
     foreign key ( websiteid ) references website( id ) @ADDL_FK_PARAMS@ ;
 
-alter table comment add constraint co_entryid_fk
+alter table roller_comment add constraint co_entryid_fk
     foreign key ( entryid ) references weblogentry( id ) @ADDL_FK_PARAMS@ ;
 
 alter table entryattribute add constraint att_entryid_fk

Added: incubator/roller/trunk/metadata/database/db_oracle.properties
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/metadata/database/db_oracle.properties?rev=332312&view=auto
==============================================================================
--- incubator/roller/trunk/metadata/database/db_oracle.properties (added)
+++ incubator/roller/trunk/metadata/database/db_oracle.properties Thu Nov 10 07:55:56 2005
@@ -0,0 +1 @@
+TEXT_SQL_TYPE=clob
BOOLEAN_SQL_TYPE_FALSE=number(1) default 0
BOOLEAN_SQL_TYPE_TRUE=number(1)
default 1
BOOLEAN_SQL_TYPE=number(1)
BOOLEAN_FALSE=0
BOOLEAN_TRUE=1
INDEXSIZE=
INDEXSIZE_LARGE=
ALTER_TABLE_NOT_NULL=
not null
ADDL_FK_PARAMS=
TIMESTAMP_SQL_TYPE_NULL=timestamp null
ALTER_PUBTIME_ALLOW_NULL=
ALTER_DEFAULTPAGEID_ALLOW_NULL=alter
table website modify defaultpageid varchar(48) DEFAULT ''
\ No newline at end of file

Modified: incubator/roller/trunk/metadata/database/droptables.sql
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/metadata/database/droptables.sql?rev=332312&r1=332311&r2=332312&view=diff
==============================================================================
--- incubator/roller/trunk/metadata/database/droptables.sql (original)
+++ incubator/roller/trunk/metadata/database/droptables.sql Thu Nov 10 07:55:56 2005
@@ -1,28 +1,28 @@
-drop table pingqueueentry;
-drop table pingcategory;
-drop table autoping;
-drop table pingtarget;
-drop table referer;
-drop table newsfeed;
-drop table weblogcategoryassoc;
-drop table bookmark;
-drop table comment;
-drop table entryattribute;
-drop table weblogentry;
-drop table weblogcategory;
-drop table folder;
-drop table folderassoc;
-drop table webpage;
-drop table website;
-drop table userrole;
-drop table rollerconfig;
-drop table rolleruser; 
-drop table usercookie; 
-drop table rag_config;
-drop table rag_group;
-drop table rag_subscription;
-drop table rag_entry;
-drop table rag_group_subscription;
-drop table roller_properties;
-drop table roller_audit_log;
+drop table pingqueueentry;
+drop table pingcategory;
+drop table autoping;
+drop table pingtarget;
+drop table referer;
+drop table newsfeed;
+drop table weblogcategoryassoc;
+drop table bookmark;
+drop table blogcomment;
+drop table entryattribute;
+drop table weblogentry;
+drop table weblogcategory;
+drop table folder;
+drop table folderassoc;
+drop table webpage;
+drop table website;
+drop table userrole;
+drop table rollerconfig;
+drop table rolleruser; 
+drop table usercookie; 
+drop table rag_config;
+drop table rag_group;
+drop table rag_subscription;
+drop table rag_entry;
+drop table rag_group_subscription;
+drop table roller_properties;
+drop table roller_audit_log;
 drop table roller_user_permissions;

Modified: incubator/roller/trunk/metadata/database/hibernate/hibernate.cfg.xml
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/metadata/database/hibernate/hibernate.cfg.xml?rev=332312&r1=332311&r2=332312&view=diff
==============================================================================
--- incubator/roller/trunk/metadata/database/hibernate/hibernate.cfg.xml (original)
+++ incubator/roller/trunk/metadata/database/hibernate/hibernate.cfg.xml Thu Nov 10 07:55:56
2005
@@ -10,13 +10,20 @@
         <property name="connection.datasource">java:comp/env/jdbc/rollerdb</property>
         <property name="dialect">org.hibernate.dialect.MySQLDialect</property>
         <!--
-        If you want to use HSQLDB, PostgreSQL, DB2 or Derby, then use the right dialect 
 
+        If you want to use HSQLDB, PostgreSQL, DB2 or Derby, Oracle then use the right dialect
  
         <property name="dialect">org.hibernate.dialect.HQLDBDialect</property>

         <property name="dialect">org.hibernate.dialect.PostgreSQLDialect</property>
         <property name="dialect">org.hibernate.dialect.DB2Dialect</property>
         <property name="dialect">org.hibernate.dialect.DerbyDialect</property>
+        <property name="dialect">org.hibernate.dialect.Oracle9Dialect</property>
         -->
 
+        <!--
+        Turning this on gets rid of ANTLR dependency; 
+        See http://forum.hibernate.org/viewtopic.php?t=939468
+        <property name="hibernate.query.factory_class">org.hibernate.hql.classic.ClassicQueryTranslatorFactory</property>
+        -->
+		
         <!--
         Examples for configuring Hibernate to use the JDBC Driver Manager
         <property name="hibernate.connection.driver_class">org.hsqldb.jdbcDriver</property>

Modified: incubator/roller/trunk/src/org/roller/business/RefererManagerImpl.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/business/RefererManagerImpl.java?rev=332312&r1=332311&r2=332312&view=diff
==============================================================================
--- incubator/roller/trunk/src/org/roller/business/RefererManagerImpl.java (original)
+++ incubator/roller/trunk/src/org/roller/business/RefererManagerImpl.java Thu Nov 10 07:55:56
2005
@@ -366,6 +366,10 @@
     private boolean checkForSpam(String refererUrl, WebsiteData website) throws RollerException
     {
         String spamwords = RollerRuntimeConfig.getProperty("spam.referers.ignorewords");
+        if (spamwords == null) {
+        		// Oracle returns nulls instead of empty string so next line would throw NPE.
+        		spamwords = "";
+        }
         LinkedList spamWords = new LinkedList(Arrays.asList(
                 StringUtils.split(StringUtils.deleteWhitespace(spamwords), ",")));
     

Modified: incubator/roller/trunk/src/org/roller/business/hibernate/HibernateRefererManagerImpl.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/business/hibernate/HibernateRefererManagerImpl.java?rev=332312&r1=332311&r2=332312&view=diff
==============================================================================
--- incubator/roller/trunk/src/org/roller/business/hibernate/HibernateRefererManagerImpl.java
(original)
+++ incubator/roller/trunk/src/org/roller/business/hibernate/HibernateRefererManagerImpl.java
Thu Nov 10 07:55:56 2005
@@ -204,6 +204,14 @@
                         "group by u.username,w.name,w.id order by s desc fetch first " +
                         Integer.toString(max) + " rows only");
                 stmt.setBoolean(1, true);
+            } else if (con.getMetaData().getDriverName().startsWith("Oracle")) {
+				String sql = "select u.username,w.name,w.handle,sum(r.dayhits) as s "+
+                "from rolleruser u, website w, referer r "+
+                "where r.websiteid=w.id and w.userid=u.id and w.isenabled= ? and rownum <=
? " +
+                "group by u.username,w.name,w.handle order by s desc";
+				stmt = con.prepareStatement(sql);
+				stmt.setBoolean(1, true);
+				stmt.setInt(2, max );				
             } else {
                 stmt = con.prepareStatement(
                         "select w.id,w.name,w.handle,sum(r.dayhits) as s "+

Modified: incubator/roller/trunk/src/org/roller/pojos/CommentData.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/pojos/CommentData.java?rev=332312&r1=332311&r2=332312&view=diff
==============================================================================
--- incubator/roller/trunk/src/org/roller/pojos/CommentData.java (original)
+++ incubator/roller/trunk/src/org/roller/pojos/CommentData.java Thu Nov 10 07:55:56 2005
@@ -10,7 +10,7 @@
  * @ejb:bean name="CommentData"
  * @struts.form include-all="true"
  * 
- * @hibernate.class lazy="false" table="comment"  
+ * @hibernate.class lazy="false" table="roller_comment"  
  */
 public class CommentData extends org.roller.pojos.PersistentObject
     implements java.io.Serializable

Modified: incubator/roller/trunk/src/org/roller/pojos/ObjectAuditData.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/pojos/ObjectAuditData.java?rev=332312&r1=332311&r2=332312&view=diff
==============================================================================
--- incubator/roller/trunk/src/org/roller/pojos/ObjectAuditData.java (original)
+++ incubator/roller/trunk/src/org/roller/pojos/ObjectAuditData.java Thu Nov 10 07:55:56 2005
@@ -68,7 +68,7 @@
     }
     /**
      * @ejb:persistent-field
-     * @hibernate.property column="comment" non-null="true" unique="false"
+     * @hibernate.property column="comment_text" non-null="true" unique="false"
      */
     public String getComment()
     {



Mime
View raw message