From: David J. <d_j...@us...> - 2001-05-25 19:52:55
|
Update of /cvsroot/firebird/client-java/src/org/firebirdsql/jdbc In directory usw-pr-cvs1:/tmp/cvs-serv3917 Modified Files: FBConnection.java FBStatement.java FBXAResource.java Log Message: First steps towards sql functionality Index: FBConnection.java =================================================================== RCS file: /cvsroot/firebird/client-java/src/org/firebirdsql/jdbc/FBConnection.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -U3 -r1.1.1.1 -r1.2 --- FBConnection.java 2001/05/09 14:24:17 1.1.1.1 +++ FBConnection.java 2001/05/25 19:52:52 1.2 @@ -34,6 +34,8 @@ import java.sql.SQLWarning; import java.sql.Statement; +import org.firebirdsql.jca.FBManagedConnection; + //import javax.resource.cci.Connection;--can't import, two classes with same name. @@ -45,7 +47,7 @@ * @version $ $ */ -//Note that this connection class is only a handle to a XAConnection. +//Note that this connection class is only a handle to a ManagedConnection. /** * <P>A connection (session) with a specific * database. Within the context of a Connection, SQL statements are @@ -69,6 +71,16 @@ * Methods that are new in the JDBC 2.0 API are tagged @since 1.2. */ public class FBConnection implements Connection/*, javax.resource.cci.Connection*/ { + + FBManagedConnection mc; + + public FBConnection(FBManagedConnection mc) { + this.mc = mc; + } + + public void setManagedConnection(FBManagedConnection mc) { + this.mc = mc; + } /** * Creates a <code>Statement</code> object for sending @@ -86,7 +98,7 @@ * @exception SQLException if a database access error occurs */ public Statement createStatement() throws SQLException { - return null; + return new FBStatement(mc); } Index: FBStatement.java =================================================================== RCS file: /cvsroot/firebird/client-java/src/org/firebirdsql/jdbc/FBStatement.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -U3 -r1.1.1.1 -r1.2 --- FBStatement.java 2001/05/09 14:26:29 1.1.1.1 +++ FBStatement.java 2001/05/25 19:52:52 1.2 @@ -32,6 +32,9 @@ import java.sql.SQLException; import java.sql.SQLWarning; +import org.firebirdsql.jca.FBManagedConnection; +import org.firebirdsql.gds.GDSException; + /** * * @see <related> @@ -56,6 +59,12 @@ * @see ResultSet */ public class FBStatement implements Statement { + + private FBManagedConnection mc; + + FBStatement(FBManagedConnection mc) { + this.mc = mc; + } /** * Executes an SQL statement that returns a single <code>ResultSet</code> object. @@ -314,7 +323,12 @@ * @see #getMoreResults */ public boolean execute(String sql) throws SQLException { - throw new SQLException("Not yet implemented"); + try { + return mc.executeSQL(sql); + } + catch (GDSException ge) { + throw new SQLException("GDS exception: " + ge.toString()); + } } Index: FBXAResource.java =================================================================== RCS file: /cvsroot/firebird/client-java/src/org/firebirdsql/jdbc/FBXAResource.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -U3 -r1.1.1.1 -r1.2 --- FBXAResource.java 2001/05/09 14:24:28 1.1.1.1 +++ FBXAResource.java 2001/05/25 19:52:52 1.2 @@ -45,15 +45,13 @@ public class FBXAResource implements XAResource { // private FBManagedConnection fbmc; -// private Xid current; private boolean active = false; private int timeout_ignored = 0; -// private Object kb = null;//knowledgebase -// public FBXAResource(FBManagedConnection fbmc) { -// this.fbmc = fbmc; -// } +/* public FBXAResource(FBManagedConnection fbmc) { + this.fbmc = fbmc; + }*/ /** |