1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-28 18:48:04 +03:00

Some more including the patch to DatabaseMetaData backed out by Bruce.

Tue Feb 13 16:33:00 GMT 2001 peter@retep.org.uk
        - More TestCases implemented. Refined the test suite api's.
        - Removed need for SimpleDateFormat in ResultSet.getDate() improving
          performance.
        - Rewrote ResultSet.getTime() so that it uses JDK api's better.

Tue Feb 13 10:25:00 GMT 2001 peter@retep.org.uk
        - Added MiscTest to hold reported problems from users.
        - Fixed PGMoney.
        - JBuilder4/JDBCExplorer now works with Money fields. Patched Field &
          ResultSet (lots of methods) for this one. Also changed cash/money to
          return type DOUBLE not DECIMAL. This broke JBuilder as zero scale
          BigDecimal's can't have decimal places!
        - When a Statement is reused, the previous ResultSet is now closed.
        - Removed deprecated call in ResultSet.getTime()

Thu Feb 08 18:53:00 GMT 2001 peter@retep.org.uk
        - Changed a couple of settings in DatabaseMetaData where 7.1 now
          supports those features
        - Implemented the DatabaseMetaData TestCase.

Wed Feb 07 18:06:00 GMT 2001 peter@retep.org.uk
        - Added comment to Connection.isClosed() explaining why we deviate from
          the JDBC2 specification.
        - Fixed bug where the Isolation Level is lost while in autocommit mode.
        - Fixed bug where several calls to getTransactionIsolationLevel()
          returned the first call's result.
This commit is contained in:
Peter Mount
2001-02-13 16:39:06 +00:00
parent 2410963e8c
commit 3d21bf82c3
17 changed files with 1149 additions and 103 deletions

View File

@@ -10,7 +10,7 @@ import java.sql.*;
*
* PS: Do you know how difficult it is to type on a train? ;-)
*
* $Id: ConnectionTest.java,v 1.1 2001/02/07 09:13:20 peter Exp $
* $Id: ConnectionTest.java,v 1.2 2001/02/13 16:39:05 peter Exp $
*/
public class ConnectionTest extends TestCase {
@@ -127,7 +127,7 @@ public class ConnectionTest extends TestCase {
}
/**
* Simple test to see if isClosed works
* Simple test to see if isClosed works.
*/
public void testIsClosed() {
try {
@@ -146,4 +146,92 @@ public class ConnectionTest extends TestCase {
}
}
/**
* Test the warnings system
*/
public void testWarnings() {
try {
Connection con = JDBC2Tests.openDB();
String testStr = "This Is OuR TeSt message";
// The connection must be ours!
assert(con instanceof org.postgresql.Connection);
// Clear any existing warnings
con.clearWarnings();
// Set the test warning
((org.postgresql.Connection)con).addWarning(testStr);
// Retrieve it
SQLWarning warning = con.getWarnings();
assert(warning!=null);
assert(warning.getMessage().equals(testStr));
// Finally test clearWarnings() this time there must be something to delete
con.clearWarnings();
assert(con.getWarnings()==null);
JDBC2Tests.closeDB(con);
} catch(SQLException ex) {
assert(ex.getMessage(),false);
}
}
/**
* Transaction Isolation Levels
*/
public void testTransactionIsolation() {
try {
Connection con = JDBC2Tests.openDB();
con.setAutoCommit(false);
// These are the currently available ones
con.setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE);
assert(con.getTransactionIsolation()==Connection.TRANSACTION_SERIALIZABLE);
con.setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
assert(con.getTransactionIsolation()==Connection.TRANSACTION_READ_COMMITTED);
// Now turn on AutoCommit. Transaction Isolation doesn't work outside of
// a transaction, so they should return READ_COMMITTED at all times!
con.setAutoCommit(true);
con.setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE);
assert(con.getTransactionIsolation()==Connection.TRANSACTION_READ_COMMITTED);
con.setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
assert(con.getTransactionIsolation()==Connection.TRANSACTION_READ_COMMITTED);
JDBC2Tests.closeDB(con);
} catch(SQLException ex) {
assert(ex.getMessage(),false);
}
}
/**
* JDBC2 Type mappings
*/
public void testTypeMaps() {
try {
Connection con = JDBC2Tests.openDB();
// preserve the current map
java.util.Map oldmap = con.getTypeMap();
// now change it for an empty one
java.util.Map newmap = new java.util.HashMap();
con.setTypeMap(newmap);
assert(con.getTypeMap()==newmap);
// restore the old one
con.setTypeMap(oldmap);
assert(con.getTypeMap()==oldmap);
JDBC2Tests.closeDB(con);
} catch(SQLException ex) {
assert(ex.getMessage(),false);
}
}
}