This is an automated email from the git hooks/post-receive script.

ebourg-guest pushed a commit to tag REL7_4_1
in repository libpostgresql-jdbc-java.

commit f93dbdeda53b9436eb716531fb6c468febb0603c
Author: Dave Cramer <[email protected]>
Date:   Thu Dec 11 03:59:37 2003 +0000

    patch to make PSQLState serializable, and a test case for it
    added a test case for getLastOID
---
 org/postgresql/test/jdbc2/MiscTest.java | 39 +++++++++++++++++++++++++++++++--
 org/postgresql/util/PSQLState.java      |  2 +-
 2 files changed, 38 insertions(+), 3 deletions(-)

diff --git a/org/postgresql/test/jdbc2/MiscTest.java 
b/org/postgresql/test/jdbc2/MiscTest.java
index 95ea077..32cd482 100644
--- a/org/postgresql/test/jdbc2/MiscTest.java
+++ b/org/postgresql/test/jdbc2/MiscTest.java
@@ -3,6 +3,7 @@ package org.postgresql.test.jdbc2;
 import org.postgresql.test.TestUtil;
 import junit.framework.TestCase;
 import java.sql.*;
+import java.io.*;
 
 /*
  * $Id$
@@ -65,8 +66,18 @@ public class MiscTest extends TestCase
                        fail( "Should not execute this, as a SQLException s/b 
thrown" );
                        con.commit();
                }
-               catch ( Exception ex )
-               {}
+               catch ( SQLException ex )
+               {
+                       // Verify that the SQLException is serializable.
+                       try {
+                               ByteArrayOutputStream baos = new 
ByteArrayOutputStream();
+                               ObjectOutputStream oos = new 
ObjectOutputStream(baos);
+                               oos.writeObject(ex);
+                               oos.close();
+                       } catch (IOException ioe) {
+                               fail(ioe.getMessage());
+                       }
+               }
                try
                {
                        con.commit();
@@ -75,7 +86,31 @@ public class MiscTest extends TestCase
                catch ( Exception ex)
                {}
        }
+       public void testLastOID()
+       {
+               Connection con = null;
+               try
+               {
+                       con = TestUtil.openDB();
+                       TestUtil.createTable( con, "testoid","id int");
 
+                       Statement stmt = con.createStatement();
+                       con.setAutoCommit(false);
+                       stmt.executeUpdate( "insert into testoid values (1)" );
+                       con.commit();
+                       long insertedOid = 
((org.postgresql.PGStatement)stmt).getLastOID();
+                       con.setAutoCommit(true);
+                       TestUtil.dropTable( con, "testoid");
+               }
+               catch ( Exception ex )
+               {
+                       fail( ex.getMessage() );
+               }
+               finally
+               {
+                       try{if (con !=null )con.close();}catch(Exception ex){}
+               }
+       }
        public void xtestLocking()
        {
 
diff --git a/org/postgresql/util/PSQLState.java 
b/org/postgresql/util/PSQLState.java
index 152170e..b1d1efa 100644
--- a/org/postgresql/util/PSQLState.java
+++ b/org/postgresql/util/PSQLState.java
@@ -10,7 +10,7 @@
  
  package org.postgresql.util;
  
- public class PSQLState
+ public class PSQLState implements java.io.Serializable
  {
        private String state;
        

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-java/libpostgresql-jdbc-java.git

_______________________________________________
pkg-java-commits mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-java-commits

Reply via email to