Commit f37c1c48 authored by Bruce Momjian's avatar Bruce Momjian

Run pgjindent for Java folks.

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