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 @@
       /**
        * [EMAIL PROTECTED]
        */
  +    protected String getConcatenationCharacter()
  +    {
  +        return ",";
  +    }
  +
  +    /**
  +     * [EMAIL PROTECTED]
  +     */
  +    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);
  +        }
  +    }
  +
  +    /**
  +     * [EMAIL PROTECTED]
  +     */
       public String getLastInsertIdentityQuery(String tableName)
       {
           // [EMAIL PROTECTED]
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to