mirror of
https://github.com/postgres/postgres.git
synced 2025-06-17 17:02:08 +03:00
JDBC indenting, comment cleanups.
This commit is contained in:
@ -10,8 +10,8 @@ import org.postgresql.largeobject.*;
|
||||
import org.postgresql.util.*;
|
||||
import org.postgresql.core.*;
|
||||
|
||||
/**
|
||||
* $Id: Connection.java,v 1.35 2001/11/12 19:11:56 barry Exp $
|
||||
/*
|
||||
* $Id: Connection.java,v 1.36 2001/11/19 22:33:37 momjian Exp $
|
||||
*
|
||||
* This abstract class is used by org.postgresql.Driver to open either the JDBC1 or
|
||||
* JDBC2 versions of the Connection class.
|
||||
@ -30,7 +30,7 @@ public abstract class Connection
|
||||
private boolean PG_STATUS;
|
||||
private String compatible;
|
||||
|
||||
/**
|
||||
/*
|
||||
* The encoding to use for this connection.
|
||||
*/
|
||||
private Encoding encoding = Encoding.defaultEncoding();
|
||||
@ -63,7 +63,7 @@ public abstract class Connection
|
||||
private static final int AUTH_REQ_KRB5 = 2;
|
||||
private static final int AUTH_REQ_PASSWORD = 3;
|
||||
private static final int AUTH_REQ_CRYPT = 4;
|
||||
private static final int AUTH_REQ_MD5 = 5;
|
||||
private static final int AUTH_REQ_MD5 = 5;
|
||||
|
||||
// New for 6.3, salt value for crypt authorisation
|
||||
private String salt;
|
||||
@ -76,7 +76,7 @@ public abstract class Connection
|
||||
// Now handle notices as warnings, so things like "show" now work
|
||||
public SQLWarning firstWarning = null;
|
||||
|
||||
/**
|
||||
/*
|
||||
* Cache of the current isolation level
|
||||
*/
|
||||
private int isolationLevel = java.sql.Connection.TRANSACTION_READ_COMMITTED;
|
||||
@ -85,13 +85,13 @@ public abstract class Connection
|
||||
public int pid;
|
||||
public int ckey;
|
||||
|
||||
/**
|
||||
/*
|
||||
* This is called by Class.forName() from within org.postgresql.Driver
|
||||
*/
|
||||
public Connection()
|
||||
{}
|
||||
|
||||
/**
|
||||
/*
|
||||
* This method actually opens the connection. It is called by Driver.
|
||||
*
|
||||
* @param host the hostname of the database back end
|
||||
@ -115,7 +115,7 @@ public abstract class Connection
|
||||
this_url = url;
|
||||
PG_DATABASE = database;
|
||||
PG_USER = info.getProperty("user");
|
||||
PG_PASSWORD = info.getProperty("password","");
|
||||
PG_PASSWORD = info.getProperty("password","");
|
||||
PG_PORT = port;
|
||||
PG_HOST = host;
|
||||
PG_STATUS = CONNECTION_BAD;
|
||||
@ -335,7 +335,7 @@ public abstract class Connection
|
||||
// are common to all implementations (JDBC1 or 2), they are placed here.
|
||||
// This should make it easy to maintain the two specifications.
|
||||
|
||||
/**
|
||||
/*
|
||||
* This adds a warning to the warning chain.
|
||||
* @param msg message to add
|
||||
*/
|
||||
@ -355,17 +355,17 @@ public abstract class Connection
|
||||
// technique again, we'll know where to place it.
|
||||
//
|
||||
// This is generated by the SQL "show datestyle"
|
||||
//if(msg.startsWith("NOTICE:") && msg.indexOf("DateStyle")>0) {
|
||||
//if (msg.startsWith("NOTICE:") && msg.indexOf("DateStyle")>0) {
|
||||
//// 13 is the length off "DateStyle is "
|
||||
//msg = msg.substring(msg.indexOf("DateStyle is ")+13);
|
||||
//
|
||||
//for(int i=0;i<dateStyles.length;i+=2)
|
||||
//if(msg.startsWith(dateStyles[i]))
|
||||
//if (msg.startsWith(dateStyles[i]))
|
||||
//currentDateStyle=i+1; // this is the index of the format
|
||||
//}
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Send a query to the backend. Returns one of the ResultSet
|
||||
* objects.
|
||||
*
|
||||
@ -381,7 +381,7 @@ public abstract class Connection
|
||||
return ExecSQL(sql, null);
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Send a query to the backend. Returns one of the ResultSet
|
||||
* objects.
|
||||
*
|
||||
@ -398,7 +398,7 @@ public abstract class Connection
|
||||
return new QueryExecutor(sql, stat, pg_stream, this).execute();
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* In SQL, a result table can be retrieved through a cursor that
|
||||
* is named. The current row of a result can be updated or deleted
|
||||
* using a positioned update/delete statement that references the
|
||||
@ -416,7 +416,7 @@ public abstract class Connection
|
||||
this.cursor = cursor;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* getCursorName gets the cursor name.
|
||||
*
|
||||
* @return the current cursor name
|
||||
@ -427,7 +427,7 @@ public abstract class Connection
|
||||
return cursor;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* We are required to bring back certain information by
|
||||
* the DatabaseMetaData class. These functions do that.
|
||||
*
|
||||
@ -441,7 +441,7 @@ public abstract class Connection
|
||||
return this_url;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Method getUserName() brings back the User Name (again, we
|
||||
* saved it)
|
||||
*
|
||||
@ -453,7 +453,7 @@ public abstract class Connection
|
||||
return PG_USER;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Get the character encoding to use for this connection.
|
||||
*/
|
||||
public Encoding getEncoding() throws SQLException
|
||||
@ -461,7 +461,7 @@ public abstract class Connection
|
||||
return encoding;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* This returns the Fastpath API for the current connection.
|
||||
*
|
||||
* <p><b>NOTE:</b> This is not part of JDBC, but allows access to
|
||||
@ -493,7 +493,7 @@ public abstract class Connection
|
||||
// This holds a reference to the Fastpath API if already open
|
||||
private Fastpath fastpath = null;
|
||||
|
||||
/**
|
||||
/*
|
||||
* This returns the LargeObject API for the current connection.
|
||||
*
|
||||
* <p><b>NOTE:</b> This is not part of JDBC, but allows access to
|
||||
@ -522,7 +522,7 @@ public abstract class Connection
|
||||
// This holds a reference to the LargeObject API if already open
|
||||
private LargeObjectManager largeobject = null;
|
||||
|
||||
/**
|
||||
/*
|
||||
* This method is used internally to return an object based around
|
||||
* org.postgresql's more unique data types.
|
||||
*
|
||||
@ -594,7 +594,7 @@ public abstract class Connection
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* This stores an object into the database.
|
||||
* @param o Object to store
|
||||
* @return OID of the new rectord
|
||||
@ -639,7 +639,7 @@ public abstract class Connection
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* This allows client code to add a handler for one of org.postgresql's
|
||||
* more unique data types.
|
||||
*
|
||||
@ -693,13 +693,13 @@ public abstract class Connection
|
||||
// These are required by other common classes
|
||||
public abstract java.sql.Statement createStatement() throws SQLException;
|
||||
|
||||
/**
|
||||
/*
|
||||
* This returns a resultset. It must be overridden, so that the correct
|
||||
* version (from jdbc1 or jdbc2) are returned.
|
||||
*/
|
||||
public abstract java.sql.ResultSet getResultSet(org.postgresql.Connection conn, java.sql.Statement stat, Field[] fields, Vector tuples, String status, int updateCount, int insertOID, boolean binaryCursor) throws SQLException;
|
||||
|
||||
/**
|
||||
/*
|
||||
* In some cases, it is desirable to immediately release a Connection's
|
||||
* database and JDBC resources instead of waiting for them to be
|
||||
* automatically released (cant think why off the top of my head)
|
||||
@ -726,7 +726,7 @@ public abstract class Connection
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* A driver may convert the JDBC sql grammar into its system's
|
||||
* native SQL grammar prior to sending it; nativeSQL returns the
|
||||
* native form of the statement that the driver would have sent.
|
||||
@ -741,7 +741,7 @@ public abstract class Connection
|
||||
return sql;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* The first warning reported by calls on this Connection is
|
||||
* returned.
|
||||
*
|
||||
@ -756,7 +756,7 @@ public abstract class Connection
|
||||
return firstWarning;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* After this call, getWarnings returns null until a new warning
|
||||
* is reported for this connection.
|
||||
*
|
||||
@ -768,7 +768,7 @@ public abstract class Connection
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
/*
|
||||
* You can put a connection in read-only mode as a hunt to enable
|
||||
* database optimizations
|
||||
*
|
||||
@ -783,7 +783,7 @@ public abstract class Connection
|
||||
this.readOnly = readOnly;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Tests to see if the connection is in Read Only Mode. Note that
|
||||
* we cannot really put the database in read only mode, but we pretend
|
||||
* we can by returning the value of the readOnly flag
|
||||
@ -796,7 +796,7 @@ public abstract class Connection
|
||||
return readOnly;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* If a connection is in auto-commit mode, than all its SQL
|
||||
* statements will be executed and committed as individual
|
||||
* transactions. Otherwise, its SQL statements are grouped
|
||||
@ -835,7 +835,7 @@ public abstract class Connection
|
||||
this.autoCommit = autoCommit;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* gets the current auto-commit state
|
||||
*
|
||||
* @return Current state of the auto-commit mode
|
||||
@ -847,7 +847,7 @@ public abstract class Connection
|
||||
return this.autoCommit;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* The method commit() makes all changes made since the previous
|
||||
* commit/rollback permanent and releases any database locks currently
|
||||
* held by the Connection. This method should only be used when
|
||||
@ -873,7 +873,7 @@ public abstract class Connection
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* The method rollback() drops all changes made since the previous
|
||||
* commit/rollback and releases any database locks currently held by
|
||||
* the Connection.
|
||||
@ -897,7 +897,7 @@ public abstract class Connection
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Get this Connection's current transaction isolation mode.
|
||||
*
|
||||
* @return the current TRANSACTION_* mode value
|
||||
@ -925,7 +925,7 @@ public abstract class Connection
|
||||
return java.sql.Connection.TRANSACTION_READ_COMMITTED;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* You can call this method to try to change the transaction
|
||||
* isolation level using one of the TRANSACTION_* values.
|
||||
*
|
||||
@ -972,7 +972,7 @@ public abstract class Connection
|
||||
ExecSQL(isolationLevelSQL);
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Helper method used by setTransactionIsolation(), commit(), rollback()
|
||||
* and setAutoCommit(). This returns the SQL string needed to
|
||||
* set the isolation level for a transaction. In 7.1 and later it
|
||||
@ -1007,7 +1007,7 @@ public abstract class Connection
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* A sub-space of this Connection's database may be selected by
|
||||
* setting a catalog name. If the driver does not support catalogs,
|
||||
* it will silently ignore this request
|
||||
@ -1019,7 +1019,7 @@ public abstract class Connection
|
||||
//no-op
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Return the connections current catalog name, or null if no
|
||||
* catalog name is set, or we dont support catalogs.
|
||||
*
|
||||
@ -1031,7 +1031,7 @@ public abstract class Connection
|
||||
return PG_DATABASE;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Overides finalize(). If called, it closes the connection.
|
||||
*
|
||||
* This was done at the request of Rachel Greenham
|
||||
@ -1051,7 +1051,7 @@ public abstract class Connection
|
||||
return versionParts.nextToken(); /* "X.Y.Z" */
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Get server version number
|
||||
*/
|
||||
public String getDBVersionNumber()
|
||||
@ -1064,7 +1064,7 @@ public abstract class Connection
|
||||
return (getDBVersionNumber().compareTo(ver) >= 0);
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* This method returns true if the compatible level set in the connection
|
||||
* (which can be passed into the connection or specified in the URL)
|
||||
* is at least the value passed to this method. This is used to toggle
|
||||
@ -1082,7 +1082,7 @@ public abstract class Connection
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
/*
|
||||
* This returns the java.sql.Types type for a PG type oid
|
||||
*
|
||||
* @param oid PostgreSQL type oid
|
||||
@ -1111,7 +1111,7 @@ public abstract class Connection
|
||||
return sqlType.intValue();
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* This returns the java.sql.Types type for a PG type
|
||||
*
|
||||
* @param pgTypeName PostgreSQL type name
|
||||
@ -1119,7 +1119,7 @@ public abstract class Connection
|
||||
*/
|
||||
public abstract int getSQLType(String pgTypeName);
|
||||
|
||||
/**
|
||||
/*
|
||||
* This returns the oid for a given PG data type
|
||||
* @param typeName PostgreSQL type name
|
||||
* @return PostgreSQL oid value for a field of this type
|
||||
@ -1150,7 +1150,7 @@ public abstract class Connection
|
||||
return oid;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* We also need to get the PG type name as returned by the back end.
|
||||
*
|
||||
* @return the String representation of the type of this field
|
||||
|
Reference in New Issue
Block a user