summaryrefslogtreecommitdiff
path: root/src/interfaces/jdbc/org/postgresql/jdbc1/PreparedStatement.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/interfaces/jdbc/org/postgresql/jdbc1/PreparedStatement.java')
-rw-r--r--src/interfaces/jdbc/org/postgresql/jdbc1/PreparedStatement.java19
1 files changed, 6 insertions, 13 deletions
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc1/PreparedStatement.java b/src/interfaces/jdbc/org/postgresql/jdbc1/PreparedStatement.java
index 6db05e698a..51cb64d5a2 100644
--- a/src/interfaces/jdbc/org/postgresql/jdbc1/PreparedStatement.java
+++ b/src/interfaces/jdbc/org/postgresql/jdbc1/PreparedStatement.java
@@ -310,11 +310,12 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
* @param x the parameter value
* @exception SQLException if a database access error occurs
*/
- private static final SimpleDateFormat DF1 = new SimpleDateFormat("yyyy-MM-dd");
public void setDate(int parameterIndex, java.sql.Date x) throws SQLException
{
- set(parameterIndex, DF1.format(x));
-
+ SimpleDateFormat df = new SimpleDateFormat("''yyyy-MM-dd''");
+
+ 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
@@ -348,17 +349,9 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta
* @param x the parameter value
* @exception SQLException if a database access error occurs
*/
- private static SimpleDateFormat DF2 = getDF2();
- private static SimpleDateFormat getDF2() {
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
- sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
- return sdf;
- }
public void setTimestamp(int parameterIndex, Timestamp x) throws SQLException
- {
- StringBuffer strBuf = new StringBuffer("'");
- strBuf.append(DF2.format(x)).append('.').append(x.getNanos()/10000000).append("+00'");
- set(parameterIndex, strBuf.toString());
+ {
+ set(parameterIndex, "'" + x.toString() + "'");
}
/**