You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by Vadim Gritsenko <va...@reverycodes.com> on 2004/12/24 20:02:40 UTC

[PATCH] Enable SequenceManagerStoredProcedureImpl under Oracle platform

Hi all,

This simple patch enables usage of SequenceManagerStoredProcedureImpl when OJB 
is running under Oracle. Method prepareNextValProcedureStatement implementation 
is simply copied over from PlatformMsSQLServerImpl class.

Patch is against OJB_1_0_RELEASE, tested with Oracle 9i.

Vadim

Re: [PATCH] Enable SequenceManagerStoredProcedureImpl under Oracle platform

Posted by Jakob Braeuchi <jb...@gmx.ch>.
hi vadim,

thanks for your contribution. the fix is in cvs (trunk and branch).

jakob

Vadim Gritsenko schrieb:
> Hi all,
> 
> This simple patch enables usage of SequenceManagerStoredProcedureImpl 
> when OJB is running under Oracle. Method 
> prepareNextValProcedureStatement implementation is simply copied over 
> from PlatformMsSQLServerImpl class.
> 
> Patch is against OJB_1_0_RELEASE, tested with Oracle 9i.
> 
> Vadim
> 
> 
> ------------------------------------------------------------------------
> 
> Index: src/java/org/apache/ojb/broker/platforms/PlatformOracleImpl.java
> ===================================================================
> RCS file: /home/cvspublic/db-ojb/src/java/org/apache/ojb/broker/platforms/PlatformOracleImpl.java,v
> retrieving revision 1.20
> diff -u -r1.20 PlatformOracleImpl.java
> --- src/java/org/apache/ojb/broker/platforms/PlatformOracleImpl.java	22 May 2004 09:55:33 -0000	1.20
> +++ src/java/org/apache/ojb/broker/platforms/PlatformOracleImpl.java	24 Dec 2004 18:52:55 -0000
> @@ -25,6 +25,7 @@
>  import java.lang.reflect.Field;
>  import java.security.AccessController;
>  import java.security.PrivilegedAction;
> +import java.sql.CallableStatement;
>  import java.sql.Connection;
>  import java.sql.DatabaseMetaData;
>  import java.sql.PreparedStatement;
> @@ -49,6 +50,24 @@
>      protected static final int THIN_CLOB_MAX_SIZE = 4000;
>      private Logger logger = LoggerFactory.getLogger(PlatformOracleImpl.class);
>  
> +    // Copied from PlatformMsSQLServerImpl
> +    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);
> +        }
> +    }
> +
>      /**
>       * In Oracle we set escape processing explizit 'true' after a statement was created.
>       */
> 
> 
> 
> ------------------------------------------------------------------------
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-dev-help@db.apache.org

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