


Index: PreparedStatement.java
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/PreparedStatement.java,v
retrieving revision 1.14
diff -c -r1.14 PreparedStatement.java
*** PreparedStatement.java       2001/07/04 15:08:32     1.14
--- PreparedStatement.java       2001/07/12 00:28:30
***************
*** 267,273 ****
         {
          // if the passed string is null, then set this column to null
          if(x==null)
!           set(parameterIndex,"null");
          else {
              // use the shared buffer object. Should never clash but this makes
              // us thread safe!
--- 267,273 ----
         {
          // if the passed string is null, then set this column to null
          if(x==null)
!           setNull(parameterIndex,Types.OTHER);
          else {
              // use the shared buffer object. Should never clash but this makes
              // us thread safe!
***************
*** 323,336 ****
         */
         public void setDate(int parameterIndex, java.sql.Date x) throws SQLException
         {
!           SimpleDateFormat df = (SimpleDateFormat) tl_df.get();
!           if(df==null) {
!             df = new SimpleDateFormat("''yyyy-MM-dd''");
!             tl_df.set(df);
!           }
!
!         set(parameterIndex, df.format(x));

          // The above is how the date should be handled.
          //
          // However, in JDK's prior to 1.1.6 (confirmed with the
--- 323,339 ----
         */
         public void setDate(int parameterIndex, java.sql.Date x) throws SQLException
         {
!                if(null == x){
!                        setNull(parameterIndex,Types.OTHER);
!                }else{
!                SimpleDateFormat df = (SimpleDateFormat) tl_df.get();
!                if(df==null) {
!                df = new SimpleDateFormat("''yyyy-MM-dd''");
!                tl_df.set(df);
!                }

+                       set(parameterIndex, df.format(x));
+                }
          // The above is how the date should be handled.
          //
          // However, in JDK's prior to 1.1.6 (confirmed with the
***************
*** 353,359 ****
         */
         public void setTime(int parameterIndex, Time x) throws SQLException
         {
!                set(parameterIndex, "'" + x.toString() + "'");
         }

         /**
--- 356,366 ----
         */
         public void setTime(int parameterIndex, Time x) throws SQLException
         {
!                if (null == x){
!                        setNull(parameterIndex,Types.OTHER);
!                }else{
!                        set(parameterIndex, "'" + x.toString() + "'");
!                }
         }

         /**
***************
*** 365,371 ****
         * @exception SQLException if a database access error occurs
         */
         public void setTimestamp(int parameterIndex, Timestamp x) throws SQLException
!         {
            SimpleDateFormat df = (SimpleDateFormat) tl_tsdf.get();
            if(df==null) {
              df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
--- 372,381 ----
         * @exception SQLException if a database access error occurs
         */
         public void setTimestamp(int parameterIndex, Timestamp x) throws SQLException
!     {
!                if (null == x){
!                        setNull(parameterIndex,Types.OTHER);
!                }else{
            SimpleDateFormat df = (SimpleDateFormat) tl_tsdf.get();
            if(df==null) {
              df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
***************
*** 383,388 ****
--- 393,399 ----
            // The above works, but so does the following. I'm leaving the above in, but this seems
            // to be identical. Pays to read the docs ;-)
            //set(parameterIndex,"'"+x.toString()+"'");
+                }
         }

         /**