Author: seanahn
Date: Tue Jan 20 11:51:56 2009
New Revision: 736082

URL: http://svn.apache.org/viewvc?rev=736082&view=rev
Log:
ODE-470, Sybase throws 'Invalid operator for datatype op: MODULO type: NUMERIC' 
errors during startup

Modified:
    
ode/branches/APACHE_ODE_1.X/scheduler-simple/src/main/java/org/apache/ode/scheduler/simple/JdbcDelegate.java

Modified: 
ode/branches/APACHE_ODE_1.X/scheduler-simple/src/main/java/org/apache/ode/scheduler/simple/JdbcDelegate.java
URL: 
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/scheduler-simple/src/main/java/org/apache/ode/scheduler/simple/JdbcDelegate.java?rev=736082&r1=736081&r2=736082&view=diff
==============================================================================
--- 
ode/branches/APACHE_ODE_1.X/scheduler-simple/src/main/java/org/apache/ode/scheduler/simple/JdbcDelegate.java
 (original)
+++ 
ode/branches/APACHE_ODE_1.X/scheduler-simple/src/main/java/org/apache/ode/scheduler/simple/JdbcDelegate.java
 Tue Jan 20 11:51:56 2009
@@ -60,8 +60,11 @@
     private static final String UPGRADE_JOB_SQLSERVER = "update ODE_JOB set 
nodeid = ? where nodeid is null "
             + "and (ts % ?) = ? and ts < ?";
 
+    private static final String UPGRADE_JOB_SYBASE = "update ODE_JOB set 
nodeid = ? where nodeid is null "
+            + "and convert(int, ts) % ? = ? and ts < ?";
+
     private static final String UPGRADE_JOB_SYBASE12 = "update ODE_JOB set 
nodeid = ? where nodeid is null "
-        + "and -1 <> ? and -1 <> ? and ts < ?";
+               + "and -1 <> ? and -1 <> ? and ts < ?";
     
     private static final String SAVE_JOB = "insert into ODE_JOB "
             + " (jobid, nodeid, ts, scheduled, transacted, details) values(?, 
?, ?, ?, ?, ?)";
@@ -71,10 +74,6 @@
     private static final String SCHEDULE_IMMEDIATE = "select jobid, ts, 
transacted, scheduled, details from ODE_JOB "
             + "where nodeid = ? and ts < ? order by ts";
 
-    private static final String UPDATE_SCHEDULED = "update ODE_JOB set 
scheduled = 1 where jobid in (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
-
-    private static final int UPDATE_SCHEDULED_SLOTS = 10;
-
     private DataSource _ds;
 
     private Dialect _dialect;
@@ -220,14 +219,16 @@
         PreparedStatement ps = null;
         try {
             con = getConnection();
-            if (_dialect == Dialect.SQLSERVER || _dialect == Dialect.SYBASE) {
-              ps = con.prepareStatement(UPGRADE_JOB_SQLSERVER);
+            if (_dialect == Dialect.SQLSERVER) {
+               ps = con.prepareStatement(UPGRADE_JOB_SQLSERVER);
             } else if (_dialect == Dialect.DB2) {
-              ps = con.prepareStatement(UPGRADE_JOB_DB2);
+               ps = con.prepareStatement(UPGRADE_JOB_DB2);
+            } else if (_dialect == Dialect.SYBASE) {
+               ps = con.prepareStatement(UPGRADE_JOB_SYBASE);
             } else if (_dialect == Dialect.SYBASE12) {
                 ps = con.prepareStatement(UPGRADE_JOB_SYBASE12);
             } else {
-              ps = con.prepareStatement(UPGRADE_JOB_DEFAULT);
+               ps = con.prepareStatement(UPGRADE_JOB_DEFAULT);
             }
             ps.setString(1, node);
             ps.setInt(2, numNodes);


Reply via email to