db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mpoes...@apache.org
Subject cvs commit: db-torque/src/java/org/apache/torque/adapter DBOracle.java
Date Fri, 18 Jul 2003 20:17:35 GMT
mpoeschl    2003/07/18 13:17:35

  Modified:    src/java/org/apache/torque/adapter DBOracle.java
  Log:
  TRQS152: Oracle DB using Criteria to select by Data doesn't work
  
  Revision  Changes    Path
  1.16      +18 -2     db-torque/src/java/org/apache/torque/adapter/DBOracle.java
  
  Index: DBOracle.java
  ===================================================================
  RCS file: /home/cvs/db-torque/src/java/org/apache/torque/adapter/DBOracle.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- DBOracle.java	24 Jun 2002 18:12:19 -0000	1.15
  +++ DBOracle.java	18 Jul 2003 20:17:35 -0000	1.16
  @@ -3,7 +3,7 @@
   /* ====================================================================
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 2001 The Apache Software Foundation.  All rights
  + * Copyright (c) 2001-2003 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -57,6 +57,8 @@
   import java.sql.Connection;
   import java.sql.SQLException;
   import java.sql.Statement;
  +import java.text.SimpleDateFormat;
  +import java.util.Date;
   
   /**
    * This code should be used for an Oracle database pool.
  @@ -69,6 +71,9 @@
    */
   public class DBOracle extends DB
   {
  +    /** date format used in getDateString() */
  +    private static final String DATE_FORMAT = "dd-MM-yyyy HH:mm:ss";
  +    
       /**
        * Empty constructor.
        */
  @@ -98,6 +103,17 @@
           return new StringBuffer("UPPER(").append(in).append(")").toString();
       }
   
  +    /**
  +     * This method is used to format any date string.
  +     *
  +     * @param date the Date to format
  +     * @return The date formatted String for Oracle.
  +     */
  +    public String getDateString(Date date) {
  +        return "TO_DATE('" + new SimpleDateFormat(DATE_FORMAT).format(date) 
  +                + "', 'DD-MM-YYYY HH24:MI:SS')";
  +    }
  +    
       /**
        * @see org.apache.torque.adapter.DB#getIDMethodType()
        */
  
  
  

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


Mime
View raw message