Re: Add checking in setMaxRows, setQueryTimeout, and setFetchSize - Mailing list pgsql-patches

From Barry Lind
Subject Re: Add checking in setMaxRows, setQueryTimeout, and setFetchSize
Date
Msg-id 3F0067ED.30502@xythos.com
Whole thread Raw
In response to Add checking in setMaxRows, setQueryTimeout, and setFetchSize  (Kim Ho <kho@redhat.com>)
List pgsql-patches
Patch applied.

--Barry

Kim Ho wrote:
> Problem:
>  - If you try to setMaxRows(), setQueryTimeout() or setFetchSize()
> to negative values, it should throw an exception, but doesn't. JDBC CTS
> test failures.
>
> Fix:
>  - Added new error messages to errors.properties file.
>  - PSQLExceptions thrown when user attempts to set negative values.
>
> Cheers,
>
> Kim
>
>
>
>
> ------------------------------------------------------------------------
>
> ? cloudscape.LOG
> Index: org/postgresql/errors.properties
> ===================================================================
> RCS file: /projects/cvsroot/pgsql-server/src/interfaces/jdbc/org/postgresql/errors.properties,v
> retrieving revision 1.20
> diff -c -p -c -p -r1.20 errors.properties
> *** org/postgresql/errors.properties    29 May 2003 03:21:32 -0000    1.20
> --- org/postgresql/errors.properties    18 Jun 2003 12:38:29 -0000
> *************** postgresql.call.funcover:Cannot execute
> *** 97,99 ****
> --- 97,102 ----
>   postgresql.call.wrongget:Parameter of type {0} was registered but call to get{1} (sqltype={2}) was made.
>   postgresql.call.noreturnval:A CallableStatement Function was executed with nothing returned.
>   postgresql.call.wrongrtntype:A CallableStatement Function was executed and the return was of type ({0}) however
type={1}was registered. 
> + postgresql.input.fetch.gt0:Fetch size must be a value greater than or equal to 0.
> + postgresql.input.query.gt0:Query Timeout must be a value greater than or equal to 0.
> + postgresql.input.rows.gt0:Maximum number of rows must be a value greater than or equal to 0.
> Index: org/postgresql/jdbc1/AbstractJdbc1Statement.java
> ===================================================================
> RCS file: /projects/cvsroot/pgsql-server/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java,v
> retrieving revision 1.24
> diff -c -p -c -p -r1.24 AbstractJdbc1Statement.java
> *** org/postgresql/jdbc1/AbstractJdbc1Statement.java    29 May 2003 04:52:44 -0000    1.24
> --- org/postgresql/jdbc1/AbstractJdbc1Statement.java    18 Jun 2003 12:38:30 -0000
> *************** public abstract class AbstractJdbc1State
> *** 554,559 ****
> --- 554,560 ----
>        */
>       public void setMaxRows(int max) throws SQLException
>       {
> +         if (max<0) throw new PSQLException("postgresql.input.rows.gt0");
>           maxrows = max;
>       }
>
> *************** public abstract class AbstractJdbc1State
> *** 590,595 ****
> --- 591,597 ----
>        */
>       public void setQueryTimeout(int seconds) throws SQLException
>       {
> +         if (seconds<0) throw new PSQLException("postgresql.input.query.gt0");
>           timeout = seconds;
>       }
>
> Index: org/postgresql/jdbc2/AbstractJdbc2Statement.java
> ===================================================================
> RCS file: /projects/cvsroot/pgsql-server/src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2Statement.java,v
> retrieving revision 1.14
> diff -c -p -c -p -r1.14 AbstractJdbc2Statement.java
> *** org/postgresql/jdbc2/AbstractJdbc2Statement.java    29 May 2003 04:52:44 -0000    1.14
> --- org/postgresql/jdbc2/AbstractJdbc2Statement.java    18 Jun 2003 12:38:30 -0000
> *************** public abstract class AbstractJdbc2State
> *** 151,156 ****
> --- 151,157 ----
>
>       public void setFetchSize(int rows) throws SQLException
>       {
> +         if (rows<0) throw new PSQLException("postgresql.input.fetch.gt0");
>           super.fetchSize = rows;
>       }
>
>
>
> ------------------------------------------------------------------------
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 8: explain analyze is your friend



pgsql-patches by date:

Previous
From: Josh Berkus
Date:
Subject: Postgresql.conf, initdb patch
Next
From: Barry Lind
Date:
Subject: Re: [JDBC] IPv6 patch doesn't work fine