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 to...@apache.org on 2005/12/18 12:44:03 UTC

cvs commit: db-ojb/src/java/org/apache/ojb/broker/platforms PlatformDerbyImpl.java

tomdz       2005/12/18 03:44:03

  Modified:    src/java/org/apache/ojb/broker/platforms Tag:
                        OJB_1_0_RELEASE PlatformDerbyImpl.java
  Log:
  Added workaround for handling of Character instances in Derby
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.1.2.3   +32 -0     db-ojb/src/java/org/apache/ojb/broker/platforms/Attic/PlatformDerbyImpl.java
  
  Index: PlatformDerbyImpl.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/platforms/Attic/PlatformDerbyImpl.java,v
  retrieving revision 1.1.2.2
  retrieving revision 1.1.2.3
  diff -u -r1.1.2.2 -r1.1.2.3
  --- PlatformDerbyImpl.java	13 Dec 2005 20:29:20 -0000	1.1.2.2
  +++ PlatformDerbyImpl.java	18 Dec 2005 11:44:03 -0000	1.1.2.3
  @@ -1,5 +1,9 @@
   package org.apache.ojb.broker.platforms;
   
  +import java.sql.PreparedStatement;
  +import java.sql.SQLException;
  +import java.sql.Types;
  +
   /* Copyright 2002-2004 The Apache Software Foundation
    *
    * Licensed under the Apache License, Version 2.0 (the "License");
  @@ -32,6 +36,34 @@
       /**
        * {@inheritDoc}
        */
  +    protected String getConcatenationCharacter()
  +    {
  +        return ",";
  +    }
  +
  +    /**
  +     * {@inheritDoc}
  +     */
  +    public void setObjectForStatement(PreparedStatement ps, int index, Object value, int jdbcType) throws SQLException
  +    {
  +        if (((jdbcType == Types.CHAR) || (jdbcType == Types.VARCHAR)) &&
  +            (value instanceof Character))
  +        {
  +            // [tomdz]
  +            // Currently, Derby doesn't like Character objects in the PreparedStatement
  +            // when using PreparedStatement#setObject(index, value, jdbcType) method
  +            // So we make a String object out of the Character object and use that instead
  +            super.setObjectForStatement(ps, index, value.toString(), jdbcType);
  +        }
  +        else
  +        {
  +            super.setObjectForStatement(ps, index, value, jdbcType);
  +        }
  +    }
  +
  +    /**
  +     * {@inheritDoc}
  +     */
       public String getLastInsertIdentityQuery(String tableName)
       {
           // matthias.roth@impart.ch
  
  
  

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