* Copyright (c) 2003, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/AbstractJdbc1Connection.java,v 1.20 2003/05/29 21:44:47 barry Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/AbstractJdbc1Connection.java,v 1.21 2003/06/30 21:10:55 davec Exp $
*
*-------------------------------------------------------------------------
*/
"varchar", "text", "name", "filename",
"bytea",
"bool",
+ "bit",
"date",
"time",
"abstime", "timestamp", "timestamptz"
Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR,
Types.BINARY,
Types.BIT,
+ Types.BIT,
Types.DATE,
Types.TIME,
Types.TIMESTAMP, Types.TIMESTAMP, Types.TIMESTAMP
{
private static final String keywords = "abort,acl,add,aggregate,append,archive," +
- "arch_store,backward,binary,change,cluster," +
+ "arch_store,backward,binary,boolean,change,cluster," +
"copy,database,delimiter,delimiters,do,extend," +
"explain,forward,heavy,index,inherits,isnull," +
"light,listen,load,merge,nothing,notify," +
* Copyright (c) 2003, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/AbstractJdbc1ResultSet.java,v 1.12 2003/05/03 20:40:45 barry Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/AbstractJdbc1ResultSet.java,v 1.13 2003/06/30 21:10:55 davec Exp $
*
*-------------------------------------------------------------------------
*/
{
try
{
+ switch(fields[columnIndex-1].getSQLType())
+ {
+ case Types.NUMERIC:
+ case Types.REAL:
+ case Types.DOUBLE:
+ case Types.FLOAT:
+ case Types.DECIMAL:
+ s = (s.indexOf(".")==-1) ? s : s.substring(0,s.indexOf("."));
+ break;
+ case Types.CHAR:
+ s = s.trim();
+ break;
+ }
return Byte.parseByte(s);
}
catch (NumberFormatException e)
{
try
{
+ switch(fields[columnIndex-1].getSQLType())
+ {
+ case Types.NUMERIC:
+ case Types.REAL:
+ case Types.DOUBLE:
+ case Types.FLOAT:
+ case Types.DECIMAL:
+ s = (s.indexOf(".")==-1) ? s : s.substring(0,s.indexOf("."));
+ break;
+ case Types.CHAR:
+ s = s.trim();
+ break;
+ }
return Short.parseShort(s);
}
catch (NumberFormatException e)
{
try
{
+ s = s.trim();
return Integer.parseInt(s);
}
catch (NumberFormatException e)
{
try
{
+ s = s.trim();
return Long.parseLong(s);
}
catch (NumberFormatException e)
{
try
{
+ s = s.trim();
val = new BigDecimal(s);
}
catch (NumberFormatException e)
{
try
{
+ s = s.trim();
return Float.valueOf(s).floatValue();
}
catch (NumberFormatException e)
{
try
{
+ s = s.trim();
return Double.valueOf(s).doubleValue();
}
catch (NumberFormatException e)
// length > 10: SQL Timestamp, assumes PGDATESTYLE=ISO
try
{
+ s = s.trim();
return java.sql.Date.valueOf((s.length() == 10) ? s : s.substring(0, 10));
}
catch (NumberFormatException e)
return null; // SQL NULL
try
{
+ s = s.trim();
if (s.length() == 8)
{
//value is a time value
if (s == null)
return null;
+ s = s.trim();
// We must be synchronized here incase more theads access the ResultSet
// bad practice but possible. Anyhow this is to protect sbuf and
// SimpleDateFormat objects
import java.sql.Types;
import java.util.Vector;
-/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/AbstractJdbc1Statement.java,v 1.25 2003/06/30 16:38:30 barry Exp $
+/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/AbstractJdbc1Statement.java,v 1.26 2003/06/30 21:10:55 davec Exp $
* This class defines methods of the jdbc1 specification. This class is
* extended by org.postgresql.jdbc2.AbstractJdbc2Statement which adds the jdbc2
* methods. The real Statement class (for jdbc1) is org.postgresql.jdbc1.Jdbc1Statement
switch (targetSqlType)
{
case Types.INTEGER:
- bind(parameterIndex, x.toString(), PG_INTEGER);
+ if (x instanceof Boolean)
+ bind(parameterIndex,((Boolean)x).booleanValue() ? "1" :"0", PG_BOOLEAN);
+ else
+ bind(parameterIndex, x.toString(), PG_INTEGER);
break;
case Types.TINYINT:
case Types.SMALLINT:
{
bind(parameterIndex, ((Boolean)x).booleanValue() ? "TRUE" : "FALSE", PG_TEXT);
}
+ else if (x instanceof Number)
+ {
+ bind(parameterIndex, ((Number)x).intValue()==1 ? "TRUE" : "FALSE", PG_TEXT);
+ }
else
{
throw new PSQLException("postgresql.prep.type");
import java.sql.SQLException;
import java.sql.Types;
-/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/AbstractJdbc2Connection.java,v 1.5 2003/05/29 04:39:48 barry Exp $
+/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/AbstractJdbc2Connection.java,v 1.6 2003/06/30 21:10:55 davec Exp $
* This class defines methods of the jdbc2 specification. This class extends
* org.postgresql.jdbc1.AbstractJdbc1Connection which provides the jdbc1
* methods. The real Connection class (for jdbc2) is org.postgresql.jdbc2.Jdbc2Connection
"varchar", "text", "name", "filename",
"bytea",
"bool",
+ "bit",
"date",
"time",
"abstime", "timestamp", "timestamptz",
Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR,
Types.BINARY,
Types.BIT,
+ Types.BIT,
Types.DATE,
Types.TIME,
Types.TIMESTAMP, Types.TIMESTAMP, Types.TIMESTAMP,
import java.sql.*;
-/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc3/Attic/AbstractJdbc3Connection.java,v 1.3 2003/05/07 03:03:30 barry Exp $
+/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc3/Attic/AbstractJdbc3Connection.java,v 1.4 2003/06/30 21:10:55 davec Exp $
* This class defines methods of the jdbc3 specification. This class extends
* org.postgresql.jdbc2.AbstractJdbc2Connection which provides the jdbc2
* methods. The real Connection class (for jdbc3) is org.postgresql.jdbc3.Jdbc3Connection
"varchar", "text", "name", "filename",
"bytea",
"bool",
+ "bit",
"date",
"time",
"abstime", "timestamp", "timestamptz",
Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR,
Types.BINARY,
Types.BIT,
+ Types.BIT,
Types.DATE,
Types.TIME,
Types.TIMESTAMP, Types.TIMESTAMP, Types.TIMESTAMP,