From d87a15cc0076071bc4501bbeece802e1b8616585 Mon Sep 17 00:00:00 2001 From: Warren Levy Date: Thu, 29 Jun 2000 23:20:33 +0000 Subject: * java/math/BigDecimal.java (add): Reimplemented. (subtract): Corrected method name from 'substract'. Reimplemented. * java/sql/Connection.java (TRANSACTION_SERIALIZABLE): Corrected spelling to match JDK spec. * java/sql/DatabaseMetaData.java (getIdentifierQuoteString): Corrected method name from 'getIdentiferQuoteString'. (getTimeDateFunctions): Corrected name to match the spec. (supportsCatalogsInPrivilegeDefinitions): Ditto. (getMaxUserNameLength): Ditto. (getTables): Added String types[] parameter to match the spec. * java/sql/Driver.java (getMajorVersion): Corrected method name. * java/sql/PreparedStatement.java: Class extends Statement. (setBigDecimal): New method. (setAsciiStream): Added int length parameter. (setUnicodeStream): Ditto. (setBinaryStream): Ditto. (setCharacterStream): Ditto. (execute): New method. (executeQuery): New method. (executeUpdate): New method. Mods to match the JDK spec (and to fix BigDecimal bugs). --- java/sql/PreparedStatement.java | 72 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 65 insertions(+), 7 deletions(-) (limited to 'java/sql/PreparedStatement.java') diff --git a/java/sql/PreparedStatement.java b/java/sql/PreparedStatement.java index 14b9fe791..bce94d280 100644 --- a/java/sql/PreparedStatement.java +++ b/java/sql/PreparedStatement.java @@ -1,5 +1,5 @@ /* PreparedStatement.java -- Interface for pre-compiled statements. - Copyright (C) 1999 Free Software Foundation, Inc. + Copyright (C) 1999, 2000 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -40,7 +40,7 @@ import java.util.Calendar; * * @author Aaron M. Renn (arenn@urbanophile.com) */ -public abstract interface PreparedStatement +public abstract interface PreparedStatement extends Statement { /** @@ -198,6 +198,20 @@ setBytes(int index, byte[] value) throws SQLException; /*************************************************************************/ +/** + * This method sets the specified parameter from the given Java + * java.math.BigDecimal value. + * + * @param index The index of the parameter value to set. + * @param value The value of the parameter. + * + * @exception SQLException If an error occurs. + */ +public abstract void +setBigDecimal(int index, java.math.BigDecimal value) throws SQLException; + +/*************************************************************************/ + /** * This method sets the specified parameter from the given Java * java.sql.Date value. @@ -292,12 +306,12 @@ setTimestamp(int index, java.sql.Timestamp value, Calendar calendar) * * @param index The index of the parameter value to set. * @param value The value of the parameter. - * @param calendar The Calendar to use for timezone and locale. + * @param length The number of bytes in the stream. * * @exception SQLException If an error occurs. */ public abstract void -setAsciiStream(int index, InputStream value) throws SQLException; +setAsciiStream(int index, InputStream value, int length) throws SQLException; /*************************************************************************/ @@ -307,11 +321,12 @@ setAsciiStream(int index, InputStream value) throws SQLException; * * @param index The index of the parameter value to set. * @param value The value of the parameter. + * @param length The number of bytes in the stream. * * @exception SQLException If an error occurs. */ public abstract void -setUnicodeStream(int index, InputStream value) throws SQLException; +setUnicodeStream(int index, InputStream value, int length) throws SQLException; /*************************************************************************/ @@ -321,11 +336,12 @@ setUnicodeStream(int index, InputStream value) throws SQLException; * * @param index The index of the parameter value to set. * @param value The value of the parameter. + * @param length The number of bytes in the stream. * * @exception SQLException If an error occurs. */ public abstract void -setBinaryStream(int index, InputStream value) throws SQLException; +setBinaryStream(int index, InputStream value, int length) throws SQLException; /*************************************************************************/ @@ -335,11 +351,12 @@ setBinaryStream(int index, InputStream value) throws SQLException; * * @param index The index of the parameter value to set. * @param value The value of the parameter. + * @param length The number of bytes in the stream. * * @exception SQLException If an error occurs. */ public abstract void -setCharacterStream(int index, Reader value) throws SQLException; +setCharacterStream(int index, Reader value, int length) throws SQLException; /*************************************************************************/ @@ -474,5 +491,46 @@ clearParameters() throws SQLException; public abstract ResultSetMetaData getMetaData() throws SQLException; +/*************************************************************************/ + +/** + * This method executes a prepared SQL query. + * Some prepared statements return multiple results; the execute method + * handles these complex statements as well as the simpler form of + * statements handled by executeQuery and executeUpdate. + * + * @return The result of the SQL statement. + * + * @exception SQLException If an error occurs. + */ +public abstract boolean +execute() throws SQLException; + +/*************************************************************************/ + +/** + * This method executes a prepared SQL query and returns its ResultSet. + * + * @return The ResultSet of the SQL statement. + * + * @exception SQLException If an error occurs. + */ +public abstract ResultSet +executeQuery() throws SQLException; + +/*************************************************************************/ + +/** + * This method executes an SQL INSERT, UPDATE or DELETE statement. SQL + * statements that return nothing such as SQL DDL statements can be executed. + * + * @return The result is either the row count for INSERT, UPDATE or DELETE + * statements; or 0 for SQL statements that return nothing. + * + * @exception SQLException If an error occurs. + */ +public abstract int +executeUpdate() throws SQLException; + } // interface PreparedStatement -- cgit v1.2.1