db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arm...@apache.org
Subject svn commit: r464343 - /db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/platforms/PlatformMySQLImpl.java
Date Mon, 16 Oct 2006 00:52:11 GMT
Author: arminw
Date: Sun Oct 15 17:52:09 2006
New Revision: 464343

URL: http://svn.apache.org/viewvc?view=rev&rev=464343
Log:
add support for stored procedure based sequence key generation

Modified:
    db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/platforms/PlatformMySQLImpl.java

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/platforms/PlatformMySQLImpl.java
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/platforms/PlatformMySQLImpl.java?view=diff&rev=464343&r1=464342&r2=464343
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/platforms/PlatformMySQLImpl.java
(original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/platforms/PlatformMySQLImpl.java
Sun Oct 15 17:52:09 2006
@@ -22,6 +22,8 @@
 import java.sql.PreparedStatement;
 import java.sql.SQLException;
 import java.sql.Types;
+import java.sql.CallableStatement;
+import java.sql.Connection;
 
 import org.apache.ojb.broker.query.LikeCriteria;
 import org.apache.ojb.broker.metadata.FieldDescriptor;
@@ -202,5 +204,22 @@
     protected String getQuotedName(String aString)
     {
         return '`' + aString + '`';
+    }
+
+    public CallableStatement prepareNextValProcedureStatement(
+            Connection con, String procedureName, String sequenceName) throws PlatformException
+    {
+        try
+        {
+            String sp = "{call " + procedureName + "(?, ?)}";
+            CallableStatement cs = con.prepareCall(sp);
+            cs.registerOutParameter(1, Types.INTEGER);
+            cs.setString(2, sequenceName);
+            return cs;
+        }
+        catch (SQLException e)
+        {
+            throw new PlatformException(e);
+        }
     }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message