Commit f37c1c48 authored by Bruce Momjian's avatar Bruce Momjian

Run pgjindent for Java folks.

parent b4295d05
......@@ -233,7 +233,7 @@ public class Unicode
catch (ClassNotFoundException cnfe)
{
log("Unable to load driver", cnfe);
return;
return ;
}
try
{
......
......@@ -6,7 +6,7 @@ import java.text.*;
/*
*
* $Id: basic.java,v 1.12 2002/07/23 03:59:54 barry Exp $
* $Id: basic.java,v 1.13 2002/09/06 21:23:05 momjian Exp $
*
* This example tests the basic components of the JDBC driver, and shows
* how even the simplest of queries can be implemented.
......@@ -137,6 +137,7 @@ public class basic
// result if you don't know what column number a value is in
System.out.println("performing another query");
rs = st.executeQuery("select * from basic where b>1");
if (rs != null)
......@@ -164,6 +165,7 @@ public class basic
// Now test maxrows by setting it to 3 rows
st.setMaxRows(3);
System.out.println("performing a query limited to " + st.getMaxRows());
rs = st.executeQuery("select a, b from basic");
......
......@@ -9,7 +9,7 @@ import org.omg.CosNaming.*;
*
* It has no GUI, just a text frontend to keep it simple.
*
* $Id: StockClient.java,v 1.5 2001/11/19 23:19:20 momjian Exp $
* $Id: StockClient.java,v 1.6 2002/09/06 21:23:05 momjian Exp $
*/
public class StockClient
{
......@@ -35,14 +35,14 @@ public class StockClient
if (nameServiceObj == null)
{
System.err.println("nameServiceObj == null");
return;
return ;
}
nameService = org.omg.CosNaming.NamingContextHelper.narrow(nameServiceObj);
if (nameService == null)
{
System.err.println("nameService == null");
return;
return ;
}
// Resolve the dispenser
......@@ -53,7 +53,7 @@ public class StockClient
if (dispenser == null)
{
System.err.println("dispenser == null");
return;
return ;
}
// Now run the front end.
......
......@@ -5,7 +5,7 @@ import org.omg.CosNaming.*;
/*
* This class implements the server side of the example.
*
* $Id: StockDispenserImpl.java,v 1.4 2001/11/19 23:19:20 momjian Exp $
* $Id: StockDispenserImpl.java,v 1.5 2002/09/06 21:23:05 momjian Exp $
*/
public class StockDispenserImpl extends stock._StockDispenserImplBase
{
......@@ -67,11 +67,11 @@ public class StockDispenserImpl extends stock._StockDispenserImplBase
{
stock[i].inUse = false;
System.out.println("Releasing slot " + i);
return;
return ;
}
}
System.out.println("Reserved object not a member of this dispenser");
return;
return ;
}
/*
......
......@@ -5,7 +5,7 @@ import org.omg.CosNaming.*;
/*
* This class implements the server side of the example.
*
* $Id: StockServer.java,v 1.4 2001/11/19 23:19:20 momjian Exp $
* $Id: StockServer.java,v 1.5 2002/09/06 21:23:05 momjian Exp $
*/
public class StockServer
{
......@@ -29,14 +29,14 @@ public class StockServer
if (nameServiceObj == null)
{
System.err.println("nameServiceObj = null");
return;
return ;
}
org.omg.CosNaming.NamingContext nameService = org.omg.CosNaming.NamingContextHelper.narrow(nameServiceObj);
if (nameService == null)
{
System.err.println("nameService = null");
return;
return ;
}
// bind the dispenser into the naming service
......
......@@ -82,7 +82,7 @@ public class psql
if (line.startsWith("\\"))
{
processSlashCommand(line);
return;
return ;
}
boolean type = st.execute(line);
......
......@@ -31,8 +31,8 @@ public class Driver implements java.sql.Driver
public static final int DEBUG = 2;
public static final int INFO = 1;
public static boolean logDebug = false;
public static boolean logInfo = false;
public static boolean logDebug = false;
public static boolean logInfo = false;
static
{
......@@ -70,11 +70,11 @@ public class Driver implements java.sql.Driver
* to/from the database to unicode. If multibyte is enabled on the
* server then the character set of the database is used as the default,
* otherwise the jvm character encoding is used as the default.
* loglevel - (optional) Enable logging of messages from the driver.
* The value is an integer from 1 to 2 where:
* INFO = 1, DEBUG = 2
* The output is sent to DriverManager.getPrintWriter() if set,
* otherwise it is sent to System.out.
* loglevel - (optional) Enable logging of messages from the driver.
* The value is an integer from 1 to 2 where:
* INFO = 1, DEBUG = 2
* The output is sent to DriverManager.getPrintWriter() if set,
* otherwise it is sent to System.out.
* compatible - (optional) This is used to toggle
* between different functionality as it changes across different releases
* of the jdbc driver code. The values here are versions of the jdbc
......@@ -109,12 +109,14 @@ public class Driver implements java.sql.Driver
{
if ((props = parseURL(url, info)) == null)
{
if (Driver.logDebug) Driver.debug("Error in url" + url);
if (Driver.logDebug)
Driver.debug("Error in url" + url);
return null;
}
try
{
if (Driver.logDebug) Driver.debug("connect " + url);
if (Driver.logDebug)
Driver.debug("connect " + url);
@JDBCCONNECTCLASS@ con = (@JDBCCONNECTCLASS@)(Class.forName("@JDBCCONNECTCLASS@").newInstance());
con.openConnection (host(), port(), props, database(), url, this);
......@@ -122,7 +124,8 @@ public class Driver implements java.sql.Driver
}
catch (ClassNotFoundException ex)
{
if (Driver.logDebug) Driver.debug("error", ex);
if (Driver.logDebug)
Driver.debug("error", ex);
throw new PSQLException("postgresql.jvm.version", ex);
}
catch (PSQLException ex1)
......@@ -133,7 +136,8 @@ public class Driver implements java.sql.Driver
}
catch (Exception ex2)
{
if (Driver.logDebug) Driver.debug("error", ex2);
if (Driver.logDebug)
Driver.debug("error", ex2);
throw new PSQLException("postgresql.unusual", ex2);
}
}
......@@ -177,7 +181,7 @@ public class Driver implements java.sql.Driver
*/
public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) throws SQLException
{
//This method isn't really implemented
//This method isn't really implemented
Properties p = parseURL(url, info);
return new DriverPropertyInfo[0];
}
......@@ -385,16 +389,16 @@ public class Driver implements java.sql.Driver
}
/**
* used to turn logging on to a certain level, can be called
* used to turn logging on to a certain level, can be called
* by specifying fully qualified class ie org.postgresql.Driver.setLogLevel()
* @param int logLevel sets the level which logging will respond to
* INFO being almost no messages
* INFO being almost no messages
* DEBUG most verbose
*/
public static void setLogLevel(int logLevel)
{
logDebug = (logLevel >= DEBUG) ? true : false;
logInfo = (logLevel >= INFO) ? true : false;
logDebug = (logLevel >= DEBUG) ? true : false;
logInfo = (logLevel >= INFO) ? true : false;
}
/*
* logging message at the debug level
......@@ -441,7 +445,7 @@ public class Driver implements java.sql.Driver
}
}
//The build number should be incremented for every new build
private static int m_buildNumber = 104;
//The build number should be incremented for every new build
private static int m_buildNumber = 104;
}
......@@ -7,74 +7,74 @@ import org.postgresql.core.Encoding;
import org.postgresql.fastpath.Fastpath;
import org.postgresql.largeobject.LargeObjectManager;
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/Attic/PGConnection.java,v 1.2 2002/09/02 03:07:36 barry Exp $
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/Attic/PGConnection.java,v 1.3 2002/09/06 21:23:05 momjian Exp $
* This interface defines PostgreSQL extentions to the java.sql.Connection interface.
* Any java.sql.Connection object returned by the driver will also implement this
* Any java.sql.Connection object returned by the driver will also implement this
* interface
*/
public interface PGConnection
{
/*
* Get the character encoding to use for this connection.
*/
public Encoding getEncoding() throws SQLException;
/*
* Get the character encoding to use for this connection.
*/
public Encoding getEncoding() throws SQLException;
/*
* This method returns the java.sql.Types type for a postgres datatype name
*/
public int getSQLType(String pgTypeName) throws SQLException;
/*
* This method returns the java.sql.Types type for a postgres datatype name
*/
public int getSQLType(String pgTypeName) throws SQLException;
/*
* This returns the java.sql.Types type for a postgres datatype OID
*/
public int getSQLType(int oid) throws SQLException;
/*
* This returns the java.sql.Types type for a postgres datatype OID
*/
public int getSQLType(int oid) throws SQLException;
/*
* This returns the postgres datatype name from the
* postgres datatype OID
*/
public String getPGType(int oid) throws SQLException;
/*
* This returns the postgres datatype name from the
* postgres datatype OID
*/
public String getPGType(int oid) throws SQLException;
/*
* This returns the postgres datatype OID from the
* postgres datatype name
*/
public int getPGType(String typeName) throws SQLException;
/*
* This returns the postgres datatype OID from the
* postgres datatype name
*/
public int getPGType(String typeName) throws SQLException;
/*
* This returns the LargeObject API for the current connection.
*/
public LargeObjectManager getLargeObjectAPI() throws SQLException;
/*
* This returns the LargeObject API for the current connection.
*/
public LargeObjectManager getLargeObjectAPI() throws SQLException;
/*
* This returns the Fastpath API for the current connection.
*/
public Fastpath getFastpathAPI() throws SQLException;
/*
* This returns the Fastpath API for the current connection.
*/
public Fastpath getFastpathAPI() throws SQLException;
/*
* This method is used internally to return an object based around
* org.postgresql's more unique data types.
*
* <p>It uses an internal Hashtable to get the handling class. If the
* type is not supported, then an instance of org.postgresql.util.PGobject
* is returned.
*
* You can use the getValue() or setValue() methods to handle the returned
* object. Custom objects can have their own methods.
*
* @return PGobject for this type, and set to value
* @exception SQLException if value is not correct for this type
* @see org.postgresql.util.Serialize
*/
public Object getObject(String type, String value) throws SQLException;
/*
* This method is used internally to return an object based around
* org.postgresql's more unique data types.
*
* <p>It uses an internal Hashtable to get the handling class. If the
* type is not supported, then an instance of org.postgresql.util.PGobject
* is returned.
*
* You can use the getValue() or setValue() methods to handle the returned
* object. Custom objects can have their own methods.
*
* @return PGobject for this type, and set to value
* @exception SQLException if value is not correct for this type
* @see org.postgresql.util.Serialize
*/
public Object getObject(String type, String value) throws SQLException;
/*
* This method returns any notifications that have been received
* since the last call to this method.
* Returns null if there have been no notifications.
*/
public PGNotification[] getNotifications();
/*
* This method returns any notifications that have been received
* since the last call to this method.
* Returns null if there have been no notifications.
*/
public PGNotification[] getNotifications();
}
......
package org.postgresql;
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/Attic/PGNotification.java,v 1.1 2002/09/02 03:07:36 barry Exp $
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/Attic/PGNotification.java,v 1.2 2002/09/06 21:23:05 momjian Exp $
* This interface defines PostgreSQL extention for Notifications
*/
public interface PGNotification
{
/*
* Returns name of this notification
*/
public String getName();
/*
* Returns name of this notification
*/
public String getName();
/*
* Returns the process id of the backend process making this notification
*/
public int getPID();
/*
* Returns the process id of the backend process making this notification
*/
public int getPID();
}
......@@ -3,23 +3,23 @@ package org.postgresql;
import java.sql.*;
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/Attic/PGStatement.java,v 1.4 2002/09/02 03:07:36 barry Exp $
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/Attic/PGStatement.java,v 1.5 2002/09/06 21:23:05 momjian Exp $
* This interface defines PostgreSQL extentions to the java.sql.Statement interface.
* Any java.sql.Statement object returned by the driver will also implement this
* Any java.sql.Statement object returned by the driver will also implement this
* interface
*/
public interface PGStatement
{
/*
* Returns the Last inserted/updated oid.
* Returns the Last inserted/updated oid.
* @return OID of last insert
* @since 7.3
* @since 7.3
*/
public long getLastOID() throws SQLException;
public long getLastOID() throws SQLException;
public void setUseServerPrepare(boolean flag);
public void setUseServerPrepare(boolean flag);
public boolean isUseServerPrepare();
public boolean isUseServerPrepare();
}
......@@ -8,7 +8,7 @@ import org.postgresql.util.*;
/*
* Converts to and from the character encoding used by the backend.
*
* $Id: Encoding.java,v 1.5 2002/03/19 02:48:45 momjian Exp $
* $Id: Encoding.java,v 1.6 2002/09/06 21:23:05 momjian Exp $
*/
public class Encoding
......@@ -42,14 +42,14 @@ public class Encoding
encodings.put("EUC_KR", new String[] { "EUC_KR" });
encodings.put("JOHAB", new String[] { "Johab" });
encodings.put("EUC_TW", new String[] { "EUC_TW" });
encodings.put("SJIS", new String[] { "MS932","SJIS" });
encodings.put("BIG5", new String[] { "Big5","MS950","Cp950" });
encodings.put("GBK", new String[] { "GBK","MS936" });
encodings.put("UHC", new String[] { "MS949","Cp949","Cp949C" });
encodings.put("SJIS", new String[] { "MS932", "SJIS" });
encodings.put("BIG5", new String[] { "Big5", "MS950", "Cp950" });
encodings.put("GBK", new String[] { "GBK", "MS936" });
encodings.put("UHC", new String[] { "MS949", "Cp949", "Cp949C" });
encodings.put("TCVN", new String[] { "Cp1258" });
encodings.put("WIN1256", new String[] { "Cp1256" });
encodings.put("WIN1250", new String[] { "Cp1250" });
encodings.put("WIN874", new String[] { "MS874","Cp874" });
encodings.put("WIN874", new String[] { "MS874", "Cp874" });
encodings.put("WIN", new String[] { "Cp1251" });
encodings.put("ALT", new String[] { "Cp866" });
// We prefer KOI8-U, since it is a superset of KOI8-R.
......
package org.postgresql.core;
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/core/Attic/Notification.java,v 1.1 2002/09/02 03:07:36 barry Exp $
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/core/Attic/Notification.java,v 1.2 2002/09/06 21:23:05 momjian Exp $
* This is the implementation of the PGNotification interface
*/
public class Notification implements org.postgresql.PGNotification
{
public Notification(String p_name, int p_pid) {
m_name = p_name;
m_pid = p_pid;
}
public Notification(String p_name, int p_pid)
{
m_name = p_name;
m_pid = p_pid;
}
/*
* Returns name of this notification
*/
public String getName() {
return m_name;
}
/*
* Returns name of this notification
*/
public String getName()
{
return m_name;
}
/*
* Returns the process id of the backend process making this notification
*/
public int getPID() {
return m_pid;
}
/*
* Returns the process id of the backend process making this notification
*/
public int getPID()
{
return m_pid;
}
private String m_name;
private int m_pid;
private String m_name;
private int m_pid;
}
......@@ -6,7 +6,7 @@ import java.io.IOException;
/**
* Sent to the backend to initialize a newly created connection.
*
* $Id: StartupPacket.java,v 1.1 2002/03/21 02:40:03 davec Exp $
* $Id: StartupPacket.java,v 1.2 2002/09/06 21:23:05 momjian Exp $
*/
public class StartupPacket
......@@ -22,15 +22,16 @@ public class StartupPacket
private String user;
private String database;
public StartupPacket(int protocolMajor, int protocolMinor, String user, String database) {
public StartupPacket(int protocolMajor, int protocolMinor, String user, String database)
{
this.protocolMajor = protocolMajor;
this.protocolMinor = protocolMinor;
this.user = user;
this.database = database;
}
public void writeTo(PG_Stream stream) throws IOException
{
public void writeTo(PG_Stream stream) throws IOException
{
stream.SendInteger(4 + 4 + SM_DATABASE + SM_USER + SM_OPTIONS + SM_UNUSED + SM_TTY, 4);
stream.SendInteger(protocolMajor, 2);
stream.SendInteger(protocolMinor, 2);
......
......@@ -8,7 +8,7 @@ import org.postgresql.util.*;
import java.sql.SQLException;
import java.sql.Types;
public abstract class AbstractJdbc1ResultSetMetaData
public abstract class AbstractJdbc1ResultSetMetaData
{
protected Vector rows;
......
......@@ -6,9 +6,9 @@ import java.sql.*;
import org.postgresql.Field;
import org.postgresql.util.PSQLException;
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/Jdbc1Connection.java,v 1.4 2002/07/26 05:29:35 barry Exp $
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/Jdbc1Connection.java,v 1.5 2002/09/06 21:23:06 momjian Exp $
* This class implements the java.sql.Connection interface for JDBC1.
* However most of the implementation is really done in
* However most of the implementation is really done in
* org.postgresql.jdbc1.AbstractJdbc1Connection
*/
public class Jdbc1Connection extends org.postgresql.jdbc1.AbstractJdbc1Connection implements java.sql.Connection
......
......@@ -5,9 +5,9 @@ import java.sql.*;
import java.util.Vector;
import org.postgresql.Field;
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/Jdbc1ResultSet.java,v 1.3 2002/07/26 05:29:35 barry Exp $
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/Jdbc1ResultSet.java,v 1.4 2002/09/06 21:23:06 momjian Exp $
* This class implements the java.sql.ResultSet interface for JDBC1.
* However most of the implementation is really done in
* However most of the implementation is really done in
* org.postgresql.jdbc1.AbstractJdbc1ResultSet
*/
public class Jdbc1ResultSet extends org.postgresql.jdbc1.AbstractJdbc1ResultSet implements java.sql.ResultSet
......
......@@ -4,7 +4,7 @@ public class Jdbc1ResultSetMetaData extends AbstractJdbc1ResultSetMetaData imple
{
public Jdbc1ResultSetMetaData(java.util.Vector rows, org.postgresql.Field[] fields)
{
super(rows, fields);
super(rows, fields);
}
}
......
......@@ -3,9 +3,9 @@ package org.postgresql.jdbc1;
import java.sql.*;
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/Jdbc1Statement.java,v 1.2 2002/07/24 22:08:40 barry Exp $
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/Jdbc1Statement.java,v 1.3 2002/09/06 21:23:06 momjian Exp $
* This class implements the java.sql.Statement interface for JDBC1.
* However most of the implementation is really done in
* However most of the implementation is really done in
* org.postgresql.jdbc1.AbstractJdbc1Statement
*/
public class Jdbc1Statement extends org.postgresql.jdbc1.AbstractJdbc1Statement implements java.sql.Statement
......@@ -13,7 +13,7 @@ public class Jdbc1Statement extends org.postgresql.jdbc1.AbstractJdbc1Statement
public Jdbc1Statement (Jdbc1Connection c)
{
super(c);
super(c);
}
}
......@@ -13,7 +13,7 @@ public abstract class AbstractJdbc2DatabaseMetaData extends org.postgresql.jdbc1
public AbstractJdbc2DatabaseMetaData(AbstractJdbc2Connection conn)
{
super(conn);
super(conn);
}
......@@ -61,18 +61,18 @@ public abstract class AbstractJdbc2DatabaseMetaData extends org.postgresql.jdbc1
/* lots of unsupported stuff... */
public boolean ownUpdatesAreVisible(int type) throws SQLException
{
return true;
return true;
}
public boolean ownDeletesAreVisible(int type) throws SQLException
{
return true;
return true;
}
public boolean ownInsertsAreVisible(int type) throws SQLException
{
// indicates that
return true;
// indicates that
return true;
}
public boolean othersUpdatesAreVisible(int type) throws SQLException
......@@ -117,10 +117,10 @@ public abstract class AbstractJdbc2DatabaseMetaData extends org.postgresql.jdbc1
* Return user defined types in a schema
*/
public java.sql.ResultSet getUDTs(String catalog,
String schemaPattern,
String typeNamePattern,
int[] types
) throws SQLException
String schemaPattern,
String typeNamePattern,
int[] types
) throws SQLException
{
throw org.postgresql.Driver.notImplemented();
}
......
......@@ -19,7 +19,7 @@ public abstract class AbstractJdbc2ResultSetMetaData extends org.postgresql.jdbc
*/
public AbstractJdbc2ResultSetMetaData(Vector rows, Field[] fields)
{
super(rows, fields);
super(rows, fields);
}
/*
......@@ -459,53 +459,53 @@ public abstract class AbstractJdbc2ResultSetMetaData extends org.postgresql.jdbc
// This can hook into our PG_Object mechanism
/**
* Returns the fully-qualified name of the Java class whose instances
* Returns the fully-qualified name of the Java class whose instances
* are manufactured if the method <code>ResultSet.getObject</code>
* is called to retrieve a value from the column.
*
*
* <code>ResultSet.getObject</code> may return a subclass of the class
* returned by this method.
*
* @param column the first column is 1, the second is 2, ...
* @return the fully-qualified name of the class in the Java programming
* language that would be used by the method
* <code>ResultSet.getObject</code> to retrieve the value in the specified
* column. This is the class name used for custom mapping.
* language that would be used by the method
* <code>ResultSet.getObject</code> to retrieve the value in the specified
* column. This is the class name used for custom mapping.
* @exception SQLException if a database access error occurs
*/
public String getColumnClassName(int column) throws SQLException
{
/*
The following data type mapping came from ../Field.java.
"int2",
"int4","oid",
"int8",
"cash","money",
"numeric",
"float4",
"float8",
"bpchar","char","char2","char4","char8","char16",
"varchar","text","name","filename",
"bool",
"date",
"time",
"abstime","timestamp"
Types.SMALLINT,
Types.INTEGER,Types.INTEGER,
Types.BIGINT,
Types.DOUBLE,Types.DOUBLE,
Types.NUMERIC,
Types.REAL,
Types.DOUBLE,
Types.CHAR,Types.CHAR,Types.CHAR,Types.CHAR,Types.CHAR,Types.CHAR,
Types.VARCHAR,Types.VARCHAR,Types.VARCHAR,Types.VARCHAR,
Types.BIT,
Types.DATE,
Types.TIME,
Types.TIMESTAMP,Types.TIMESTAMP
*/
/*
The following data type mapping came from ../Field.java.
"int2",
"int4","oid",
"int8",
"cash","money",
"numeric",
"float4",
"float8",
"bpchar","char","char2","char4","char8","char16",
"varchar","text","name","filename",
"bool",
"date",
"time",
"abstime","timestamp"
Types.SMALLINT,
Types.INTEGER,Types.INTEGER,
Types.BIGINT,
Types.DOUBLE,Types.DOUBLE,
Types.NUMERIC,
Types.REAL,
Types.DOUBLE,
Types.CHAR,Types.CHAR,Types.CHAR,Types.CHAR,Types.CHAR,Types.CHAR,
Types.VARCHAR,Types.VARCHAR,Types.VARCHAR,Types.VARCHAR,
Types.BIT,
Types.DATE,
Types.TIME,
Types.TIMESTAMP,Types.TIMESTAMP
*/
Field field = getField(column);
int sql_type = field.getSQLType();
......@@ -513,40 +513,40 @@ public abstract class AbstractJdbc2ResultSetMetaData extends org.postgresql.jdbc
switch (sql_type)
{
case Types.BIT:
return("java.lang.Boolean");
return ("java.lang.Boolean");
case Types.SMALLINT:
return("java.lang.Short");
return ("java.lang.Short");
case Types.INTEGER:
return("java.lang.Integer");
return ("java.lang.Integer");
case Types.BIGINT:
return("java.lang.Long");
return ("java.lang.Long");
case Types.NUMERIC:
return("java.math.BigDecimal");
return ("java.math.BigDecimal");
case Types.REAL:
return("java.lang.Float");
return ("java.lang.Float");
case Types.DOUBLE:
return("java.lang.Double");
return ("java.lang.Double");
case Types.CHAR:
case Types.VARCHAR:
return("java.lang.String");
return ("java.lang.String");
case Types.DATE:
return("java.sql.Date");
return ("java.sql.Date");
case Types.TIME:
return("java.sql.Time");
return ("java.sql.Time");
case Types.TIMESTAMP:
return("java.sql.Timestamp");
return ("java.sql.Timestamp");
case Types.BINARY:
case Types.VARBINARY:
return("[B");
return ("[B");
case Types.ARRAY:
return("java.sql.Array");
return ("java.sql.Array");
default:
String type = field.getPGType();
if ("unknown".equals(type))
{
return("java.lang.String");
return ("java.lang.String");
}
return("java.lang.Object");
return ("java.lang.Object");
}
}
}
......
......@@ -8,7 +8,7 @@ import java.util.Vector;
import org.postgresql.largeobject.*;
import org.postgresql.util.PSQLException;
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/AbstractJdbc2Statement.java,v 1.5 2002/09/02 03:07:36 barry Exp $
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/AbstractJdbc2Statement.java,v 1.6 2002/09/06 21:23:06 momjian Exp $
* This class defines methods of the jdbc2 specification. This class extends
* org.postgresql.jdbc1.AbstractJdbc1Statement which provides the jdbc1
* methods. The real Statement class (for jdbc2) is org.postgresql.jdbc2.Jdbc2Statement
......@@ -45,8 +45,8 @@ public abstract class AbstractJdbc2Statement extends org.postgresql.jdbc1.Abstra
*/
public boolean execute() throws SQLException
{
boolean l_return = super.execute();
//Now do the jdbc2 specific stuff
boolean l_return = super.execute();
//Now do the jdbc2 specific stuff
//required for ResultSet.getStatement() to work and updateable resultsets
((AbstractJdbc2ResultSet)result).setStatement((Statement)this);
......@@ -64,7 +64,7 @@ public abstract class AbstractJdbc2Statement extends org.postgresql.jdbc1.Abstra
public void clearBatch() throws SQLException
{
batch = null;
batch = null;
}
public int[] executeBatch() throws SQLException
......@@ -86,7 +86,7 @@ public abstract class AbstractJdbc2Statement extends org.postgresql.jdbc1.Abstra
PBatchUpdateException updex =
new PBatchUpdateException("postgresql.stat.batch.error",
new Integer(i), batch.elementAt(i), resultSucceeded);
new Integer(i), batch.elementAt(i), resultSucceeded);
updex.setNextException(e);
throw updex;
......@@ -183,12 +183,12 @@ public abstract class AbstractJdbc2Statement extends org.postgresql.jdbc1.Abstra
// is buffered internally anyhow, so there would be no performance
// boost gained, if anything it would be worse!
int bytesRemaining = (int)x.length();
int numRead = l_inStream.read(buf,0,Math.min(buf.length,bytesRemaining));
int numRead = l_inStream.read(buf, 0, Math.min(buf.length, bytesRemaining));
while (numRead != -1 && bytesRemaining > 0)
{
bytesRemaining -= numRead;
los.write(buf,0,numRead);
numRead = l_inStream.read(buf,0,Math.min(buf.length,bytesRemaining));
bytesRemaining -= numRead;
los.write(buf, 0, numRead);
numRead = l_inStream.read(buf, 0, Math.min(buf.length, bytesRemaining));
}
los.close();
}
......@@ -384,9 +384,10 @@ public abstract class AbstractJdbc2Statement extends org.postgresql.jdbc1.Abstra
}
//This is needed by AbstractJdbc2ResultSet to determine if the query is updateable or not
protected String[] getSqlFragments() {
return m_sqlFragments;
}
//This is needed by AbstractJdbc2ResultSet to determine if the query is updateable or not
protected String[] getSqlFragments()
{
return m_sqlFragments;
}
}
......@@ -27,7 +27,7 @@ public class Array implements java.sql.Array
{
private org.postgresql.PGConnection conn = null;
private org.postgresql.Field field = null;
private ResultSet rs;
private ResultSet rs;
private int idx = 0;
private String rawString = null;
......@@ -44,7 +44,7 @@ public class Array implements java.sql.Array
{
this.conn = conn;
this.field = field;
this.rs = rs;
this.rs = rs;
this.idx = idx;
this.rawString = ((AbstractJdbc2ResultSet)rs).getFixedString(idx);
}
......@@ -76,9 +76,9 @@ public class Array implements java.sql.Array
ArrayList array = new ArrayList();
/* Check if the String is also not an empty array
* otherwise there will be an exception thrown below
* in the ResultSet.toX with an empty string.
* -- Doug Fields <dfields-pg-jdbc@pexicom.com> Feb 20, 2002 */
* otherwise there will be an exception thrown below
* in the ResultSet.toX with an empty string.
* -- Doug Fields <dfields-pg-jdbc@pexicom.com> Feb 20, 2002 */
if ( rawString != null && !rawString.equals("{}") )
{
......@@ -88,9 +88,9 @@ public class Array implements java.sql.Array
boolean insideString = false;
for ( int i = 0; i < chars.length; i++ )
{
if ( chars[i] == '\\' )
//escape character that we need to skip
i++;
if ( chars[i] == '\\' )
//escape character that we need to skip
i++;
if ( chars[i] == '{' )
{
if ( foundOpen ) // Only supports 1-D arrays for now
......
......@@ -5,9 +5,9 @@ import java.sql.*;
import java.util.Vector;
import org.postgresql.Field;
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/Jdbc2ResultSet.java,v 1.4 2002/08/14 20:35:39 barry Exp $
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/Jdbc2ResultSet.java,v 1.5 2002/09/06 21:23:06 momjian Exp $
* This class implements the java.sql.ResultSet interface for JDBC2.
* However most of the implementation is really done in
* However most of the implementation is really done in
* org.postgresql.jdbc2.AbstractJdbc2ResultSet or one of it's parents
*/
public class Jdbc2ResultSet extends org.postgresql.jdbc2.AbstractJdbc2ResultSet implements java.sql.ResultSet
......@@ -23,13 +23,15 @@ public class Jdbc2ResultSet extends org.postgresql.jdbc2.AbstractJdbc2ResultSet
return new Jdbc2ResultSetMetaData(rows, fields);
}
public java.sql.Clob getClob(int i) throws SQLException {
return new org.postgresql.jdbc2.Jdbc2Clob(connection, getInt(i));
}
public java.sql.Clob getClob(int i) throws SQLException
{
return new org.postgresql.jdbc2.Jdbc2Clob(connection, getInt(i));
}
public java.sql.Blob getBlob(int i) throws SQLException {
return new org.postgresql.jdbc2.Jdbc2Blob(connection, getInt(i));
}
public java.sql.Blob getBlob(int i) throws SQLException
{
return new org.postgresql.jdbc2.Jdbc2Blob(connection, getInt(i));
}
}
......@@ -4,7 +4,7 @@ public class Jdbc2ResultSetMetaData extends AbstractJdbc2ResultSetMetaData imple
{
public Jdbc2ResultSetMetaData(java.util.Vector rows, org.postgresql.Field[] fields)
{
super(rows, fields);
super(rows, fields);
}
}
......@@ -3,9 +3,9 @@ package org.postgresql.jdbc2;
import java.sql.*;
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/Jdbc2Statement.java,v 1.2 2002/07/24 22:08:43 barry Exp $
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/Jdbc2Statement.java,v 1.3 2002/09/06 21:23:06 momjian Exp $
* This class implements the java.sql.Statement interface for JDBC2.
* However most of the implementation is really done in
* However most of the implementation is really done in
* org.postgresql.jdbc2.AbstractJdbc2Statement or one of it's parents
*/
public class Jdbc2Statement extends org.postgresql.jdbc2.AbstractJdbc2Statement implements java.sql.Statement
......
......@@ -5,11 +5,11 @@ import java.sql.*;
public class Jdbc3CallableStatement extends org.postgresql.jdbc3.AbstractJdbc3Statement implements java.sql.CallableStatement
{
public Jdbc3CallableStatement(Jdbc3Connection connection, String sql) throws SQLException
{
super(connection, sql);
}
}
......@@ -63,7 +63,7 @@ public class Jdbc2TestSuite extends TestSuite
suite.addTestSuite( UpdateableResultTest.class );
suite.addTestSuite( CallableStmtTest.class );
// That's all folks
return suite;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment