Commit b465f530 authored by Barry Lind's avatar Barry Lind

The patch does the following:

  Allows you to set the loglevel at runtime by adding ?loglevel=X to the connection URL, where 1 = INFO and 2 = DEBUG.
  Automatically turns on logging by calling DriverManager.setPrintWriter(new PrintWriter(System.out)) if one is not already set.
Adds a Driver.info() message that prints out the version number
Adds member variables logDebug and logInfo that can be checked before making logging methods calls
Adds a build number to the version number string.  This build number will need to be manually incremented when we see fit.

----------------------------------------------------------------------
Modified Files:
 	org/postgresql/Connection.java org/postgresql/Driver.java.in
 	org/postgresql/fastpath/Fastpath.java
 	org/postgresql/jdbc1/DatabaseMetaData.java
 	org/postgresql/jdbc2/Connection.java
 	org/postgresql/jdbc2/DatabaseMetaData.java
 	org/postgresql/largeobject/LargeObjectManager.java
 	org/postgresql/util/PSQLException.java
 	org/postgresql/util/Serialize.java
----------------------------------------------------------------------
parent 8d1c1d40
...@@ -12,7 +12,7 @@ import org.postgresql.util.*; ...@@ -12,7 +12,7 @@ import org.postgresql.util.*;
import org.postgresql.core.*; import org.postgresql.core.*;
/* /*
* $Id: Connection.java,v 1.47 2002/05/17 01:19:19 tgl Exp $ * $Id: Connection.java,v 1.48 2002/06/11 02:55:15 barry Exp $
* *
* This abstract class is used by org.postgresql.Driver to open either the JDBC1 or * This abstract class is used by org.postgresql.Driver to open either the JDBC1 or
* JDBC2 versions of the Connection class. * JDBC2 versions of the Connection class.
...@@ -161,6 +161,27 @@ public abstract class Connection ...@@ -161,6 +161,27 @@ public abstract class Connection
compatible = info.getProperty("compatible"); compatible = info.getProperty("compatible");
} }
//Read loglevel arg and set the loglevel based on this value
//in addition to setting the log level enable output to
//standard out if no other printwriter is set
String l_logLevelProp = info.getProperty("loglevel","0");
int l_logLevel = 0;
try {
l_logLevel = Integer.parseInt(l_logLevelProp);
if (l_logLevel > Driver.DEBUG || l_logLevel < Driver.INFO) {
l_logLevel = 0;
}
} catch (Exception l_e) {
//invalid value for loglevel ignore
}
if (l_logLevel > 0) {
Driver.setLogLevel(l_logLevel);
enableDriverManagerLogging();
}
//Print out the driver version number
if (Driver.logInfo) Driver.info(Driver.getVersion());
// Now make the initial connection // Now make the initial connection
try try
{ {
...@@ -217,7 +238,7 @@ public abstract class Connection ...@@ -217,7 +238,7 @@ public abstract class Connection
rst[0] = (byte)pg_stream.ReceiveChar(); rst[0] = (byte)pg_stream.ReceiveChar();
rst[1] = (byte)pg_stream.ReceiveChar(); rst[1] = (byte)pg_stream.ReceiveChar();
salt = new String(rst, 0, 2); salt = new String(rst, 0, 2);
Driver.debug("Crypt salt=" + salt); if (Driver.logDebug) Driver.debug("Crypt salt=" + salt);
} }
// Or get the md5 password salt if there is one // Or get the md5 password salt if there is one
...@@ -229,7 +250,7 @@ public abstract class Connection ...@@ -229,7 +250,7 @@ public abstract class Connection
rst[2] = (byte)pg_stream.ReceiveChar(); rst[2] = (byte)pg_stream.ReceiveChar();
rst[3] = (byte)pg_stream.ReceiveChar(); rst[3] = (byte)pg_stream.ReceiveChar();
salt = new String(rst, 0, 4); salt = new String(rst, 0, 4);
Driver.debug("MD5 salt=" + salt); if (Driver.logDebug) Driver.debug("MD5 salt=" + salt);
} }
// now send the auth packet // now send the auth packet
...@@ -239,15 +260,15 @@ public abstract class Connection ...@@ -239,15 +260,15 @@ public abstract class Connection
break; break;
case AUTH_REQ_KRB4: case AUTH_REQ_KRB4:
Driver.debug("postgresql: KRB4"); if (Driver.logDebug) Driver.debug("postgresql: KRB4");
throw new PSQLException("postgresql.con.kerb4"); throw new PSQLException("postgresql.con.kerb4");
case AUTH_REQ_KRB5: case AUTH_REQ_KRB5:
Driver.debug("postgresql: KRB5"); if (Driver.logDebug) Driver.debug("postgresql: KRB5");
throw new PSQLException("postgresql.con.kerb5"); throw new PSQLException("postgresql.con.kerb5");
case AUTH_REQ_PASSWORD: case AUTH_REQ_PASSWORD:
Driver.debug("postgresql: PASSWORD"); if (Driver.logDebug) Driver.debug("postgresql: PASSWORD");
pg_stream.SendInteger(5 + password.length(), 4); pg_stream.SendInteger(5 + password.length(), 4);
pg_stream.Send(password.getBytes()); pg_stream.Send(password.getBytes());
pg_stream.SendInteger(0, 1); pg_stream.SendInteger(0, 1);
...@@ -255,7 +276,7 @@ public abstract class Connection ...@@ -255,7 +276,7 @@ public abstract class Connection
break; break;
case AUTH_REQ_CRYPT: case AUTH_REQ_CRYPT:
Driver.debug("postgresql: CRYPT"); if (Driver.logDebug) Driver.debug("postgresql: CRYPT");
String crypted = UnixCrypt.crypt(salt, password); String crypted = UnixCrypt.crypt(salt, password);
pg_stream.SendInteger(5 + crypted.length(), 4); pg_stream.SendInteger(5 + crypted.length(), 4);
pg_stream.Send(crypted.getBytes()); pg_stream.Send(crypted.getBytes());
...@@ -264,7 +285,7 @@ public abstract class Connection ...@@ -264,7 +285,7 @@ public abstract class Connection
break; break;
case AUTH_REQ_MD5: case AUTH_REQ_MD5:
Driver.debug("postgresql: MD5"); if (Driver.logDebug) Driver.debug("postgresql: MD5");
byte[] digest = MD5Digest.encode(PG_USER, password, salt); byte[] digest = MD5Digest.encode(PG_USER, password, salt);
pg_stream.SendInteger(5 + digest.length, 4); pg_stream.SendInteger(5 + digest.length, 4);
pg_stream.Send(digest); pg_stream.Send(digest);
...@@ -1211,5 +1232,15 @@ public abstract class Connection ...@@ -1211,5 +1232,15 @@ public abstract class Connection
} }
return pgType; return pgType;
} }
//Because the get/setLogStream methods are deprecated in JDBC2
//we use them for JDBC1 here and override this method in the jdbc2
//version of this class
protected void enableDriverManagerLogging() {
if (DriverManager.getLogStream() == null) {
DriverManager.setLogStream(System.out);
}
}
} }
...@@ -29,13 +29,10 @@ public class Driver implements java.sql.Driver ...@@ -29,13 +29,10 @@ public class Driver implements java.sql.Driver
// make these public so they can be used in setLogLevel below // make these public so they can be used in setLogLevel below
public static final int DEBUG = 0; public static final int DEBUG = 2;
public static final int INFO = 1; public static final int INFO = 1;
public static final int WARN = 2; public static boolean logDebug = false;
public static final int ERROR = 3; public static boolean logInfo = false;
public static final int FATAL = 4;
private static int logLevel = FATAL;
static static
{ {
...@@ -46,7 +43,6 @@ public class Driver implements java.sql.Driver ...@@ -46,7 +43,6 @@ public class Driver implements java.sql.Driver
// my early jdbc work did - and that was based on other examples). // my early jdbc work did - and that was based on other examples).
// Placing it here, means that the driver is registered once only. // Placing it here, means that the driver is registered once only.
java.sql.DriverManager.registerDriver(new Driver()); java.sql.DriverManager.registerDriver(new Driver());
} }
catch (SQLException e) catch (SQLException e)
{ {
...@@ -106,7 +102,12 @@ public class Driver implements java.sql.Driver ...@@ -106,7 +102,12 @@ 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.
* compatible - This is used to toggle * 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 * 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
* client and not server versions. For example in 7.1 get/setBytes * client and not server versions. For example in 7.1 get/setBytes
...@@ -140,12 +141,12 @@ public class Driver implements java.sql.Driver ...@@ -140,12 +141,12 @@ public class Driver implements java.sql.Driver
{ {
if ((props = parseURL(url, info)) == null) if ((props = parseURL(url, info)) == null)
{ {
Driver.debug("Error in url" + url); if (Driver.logDebug) Driver.debug("Error in url" + url);
return null; return null;
} }
try try
{ {
Driver.debug("connect " + url); if (Driver.logDebug) Driver.debug("connect " + url);
org.postgresql.Connection con = (org.postgresql.Connection)(Class.forName("@JDBCCONNECTCLASS@").newInstance()); org.postgresql.Connection con = (org.postgresql.Connection)(Class.forName("@JDBCCONNECTCLASS@").newInstance());
con.openConnection (host(), port(), props, database(), url, this); con.openConnection (host(), port(), props, database(), url, this);
...@@ -153,7 +154,7 @@ public class Driver implements java.sql.Driver ...@@ -153,7 +154,7 @@ public class Driver implements java.sql.Driver
} }
catch (ClassNotFoundException ex) catch (ClassNotFoundException ex)
{ {
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)
...@@ -164,7 +165,7 @@ public class Driver implements java.sql.Driver ...@@ -164,7 +165,7 @@ public class Driver implements java.sql.Driver
} }
catch (Exception ex2) catch (Exception ex2)
{ {
Driver.debug("error", ex2); if (Driver.logDebug) Driver.debug("error", ex2);
throw new PSQLException("postgresql.unusual", ex2); throw new PSQLException("postgresql.unusual", ex2);
} }
} }
...@@ -251,7 +252,7 @@ public class Driver implements java.sql.Driver ...@@ -251,7 +252,7 @@ public class Driver implements java.sql.Driver
*/ */
public static String getVersion() public static String getVersion()
{ {
return "@VERSION@"; return "@VERSION@ jdbc driver build " + m_buildNumber;
} }
/* /*
...@@ -293,12 +294,6 @@ public class Driver implements java.sql.Driver ...@@ -293,12 +294,6 @@ public class Driver implements java.sql.Driver
{ {
String token = st.nextToken(); String token = st.nextToken();
// PM June 29 1997
// Added this, to help me understand how this works.
// Unless you want each token to be processed, leave this commented out
// but don't delete it.
//DriverManager.println("wellFormedURL: state="+state+" count="+count+" token='"+token+"'");
// PM Aug 2 1997 - Modified to allow multiple backends // PM Aug 2 1997 - Modified to allow multiple backends
if (count <= 3) if (count <= 3)
{ {
...@@ -379,7 +374,6 @@ public class Driver implements java.sql.Driver ...@@ -379,7 +374,6 @@ public class Driver implements java.sql.Driver
else if (state == -5) else if (state == -5)
{ {
value = token; value = token;
//DriverManager.println("put("+key+","+value+")");
urlProps.put(key, value); urlProps.put(key, value);
state = -2; state = -2;
} }
...@@ -387,13 +381,6 @@ public class Driver implements java.sql.Driver ...@@ -387,13 +381,6 @@ public class Driver implements java.sql.Driver
} }
} }
// PM June 29 1997
// This now outputs the properties only if we are logging
// PM Sep 13 1999 Commented out, as it throws a Deprecation warning
// when compiled under JDK1.2.
//if (DriverManager.getLogStream() != null)
// urlProps.list(DriverManager.getLogStream());
return urlProps; return urlProps;
} }
...@@ -446,12 +433,13 @@ public class Driver implements java.sql.Driver ...@@ -446,12 +433,13 @@ 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
* FATAL 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)
{ {
Driver.logLevel = logLevel; logDebug = (logLevel >= DEBUG) ? true : false;
logInfo = (logLevel >= INFO) ? true : false;
} }
/* /*
* logging message at the debug level * logging message at the debug level
...@@ -459,7 +447,7 @@ public class Driver implements java.sql.Driver ...@@ -459,7 +447,7 @@ public class Driver implements java.sql.Driver
*/ */
public static void debug(String msg) public static void debug(String msg)
{ {
if (logLevel <= DEBUG) if (logDebug)
{ {
DriverManager.println(msg); DriverManager.println(msg);
} }
...@@ -470,7 +458,7 @@ public class Driver implements java.sql.Driver ...@@ -470,7 +458,7 @@ public class Driver implements java.sql.Driver
*/ */
public static void debug(String msg, Exception ex) public static void debug(String msg, Exception ex)
{ {
if (logLevel <= DEBUG) if (logDebug)
{ {
DriverManager.println(msg + ex != null ? ex.getMessage() : "null Exception"); DriverManager.println(msg + ex != null ? ex.getMessage() : "null Exception");
} }
...@@ -481,7 +469,7 @@ public class Driver implements java.sql.Driver ...@@ -481,7 +469,7 @@ public class Driver implements java.sql.Driver
*/ */
public static void info(String msg) public static void info(String msg)
{ {
if (logLevel <= INFO) if (logInfo)
{ {
DriverManager.println(msg); DriverManager.println(msg);
} }
...@@ -492,75 +480,13 @@ public class Driver implements java.sql.Driver ...@@ -492,75 +480,13 @@ public class Driver implements java.sql.Driver
*/ */
public static void info(String msg, Exception ex) public static void info(String msg, Exception ex)
{ {
if (logLevel <= INFO) if (logInfo)
{
DriverManager.println(msg + ex != null ? ex.getMessage() : "null Exception");
}
}
/*
* logging message at warn level
* messages will be printed if the logging level is less or equal to WARN
*/
public static void warn(String msg)
{
if (logLevel <= WARN)
{
DriverManager.println(msg);
}
}
/*
* logging message at warn level
* messages will be printed if the logging level is less or equal to WARN
*/
public static void warn(String msg, Exception ex)
{
if (logLevel <= WARN)
{
DriverManager.println(msg + ex != null ? ex.getMessage() : "null Exception");
}
}
/*
* logging message at error level
* messages will be printed if the logging level is less or equal to ERROR
*/
public static void error(String msg)
{
if (logLevel <= ERROR)
{
DriverManager.println(msg);
}
}
/*
* logging message at error level
* messages will be printed if the logging level is less or equal to ERROR
*/
public static void error(String msg, Exception ex)
{
if (logLevel <= ERROR)
{
DriverManager.println(msg + ex != null ? ex.getMessage() : "null Exception");
}
}
/*
* logging message at fatal level
* messages will be printed if the logging level is less or equal to FATAL
*/
public static void fatal(String msg)
{
if (logLevel <= FATAL)
{
DriverManager.println(msg);
}
}
/*
* logging message at fatal level
* messages will be printed if the logging level is less or equal to FATAL
*/
public static void fatal(String msg, Exception ex)
{
if (logLevel <= FATAL)
{ {
DriverManager.println(msg + ex != null ? ex.getMessage() : "null Exception"); DriverManager.println(msg + ex != null ? ex.getMessage() : "null Exception");
} }
} }
//The build number should be incremented for every new build
private static int m_buildNumber = 100;
} }
package org.postgresql.fastpath; package org.postgresql.fastpath;
import org.postgresql.Driver;
import java.io.*; import java.io.*;
import java.lang.*; import java.lang.*;
import java.net.*; import java.net.*;
...@@ -44,7 +45,6 @@ public class Fastpath ...@@ -44,7 +45,6 @@ public class Fastpath
{ {
this.conn = conn; this.conn = conn;
this.stream = stream; this.stream = stream;
//DriverManager.println("Fastpath initialised");
} }
/* /*
...@@ -174,7 +174,7 @@ public class Fastpath ...@@ -174,7 +174,7 @@ public class Fastpath
*/ */
public Object fastpath(String name, boolean resulttype, FastpathArg[] args) throws SQLException public Object fastpath(String name, boolean resulttype, FastpathArg[] args) throws SQLException
{ {
//DriverManager.println("Fastpath: calling "+name); if (Driver.logDebug) Driver.debug("Fastpath: calling "+name);
return fastpath(getID(name), resulttype, args); return fastpath(getID(name), resulttype, args);
} }
......
...@@ -13,7 +13,7 @@ import org.postgresql.util.PSQLException; ...@@ -13,7 +13,7 @@ import org.postgresql.util.PSQLException;
/* /*
* This class provides information about the database as a whole. * This class provides information about the database as a whole.
* *
* $Id: DatabaseMetaData.java,v 1.45 2002/06/06 14:47:52 davec Exp $ * $Id: DatabaseMetaData.java,v 1.46 2002/06/11 02:55:16 barry Exp $
* *
* <p>Many of the methods here return lists of information in ResultSets. You * <p>Many of the methods here return lists of information in ResultSets. You
* can use the normal ResultSet methods such as getString and getInt to * can use the normal ResultSet methods such as getString and getInt to
...@@ -2108,7 +2108,6 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -2108,7 +2108,6 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
{ {
byte[][] tuple = new byte[8][0]; byte[][] tuple = new byte[8][0];
tuple[0] = tuple[1] = "".getBytes(); tuple[0] = tuple[1] = "".getBytes();
DriverManager.println("relname=\"" + r.getString(1) + "\" relacl=\"" + r.getString(2) + "\"");
// For now, don't add to the result as relacl needs to be processed. // For now, don't add to the result as relacl needs to be processed.
//v.addElement(tuple); //v.addElement(tuple);
......
...@@ -17,7 +17,7 @@ import org.postgresql.largeobject.*; ...@@ -17,7 +17,7 @@ import org.postgresql.largeobject.*;
import org.postgresql.util.*; import org.postgresql.util.*;
/* /*
* $Id: Connection.java,v 1.18 2002/03/26 05:52:50 barry Exp $ * $Id: Connection.java,v 1.19 2002/06/11 02:55:16 barry Exp $
* *
* A Connection represents a session with a specific database. Within the * A Connection represents a session with a specific database. Within the
* context of a Connection, SQL statements are executed and results are * context of a Connection, SQL statements are executed and results are
...@@ -318,6 +318,14 @@ public class Connection extends org.postgresql.Connection implements java.sql.Co ...@@ -318,6 +318,14 @@ public class Connection extends org.postgresql.Connection implements java.sql.Co
Types.ARRAY Types.ARRAY
}; };
//Because the get/setLogStream methods are deprecated in JDBC2
//we use the get/setLogWriter methods here for JDBC2 by overriding
//the base version of this method
protected void enableDriverManagerLogging() {
if (DriverManager.getLogWriter() == null) {
DriverManager.setLogWriter(new PrintWriter(System.out));
}
}
} }
......
...@@ -15,7 +15,7 @@ import org.postgresql.util.PSQLException; ...@@ -15,7 +15,7 @@ import org.postgresql.util.PSQLException;
/* /*
* This class provides information about the database as a whole. * This class provides information about the database as a whole.
* *
* $Id: DatabaseMetaData.java,v 1.54 2002/06/06 14:47:52 davec Exp $ * $Id: DatabaseMetaData.java,v 1.55 2002/06/11 02:55:16 barry Exp $
* *
* <p>Many of the methods here return lists of information in ResultSets. You * <p>Many of the methods here return lists of information in ResultSets. You
* can use the normal ResultSet methods such as getString and getInt to * can use the normal ResultSet methods such as getString and getInt to
...@@ -62,7 +62,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -62,7 +62,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
*/ */
public boolean allProceduresAreCallable() throws SQLException public boolean allProceduresAreCallable() throws SQLException
{ {
Driver.debug("allProceduresAreCallable"); if (Driver.logDebug) Driver.debug("allProceduresAreCallable");
return true; // For now... return true; // For now...
} }
...@@ -75,7 +75,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -75,7 +75,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
*/ */
public boolean allTablesAreSelectable() throws SQLException public boolean allTablesAreSelectable() throws SQLException
{ {
Driver.debug("allTablesAreSelectable"); if (Driver.logDebug) Driver.debug("allTablesAreSelectable");
return true; // For now... return true; // For now...
} }
...@@ -88,7 +88,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -88,7 +88,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
public String getURL() throws SQLException public String getURL() throws SQLException
{ {
String url = connection.getURL(); String url = connection.getURL();
Driver.debug("getURL " + url); if (Driver.logDebug) Driver.debug("getURL " + url);
return url; return url;
} }
...@@ -101,7 +101,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -101,7 +101,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
public String getUserName() throws SQLException public String getUserName() throws SQLException
{ {
String userName = connection.getUserName(); String userName = connection.getUserName();
Driver.debug("getUserName " + userName); if (Driver.logDebug) Driver.debug("getUserName " + userName);
return userName; return userName;
} }
...@@ -114,7 +114,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -114,7 +114,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
public boolean isReadOnly() throws SQLException public boolean isReadOnly() throws SQLException
{ {
boolean isReadOnly = connection.isReadOnly(); boolean isReadOnly = connection.isReadOnly();
Driver.debug("isReadOnly " + isReadOnly); if (Driver.logDebug) Driver.debug("isReadOnly " + isReadOnly);
return isReadOnly; return isReadOnly;
} }
...@@ -127,7 +127,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -127,7 +127,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
public boolean nullsAreSortedHigh() throws SQLException public boolean nullsAreSortedHigh() throws SQLException
{ {
boolean nullSortedHigh = connection.haveMinimumServerVersion("7.2"); boolean nullSortedHigh = connection.haveMinimumServerVersion("7.2");
Driver.debug("nullsAreSortedHigh " + nullSortedHigh); if (Driver.logDebug) Driver.debug("nullsAreSortedHigh " + nullSortedHigh);
return nullSortedHigh; return nullSortedHigh;
} }
...@@ -139,7 +139,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -139,7 +139,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
*/ */
public boolean nullsAreSortedLow() throws SQLException public boolean nullsAreSortedLow() throws SQLException
{ {
Driver.debug("nullsAreSortedLow false"); if (Driver.logDebug) Driver.debug("nullsAreSortedLow false");
return false; return false;
} }
...@@ -151,7 +151,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -151,7 +151,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
*/ */
public boolean nullsAreSortedAtStart() throws SQLException public boolean nullsAreSortedAtStart() throws SQLException
{ {
Driver.debug("nullsAreSortedAtStart false"); if (Driver.logDebug) Driver.debug("nullsAreSortedAtStart false");
return false; return false;
} }
...@@ -164,7 +164,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -164,7 +164,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
public boolean nullsAreSortedAtEnd() throws SQLException public boolean nullsAreSortedAtEnd() throws SQLException
{ {
boolean nullsAreSortedAtEnd = ! connection.haveMinimumServerVersion("7.2"); boolean nullsAreSortedAtEnd = ! connection.haveMinimumServerVersion("7.2");
Driver.debug("nullsAreSortedAtEnd " + nullsAreSortedAtEnd); if (Driver.logDebug) Driver.debug("nullsAreSortedAtEnd " + nullsAreSortedAtEnd);
return nullsAreSortedAtEnd; return nullsAreSortedAtEnd;
} }
...@@ -177,7 +177,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -177,7 +177,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
*/ */
public String getDatabaseProductName() throws SQLException public String getDatabaseProductName() throws SQLException
{ {
Driver.debug("getDatabaseProductName PostgresSQL"); if (Driver.logDebug) Driver.debug("getDatabaseProductName PostgresSQL");
return "PostgreSQL"; return "PostgreSQL";
} }
...@@ -190,7 +190,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -190,7 +190,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
public String getDatabaseProductVersion() throws SQLException public String getDatabaseProductVersion() throws SQLException
{ {
String versionNumber = connection.getDBVersionNumber(); String versionNumber = connection.getDBVersionNumber();
Driver.debug("getDatabaseProductVersion " + versionNumber); if (Driver.logDebug) Driver.debug("getDatabaseProductVersion " + versionNumber);
return versionNumber; return versionNumber;
} }
...@@ -204,7 +204,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -204,7 +204,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
public String getDriverName() throws SQLException public String getDriverName() throws SQLException
{ {
String driverName = "PostgreSQL Native Driver"; String driverName = "PostgreSQL Native Driver";
Driver.debug("getDriverName" + driverName); if (Driver.logDebug) Driver.debug("getDriverName" + driverName);
return driverName; return driverName;
} }
...@@ -218,7 +218,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -218,7 +218,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
public String getDriverVersion() throws SQLException public String getDriverVersion() throws SQLException
{ {
String driverVersion = connection.this_driver.getVersion(); String driverVersion = connection.this_driver.getVersion();
Driver.debug("getDriverVersion " + driverVersion); if (Driver.logDebug) Driver.debug("getDriverVersion " + driverVersion);
return driverVersion; return driverVersion;
} }
...@@ -230,7 +230,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -230,7 +230,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
public int getDriverMajorVersion() public int getDriverMajorVersion()
{ {
int majorVersion = connection.this_driver.getMajorVersion(); int majorVersion = connection.this_driver.getMajorVersion();
Driver.debug("getMajorVersion " + majorVersion); if (Driver.logDebug) Driver.debug("getMajorVersion " + majorVersion);
return majorVersion; return majorVersion;
} }
...@@ -242,7 +242,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -242,7 +242,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
public int getDriverMinorVersion() public int getDriverMinorVersion()
{ {
int minorVersion = connection.this_driver.getMinorVersion(); int minorVersion = connection.this_driver.getMinorVersion();
Driver.debug("getMinorVersion " + minorVersion); if (Driver.logDebug) Driver.debug("getMinorVersion " + minorVersion);
return minorVersion; return minorVersion;
} }
...@@ -255,7 +255,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -255,7 +255,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
*/ */
public boolean usesLocalFiles() throws SQLException public boolean usesLocalFiles() throws SQLException
{ {
Driver.debug("usesLocalFiles " + false); if (Driver.logDebug) Driver.debug("usesLocalFiles " + false);
return false; return false;
} }
...@@ -268,7 +268,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -268,7 +268,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
*/ */
public boolean usesLocalFilePerTable() throws SQLException public boolean usesLocalFilePerTable() throws SQLException
{ {
Driver.debug("usesLocalFilePerTable " + false); if (Driver.logDebug) Driver.debug("usesLocalFilePerTable " + false);
return false; return false;
} }
...@@ -286,7 +286,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -286,7 +286,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
*/ */
public boolean supportsMixedCaseIdentifiers() throws SQLException public boolean supportsMixedCaseIdentifiers() throws SQLException
{ {
Driver.debug("supportsMixedCaseIdentifiers " + false); if (Driver.logDebug) Driver.debug("supportsMixedCaseIdentifiers " + false);
return false; return false;
} }
...@@ -298,7 +298,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -298,7 +298,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
*/ */
public boolean storesUpperCaseIdentifiers() throws SQLException public boolean storesUpperCaseIdentifiers() throws SQLException
{ {
Driver.debug("storesUpperCaseIdentifiers " + false); if (Driver.logDebug) Driver.debug("storesUpperCaseIdentifiers " + false);
return false; return false;
} }
...@@ -310,7 +310,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -310,7 +310,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
*/ */
public boolean storesLowerCaseIdentifiers() throws SQLException public boolean storesLowerCaseIdentifiers() throws SQLException
{ {
Driver.debug("storesLowerCaseIdentifiers " + true); if (Driver.logDebug) Driver.debug("storesLowerCaseIdentifiers " + true);
return true; return true;
} }
...@@ -322,7 +322,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -322,7 +322,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
*/ */
public boolean storesMixedCaseIdentifiers() throws SQLException public boolean storesMixedCaseIdentifiers() throws SQLException
{ {
Driver.debug("storesMixedCaseIdentifiers " + false); if (Driver.logDebug) Driver.debug("storesMixedCaseIdentifiers " + false);
return false; return false;
} }
...@@ -336,7 +336,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -336,7 +336,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
*/ */
public boolean supportsMixedCaseQuotedIdentifiers() throws SQLException public boolean supportsMixedCaseQuotedIdentifiers() throws SQLException
{ {
Driver.debug("supportsMixedCaseQuotedIdentifiers " + true); if (Driver.logDebug) Driver.debug("supportsMixedCaseQuotedIdentifiers " + true);
return true; return true;
} }
...@@ -348,7 +348,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -348,7 +348,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
*/ */
public boolean storesUpperCaseQuotedIdentifiers() throws SQLException public boolean storesUpperCaseQuotedIdentifiers() throws SQLException
{ {
Driver.debug("storesUpperCaseQuotedIdentifiers " + false); if (Driver.logDebug) Driver.debug("storesUpperCaseQuotedIdentifiers " + false);
return false; return false;
} }
...@@ -360,7 +360,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -360,7 +360,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
*/ */
public boolean storesLowerCaseQuotedIdentifiers() throws SQLException public boolean storesLowerCaseQuotedIdentifiers() throws SQLException
{ {
Driver.debug("storesLowerCaseQuotedIdentifiers " + false); if (Driver.logDebug) Driver.debug("storesLowerCaseQuotedIdentifiers " + false);
return false; return false;
} }
...@@ -372,7 +372,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -372,7 +372,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
*/ */
public boolean storesMixedCaseQuotedIdentifiers() throws SQLException public boolean storesMixedCaseQuotedIdentifiers() throws SQLException
{ {
Driver.debug("storesMixedCaseQuotedIdentifiers " + false); if (Driver.logDebug) Driver.debug("storesMixedCaseQuotedIdentifiers " + false);
return false; return false;
} }
...@@ -386,7 +386,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -386,7 +386,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
*/ */
public String getIdentifierQuoteString() throws SQLException public String getIdentifierQuoteString() throws SQLException
{ {
Driver.debug("getIdentifierQuoteString \"" ); if (Driver.logDebug) Driver.debug("getIdentifierQuoteString \"" );
return "\""; return "\"";
} }
...@@ -408,35 +408,35 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -408,35 +408,35 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
*/ */
public String getSQLKeywords() throws SQLException public String getSQLKeywords() throws SQLException
{ {
Driver.debug("getSQLKeyWords"); if (Driver.logDebug) Driver.debug("getSQLKeyWords");
return "abort,acl,add,aggregate,append,archive,arch_store,backward,binary,change,cluster,copy,database,delimiters,do,extend,explain,forward,heavy,index,inherits,isnull,light,listen,load,merge,nothing,notify,notnull,oids,purge,rename,replace,retrieve,returns,rule,recipe,setof,stdin,stdout,store,vacuum,verbose,version"; return "abort,acl,add,aggregate,append,archive,arch_store,backward,binary,change,cluster,copy,database,delimiters,do,extend,explain,forward,heavy,index,inherits,isnull,light,listen,load,merge,nothing,notify,notnull,oids,purge,rename,replace,retrieve,returns,rule,recipe,setof,stdin,stdout,store,vacuum,verbose,version";
} }
public String getNumericFunctions() throws SQLException public String getNumericFunctions() throws SQLException
{ {
// XXX-Not Implemented // XXX-Not Implemented
Driver.debug("getNumericFunctions"); if (Driver.logDebug) Driver.debug("getNumericFunctions");
return ""; return "";
} }
public String getStringFunctions() throws SQLException public String getStringFunctions() throws SQLException
{ {
// XXX-Not Implemented // XXX-Not Implemented
Driver.debug("getStringFunctions"); if (Driver.logDebug) Driver.debug("getStringFunctions");
return ""; return "";
} }
public String getSystemFunctions() throws SQLException public String getSystemFunctions() throws SQLException
{ {
// XXX-Not Implemented // XXX-Not Implemented
Driver.debug("getSystemFunctions"); if (Driver.logDebug) Driver.debug("getSystemFunctions");
return ""; return "";
} }
public String getTimeDateFunctions() throws SQLException public String getTimeDateFunctions() throws SQLException
{ {
// XXX-Not Implemented // XXX-Not Implemented
Driver.debug("getTimeDateFunctions"); if (Driver.logDebug) Driver.debug("getTimeDateFunctions");
return ""; return "";
} }
...@@ -449,7 +449,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -449,7 +449,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
*/ */
public String getSearchStringEscape() throws SQLException public String getSearchStringEscape() throws SQLException
{ {
Driver.debug("getSearchStringEscape"); if (Driver.logDebug) Driver.debug("getSearchStringEscape");
return "\\"; return "\\";
} }
...@@ -466,7 +466,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -466,7 +466,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
*/ */
public String getExtraNameCharacters() throws SQLException public String getExtraNameCharacters() throws SQLException
{ {
Driver.debug("getExtraNameCharacters"); if (Driver.logDebug) Driver.debug("getExtraNameCharacters");
return ""; return "";
} }
...@@ -479,7 +479,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -479,7 +479,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
*/ */
public boolean supportsAlterTableWithAddColumn() throws SQLException public boolean supportsAlterTableWithAddColumn() throws SQLException
{ {
Driver.debug("supportsAlterTableWithAddColumn " + true); if (Driver.logDebug) Driver.debug("supportsAlterTableWithAddColumn " + true);
return true; return true;
} }
...@@ -492,7 +492,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -492,7 +492,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
*/ */
public boolean supportsAlterTableWithDropColumn() throws SQLException public boolean supportsAlterTableWithDropColumn() throws SQLException
{ {
Driver.debug("supportsAlterTableWithDropColumn " + false); if (Driver.logDebug) Driver.debug("supportsAlterTableWithDropColumn " + false);
return false; return false;
} }
...@@ -516,7 +516,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -516,7 +516,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
*/ */
public boolean supportsColumnAliasing() throws SQLException public boolean supportsColumnAliasing() throws SQLException
{ {
Driver.debug("supportsColumnAliasing " + true); if (Driver.logDebug) Driver.debug("supportsColumnAliasing " + true);
return true; return true;
} }
...@@ -529,21 +529,21 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -529,21 +529,21 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
*/ */
public boolean nullPlusNonNullIsNull() throws SQLException public boolean nullPlusNonNullIsNull() throws SQLException
{ {
Driver.debug("nullPlusNonNullIsNull " + true); if (Driver.logDebug) Driver.debug("nullPlusNonNullIsNull " + true);
return true; return true;
} }
public boolean supportsConvert() throws SQLException public boolean supportsConvert() throws SQLException
{ {
// XXX-Not Implemented // XXX-Not Implemented
Driver.debug("supportsConvert " + false); if (Driver.logDebug) Driver.debug("supportsConvert " + false);
return false; return false;
} }
public boolean supportsConvert(int fromType, int toType) throws SQLException public boolean supportsConvert(int fromType, int toType) throws SQLException
{ {
// XXX-Not Implemented // XXX-Not Implemented
Driver.debug("supportsConvert " + false); if (Driver.logDebug) Driver.debug("supportsConvert " + false);
return false; return false;
} }
...@@ -556,7 +556,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -556,7 +556,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
*/ */
public boolean supportsTableCorrelationNames() throws SQLException public boolean supportsTableCorrelationNames() throws SQLException
{ {
Driver.debug("supportsTableCorrelationNames " + true); if (Driver.logDebug) Driver.debug("supportsTableCorrelationNames " + true);
return true; return true;
} }
...@@ -569,7 +569,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -569,7 +569,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
*/ */
public boolean supportsDifferentTableCorrelationNames() throws SQLException public boolean supportsDifferentTableCorrelationNames() throws SQLException
{ {
Driver.debug("supportsDifferentTableCorrelationNames " + false); if (Driver.logDebug) Driver.debug("supportsDifferentTableCorrelationNames " + false);
return false; return false;
} }
...@@ -583,7 +583,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -583,7 +583,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
*/ */
public boolean supportsExpressionsInOrderBy() throws SQLException public boolean supportsExpressionsInOrderBy() throws SQLException
{ {
Driver.debug("supportsExpressionsInOrderBy " + true); if (Driver.logDebug) Driver.debug("supportsExpressionsInOrderBy " + true);
return true; return true;
} }
...@@ -596,7 +596,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -596,7 +596,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
public boolean supportsOrderByUnrelated() throws SQLException public boolean supportsOrderByUnrelated() throws SQLException
{ {
boolean supportsOrderByUnrelated = connection.haveMinimumServerVersion("6.4"); boolean supportsOrderByUnrelated = connection.haveMinimumServerVersion("6.4");
Driver.debug("supportsOrderByUnrelated " + supportsOrderByUnrelated); if (Driver.logDebug) Driver.debug("supportsOrderByUnrelated " + supportsOrderByUnrelated);
return supportsOrderByUnrelated; return supportsOrderByUnrelated;
} }
...@@ -609,7 +609,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -609,7 +609,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
*/ */
public boolean supportsGroupBy() throws SQLException public boolean supportsGroupBy() throws SQLException
{ {
Driver.debug("supportsGroupBy " + true); if (Driver.logDebug) Driver.debug("supportsGroupBy " + true);
return true; return true;
} }
...@@ -622,7 +622,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -622,7 +622,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
public boolean supportsGroupByUnrelated() throws SQLException public boolean supportsGroupByUnrelated() throws SQLException
{ {
boolean supportsGroupByUnrelated = connection.haveMinimumServerVersion("6.4"); boolean supportsGroupByUnrelated = connection.haveMinimumServerVersion("6.4");
Driver.debug("supportsGroupByUnrelated " + supportsGroupByUnrelated); if (Driver.logDebug) Driver.debug("supportsGroupByUnrelated " + supportsGroupByUnrelated);
return supportsGroupByUnrelated; return supportsGroupByUnrelated;
} }
...@@ -639,7 +639,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -639,7 +639,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
public boolean supportsGroupByBeyondSelect() throws SQLException public boolean supportsGroupByBeyondSelect() throws SQLException
{ {
boolean supportsGroupByBeyondSelect = connection.haveMinimumServerVersion("6.4"); boolean supportsGroupByBeyondSelect = connection.haveMinimumServerVersion("6.4");
Driver.debug("supportsGroupByUnrelated " + supportsGroupByBeyondSelect); if (Driver.logDebug) Driver.debug("supportsGroupByUnrelated " + supportsGroupByBeyondSelect);
return supportsGroupByBeyondSelect; return supportsGroupByBeyondSelect;
} }
...@@ -653,7 +653,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -653,7 +653,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
public boolean supportsLikeEscapeClause() throws SQLException public boolean supportsLikeEscapeClause() throws SQLException
{ {
boolean supportsLikeEscapeClause = connection.haveMinimumServerVersion("7.1"); boolean supportsLikeEscapeClause = connection.haveMinimumServerVersion("7.1");
Driver.debug("supportsLikeEscapeClause " + supportsLikeEscapeClause); if (Driver.logDebug) Driver.debug("supportsLikeEscapeClause " + supportsLikeEscapeClause);
return supportsLikeEscapeClause; return supportsLikeEscapeClause;
} }
...@@ -667,7 +667,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -667,7 +667,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
*/ */
public boolean supportsMultipleResultSets() throws SQLException public boolean supportsMultipleResultSets() throws SQLException
{ {
Driver.debug("supportsMultipleResultSets " + false); if (Driver.logDebug) Driver.debug("supportsMultipleResultSets " + false);
return false; return false;
} }
...@@ -681,7 +681,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -681,7 +681,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
*/ */
public boolean supportsMultipleTransactions() throws SQLException public boolean supportsMultipleTransactions() throws SQLException
{ {
Driver.debug("supportsMultipleTransactions " + true); if (Driver.logDebug) Driver.debug("supportsMultipleTransactions " + true);
return true; return true;
} }
...@@ -697,7 +697,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -697,7 +697,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
*/ */
public boolean supportsNonNullableColumns() throws SQLException public boolean supportsNonNullableColumns() throws SQLException
{ {
Driver.debug("supportsNonNullableColumns true"); if (Driver.logDebug) Driver.debug("supportsNonNullableColumns true");
return true; return true;
} }
...@@ -715,7 +715,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -715,7 +715,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
*/ */
public boolean supportsMinimumSQLGrammar() throws SQLException public boolean supportsMinimumSQLGrammar() throws SQLException
{ {
Driver.debug("supportsMinimumSQLGrammar TRUE"); if (Driver.logDebug) Driver.debug("supportsMinimumSQLGrammar TRUE");
return true; return true;
} }
...@@ -728,7 +728,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -728,7 +728,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
*/ */
public boolean supportsCoreSQLGrammar() throws SQLException public boolean supportsCoreSQLGrammar() throws SQLException
{ {
Driver.debug("supportsCoreSQLGrammar FALSE "); if (Driver.logDebug) Driver.debug("supportsCoreSQLGrammar FALSE ");
return false; return false;
} }
...@@ -742,7 +742,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -742,7 +742,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
*/ */
public boolean supportsExtendedSQLGrammar() throws SQLException public boolean supportsExtendedSQLGrammar() throws SQLException
{ {
Driver.debug("supportsExtendedSQLGrammar FALSE"); if (Driver.logDebug) Driver.debug("supportsExtendedSQLGrammar FALSE");
return false; return false;
} }
...@@ -761,7 +761,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -761,7 +761,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
public boolean supportsANSI92EntryLevelSQL() throws SQLException public boolean supportsANSI92EntryLevelSQL() throws SQLException
{ {
boolean schemas = connection.haveMinimumServerVersion("7.3"); boolean schemas = connection.haveMinimumServerVersion("7.3");
Driver.debug("supportsANSI92EntryLevelSQL " + schemas); if (Driver.logDebug) Driver.debug("supportsANSI92EntryLevelSQL " + schemas);
return schemas; return schemas;
} }
...@@ -775,7 +775,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -775,7 +775,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
*/ */
public boolean supportsANSI92IntermediateSQL() throws SQLException public boolean supportsANSI92IntermediateSQL() throws SQLException
{ {
Driver.debug("supportsANSI92IntermediateSQL false "); if (Driver.logDebug) Driver.debug("supportsANSI92IntermediateSQL false ");
return false; return false;
} }
...@@ -787,7 +787,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -787,7 +787,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
*/ */
public boolean supportsANSI92FullSQL() throws SQLException public boolean supportsANSI92FullSQL() throws SQLException
{ {
Driver.debug("supportsANSI92FullSQL false "); if (Driver.logDebug) Driver.debug("supportsANSI92FullSQL false ");
return false; return false;
} }
...@@ -800,7 +800,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -800,7 +800,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
*/ */
public boolean supportsIntegrityEnhancementFacility() throws SQLException public boolean supportsIntegrityEnhancementFacility() throws SQLException
{ {
Driver.debug("supportsIntegrityEnhancementFacility false "); if (Driver.logDebug) Driver.debug("supportsIntegrityEnhancementFacility false ");
return false; return false;
} }
...@@ -813,7 +813,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -813,7 +813,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
public boolean supportsOuterJoins() throws SQLException public boolean supportsOuterJoins() throws SQLException
{ {
boolean supportsOuterJoins = connection.haveMinimumServerVersion("7.1"); boolean supportsOuterJoins = connection.haveMinimumServerVersion("7.1");
Driver.debug("supportsOuterJoins " + supportsOuterJoins); if (Driver.logDebug) Driver.debug("supportsOuterJoins " + supportsOuterJoins);
return supportsOuterJoins; return supportsOuterJoins;
} }
...@@ -826,7 +826,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -826,7 +826,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
public boolean supportsFullOuterJoins() throws SQLException public boolean supportsFullOuterJoins() throws SQLException
{ {
boolean supportsFullOuterJoins = connection.haveMinimumServerVersion("7.1"); boolean supportsFullOuterJoins = connection.haveMinimumServerVersion("7.1");
Driver.debug("supportsFullOuterJoins " + supportsFullOuterJoins); if (Driver.logDebug) Driver.debug("supportsFullOuterJoins " + supportsFullOuterJoins);
return supportsFullOuterJoins; return supportsFullOuterJoins;
} }
...@@ -839,7 +839,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -839,7 +839,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
public boolean supportsLimitedOuterJoins() throws SQLException public boolean supportsLimitedOuterJoins() throws SQLException
{ {
boolean supportsLimitedOuterJoins = connection.haveMinimumServerVersion("7.1"); boolean supportsLimitedOuterJoins = connection.haveMinimumServerVersion("7.1");
Driver.debug("supportsFullOuterJoins " + supportsLimitedOuterJoins); if (Driver.logDebug) Driver.debug("supportsFullOuterJoins " + supportsLimitedOuterJoins);
return supportsLimitedOuterJoins; return supportsLimitedOuterJoins;
} }
...@@ -853,7 +853,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -853,7 +853,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
*/ */
public String getSchemaTerm() throws SQLException public String getSchemaTerm() throws SQLException
{ {
Driver.debug("getSchemaTerm schema"); if (Driver.logDebug) Driver.debug("getSchemaTerm schema");
return "schema"; return "schema";
} }
...@@ -866,7 +866,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -866,7 +866,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
*/ */
public String getProcedureTerm() throws SQLException public String getProcedureTerm() throws SQLException
{ {
Driver.debug("getProcedureTerm function "); if (Driver.logDebug) Driver.debug("getProcedureTerm function ");
return "function"; return "function";
} }
...@@ -878,7 +878,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -878,7 +878,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
*/ */
public String getCatalogTerm() throws SQLException public String getCatalogTerm() throws SQLException
{ {
Driver.debug("getCatalogTerm database "); if (Driver.logDebug) Driver.debug("getCatalogTerm database ");
return "database"; return "database";
} }
...@@ -893,7 +893,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -893,7 +893,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
{ {
// return true here; we return false for every other catalog function // return true here; we return false for every other catalog function
// so it won't matter what we return here D.C. // so it won't matter what we return here D.C.
Driver.debug("isCatalogAtStart not implemented"); if (Driver.logDebug) Driver.debug("isCatalogAtStart not implemented");
return true; return true;
} }
...@@ -907,7 +907,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -907,7 +907,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
{ {
// Give them something to work with here // Give them something to work with here
// everything else returns false so it won't matter what we return here D.C. // everything else returns false so it won't matter what we return here D.C.
Driver.debug("getCatalogSeparator not implemented "); if (Driver.logDebug) Driver.debug("getCatalogSeparator not implemented ");
return "."; return ".";
} }
...@@ -919,7 +919,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -919,7 +919,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
*/ */
public boolean supportsSchemasInDataManipulation() throws SQLException public boolean supportsSchemasInDataManipulation() throws SQLException
{ {
Driver.debug("supportsSchemasInDataManipulation false"); if (Driver.logDebug) Driver.debug("supportsSchemasInDataManipulation false");
return false; return false;
} }
...@@ -931,7 +931,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -931,7 +931,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
*/ */
public boolean supportsSchemasInProcedureCalls() throws SQLException public boolean supportsSchemasInProcedureCalls() throws SQLException
{ {
Driver.debug("supportsSchemasInProcedureCalls false"); if (Driver.logDebug) Driver.debug("supportsSchemasInProcedureCalls false");
return false; return false;
} }
...@@ -945,7 +945,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -945,7 +945,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
{ {
boolean schemas = connection.haveMinimumServerVersion("7.3"); boolean schemas = connection.haveMinimumServerVersion("7.3");
Driver.debug("supportsSchemasInTableDefinitions " + schemas); if (Driver.logDebug) Driver.debug("supportsSchemasInTableDefinitions " + schemas);
return schemas; return schemas;
} }
...@@ -957,7 +957,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -957,7 +957,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
*/ */
public boolean supportsSchemasInIndexDefinitions() throws SQLException public boolean supportsSchemasInIndexDefinitions() throws SQLException
{ {
Driver.debug("supportsSchemasInIndexDefinitions false"); if (Driver.logDebug) Driver.debug("supportsSchemasInIndexDefinitions false");
return false; return false;
} }
...@@ -969,7 +969,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -969,7 +969,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
*/ */
public boolean supportsSchemasInPrivilegeDefinitions() throws SQLException public boolean supportsSchemasInPrivilegeDefinitions() throws SQLException
{ {
Driver.debug("supportsSchemasInPrivilegeDefinitions false"); if (Driver.logDebug) Driver.debug("supportsSchemasInPrivilegeDefinitions false");
return false; return false;
} }
...@@ -981,7 +981,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -981,7 +981,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
*/ */
public boolean supportsCatalogsInDataManipulation() throws SQLException public boolean supportsCatalogsInDataManipulation() throws SQLException
{ {
Driver.debug("supportsCatalogsInDataManipulation false"); if (Driver.logDebug) Driver.debug("supportsCatalogsInDataManipulation false");
return false; return false;
} }
...@@ -993,7 +993,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -993,7 +993,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
*/ */
public boolean supportsCatalogsInProcedureCalls() throws SQLException public boolean supportsCatalogsInProcedureCalls() throws SQLException
{ {
Driver.debug("supportsCatalogsInDataManipulation false"); if (Driver.logDebug) Driver.debug("supportsCatalogsInDataManipulation false");
return false; return false;
} }
...@@ -1005,7 +1005,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -1005,7 +1005,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
*/ */
public boolean supportsCatalogsInTableDefinitions() throws SQLException public boolean supportsCatalogsInTableDefinitions() throws SQLException
{ {
Driver.debug("supportsCatalogsInTableDefinitions false"); if (Driver.logDebug) Driver.debug("supportsCatalogsInTableDefinitions false");
return false; return false;
} }
...@@ -1017,7 +1017,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -1017,7 +1017,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
*/ */
public boolean supportsCatalogsInIndexDefinitions() throws SQLException public boolean supportsCatalogsInIndexDefinitions() throws SQLException
{ {
Driver.debug("supportsCatalogsInIndexDefinitions false"); if (Driver.logDebug) Driver.debug("supportsCatalogsInIndexDefinitions false");
return false; return false;
} }
...@@ -1029,7 +1029,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -1029,7 +1029,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
*/ */
public boolean supportsCatalogsInPrivilegeDefinitions() throws SQLException public boolean supportsCatalogsInPrivilegeDefinitions() throws SQLException
{ {
Driver.debug("supportsCatalogsInPrivilegeDefinitions false"); if (Driver.logDebug) Driver.debug("supportsCatalogsInPrivilegeDefinitions false");
return false; return false;
} }
...@@ -1042,7 +1042,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -1042,7 +1042,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
*/ */
public boolean supportsPositionedDelete() throws SQLException public boolean supportsPositionedDelete() throws SQLException
{ {
Driver.debug("supportsPositionedDelete false"); if (Driver.logDebug) Driver.debug("supportsPositionedDelete false");
return false; // For now... return false; // For now...
} }
...@@ -1054,7 +1054,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -1054,7 +1054,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
*/ */
public boolean supportsPositionedUpdate() throws SQLException public boolean supportsPositionedUpdate() throws SQLException
{ {
Driver.debug("supportsPositionedUpdate false"); if (Driver.logDebug) Driver.debug("supportsPositionedUpdate false");
return false; // For now... return false; // For now...
} }
...@@ -2212,7 +2212,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -2212,7 +2212,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
{ {
byte[][] tuple = new byte[8][0]; byte[][] tuple = new byte[8][0];
tuple[0] = tuple[1] = "".getBytes(); tuple[0] = tuple[1] = "".getBytes();
DriverManager.println("relname=\"" + r.getString(1) + "\" relacl=\"" + r.getString(2) + "\""); if (Driver.logDebug) Driver.debug("relname=\"" + r.getString(1) + "\" relacl=\"" + r.getString(2) + "\"");
// For now, don't add to the result as relacl needs to be processed. // For now, don't add to the result as relacl needs to be processed.
//v.addElement(tuple); //v.addElement(tuple);
...@@ -2275,7 +2275,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -2275,7 +2275,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
{ {
byte[][] tuple = new byte[8][0]; byte[][] tuple = new byte[8][0];
tuple[0] = tuple[1] = "".getBytes(); tuple[0] = tuple[1] = "".getBytes();
DriverManager.println("relname=\"" + r.getString(1) + "\" relacl=\"" + r.getString(2) + "\""); if (Driver.logDebug) Driver.debug("relname=\"" + r.getString(1) + "\" relacl=\"" + r.getString(2) + "\"");
// For now, don't add to the result as relacl needs to be processed. // For now, don't add to the result as relacl needs to be processed.
//v.addElement(tuple); //v.addElement(tuple);
......
package org.postgresql.largeobject; package org.postgresql.largeobject;
import org.postgresql.Driver;
import java.io.*; import java.io.*;
import java.lang.*; import java.lang.*;
import java.net.*; import java.net.*;
...@@ -117,7 +118,7 @@ public class LargeObjectManager ...@@ -117,7 +118,7 @@ public class LargeObjectManager
fp.addFunctions(res); fp.addFunctions(res);
res.close(); res.close();
DriverManager.println("Large Object initialised"); if (Driver.logDebug) Driver.debug("Large Object initialised");
} }
/* /*
......
package org.postgresql.util; package org.postgresql.util;
import org.postgresql.Driver;
import java.io.*; import java.io.*;
import java.lang.*; import java.lang.*;
import java.lang.reflect.*; import java.lang.reflect.*;
...@@ -128,14 +129,14 @@ public class Serialize ...@@ -128,14 +129,14 @@ public class Serialize
try try
{ {
conn = c; conn = c;
DriverManager.println("Serialize: initializing instance for type: " + type); if (Driver.logDebug) Driver.debug("Serialize: initializing instance for type: " + type);
tableName = toPostgreSQL(type); tableName = toPostgreSQL(type);
className = type; className = type;
ourClass = Class.forName(className); ourClass = Class.forName(className);
} }
catch (ClassNotFoundException cnfe) catch (ClassNotFoundException cnfe)
{ {
DriverManager.println("Serialize: " + className + " java class not found"); if (Driver.logDebug) Driver.debug("Serialize: " + className + " java class not found");
throw new PSQLException("postgresql.serial.noclass", type); throw new PSQLException("postgresql.serial.noclass", type);
} }
...@@ -147,14 +148,14 @@ public class Serialize ...@@ -147,14 +148,14 @@ public class Serialize
if (rs.next()) if (rs.next())
{ {
status = true; status = true;
DriverManager.println("Serialize: " + tableName + " table found"); if (Driver.logDebug) Driver.debug("Serialize: " + tableName + " table found");
} }
rs.close(); rs.close();
} }
// This should never occur, as org.postgresql has it's own internal checks // This should never occur, as org.postgresql has it's own internal checks
if (!status) if (!status)
{ {
DriverManager.println("Serialize: " + tableName + " table not found"); if (Driver.logDebug) Driver.debug("Serialize: " + tableName + " table not found");
throw new PSQLException("postgresql.serial.table", type); throw new PSQLException("postgresql.serial.table", type);
} }
// Finally cache the fields within the table // Finally cache the fields within the table
...@@ -186,9 +187,9 @@ public class Serialize ...@@ -186,9 +187,9 @@ public class Serialize
{ {
try try
{ {
DriverManager.println("Serialize.fetch: " + "attempting to instantiate object of type: " + ourClass.getName() ); if (Driver.logDebug) Driver.debug("Serialize.fetch: " + "attempting to instantiate object of type: " + ourClass.getName() );
Object obj = ourClass.newInstance(); Object obj = ourClass.newInstance();
DriverManager.println("Serialize.fetch: " + "instantiated object of type: " + ourClass.getName() ); if (Driver.logDebug) Driver.debug("Serialize.fetch: " + "instantiated object of type: " + ourClass.getName() );
// NB: we use java.lang.reflect here to prevent confusion with // NB: we use java.lang.reflect here to prevent confusion with
// the org.postgresql.Field // the org.postgresql.Field
...@@ -219,7 +220,7 @@ public class Serialize ...@@ -219,7 +220,7 @@ public class Serialize
sb.append(" where oid="); sb.append(" where oid=");
sb.append(oid); sb.append(oid);
DriverManager.println("Serialize.fetch: " + sb.toString()); if (Driver.logDebug) Driver.debug("Serialize.fetch: " + sb.toString());
ResultSet rs = conn.ExecSQL(sb.toString()); ResultSet rs = conn.ExecSQL(sb.toString());
if (rs != null) if (rs != null)
...@@ -388,7 +389,7 @@ public class Serialize ...@@ -388,7 +389,7 @@ public class Serialize
sb.append(')'); sb.append(')');
} }
DriverManager.println("Serialize.store: " + sb.toString() ); if (Driver.logDebug) Driver.debug("Serialize.store: " + sb.toString() );
org.postgresql.ResultSet rs = (org.postgresql.ResultSet) conn.ExecSQL(sb.toString()); org.postgresql.ResultSet rs = (org.postgresql.ResultSet) conn.ExecSQL(sb.toString());
// fetch the OID for returning // fetch the OID for returning
...@@ -495,13 +496,13 @@ public class Serialize ...@@ -495,13 +496,13 @@ public class Serialize
ResultSet rs = con.ExecSQL("select relname from pg_class where relname = '" + tableName + "'"); ResultSet rs = con.ExecSQL("select relname from pg_class where relname = '" + tableName + "'");
if ( rs.next() ) if ( rs.next() )
{ {
DriverManager.println("Serialize.create: table " + tableName + " exists, skipping"); if (Driver.logDebug) Driver.debug("Serialize.create: table " + tableName + " exists, skipping");
rs.close(); rs.close();
return; return;
} }
// else table not found, so create it // else table not found, so create it
DriverManager.println("Serialize.create: table " + tableName + " not found, creating" ); if (Driver.logDebug) Driver.debug("Serialize.create: table " + tableName + " not found, creating" );
// No entries returned, so the table doesn't exist // No entries returned, so the table doesn't exist
StringBuffer sb = new StringBuffer("create table "); StringBuffer sb = new StringBuffer("create table ");
...@@ -547,7 +548,7 @@ public class Serialize ...@@ -547,7 +548,7 @@ public class Serialize
sb.append(")"); sb.append(")");
// Now create the table // Now create the table
DriverManager.println("Serialize.create: " + sb ); if (Driver.logDebug) Driver.debug("Serialize.create: " + sb );
con.ExecSQL(sb.toString()); con.ExecSQL(sb.toString());
} }
......
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