Re: JDBC Driver - Batch Prepared Statements - Mailing list pgsql-patches

From Barry Lind
Subject Re: JDBC Driver - Batch Prepared Statements
Date
Msg-id 3D7E2FB0.80109@xythos.com
Whole thread Raw
In response to JDBC Driver - Batch Prepared Statements  (Kris Jurka <jurka@ejurka.com>)
List pgsql-patches
Kris,

Thanks very much for the patches you have been submitting over the last
couple of days.  I will work on getting them applied today.

--Barry


Kris Jurka wrote:
>
> The code in AbstractJbc1Statement: execute(String sql) and
> executeUpdate(sql) was setting m_sqlFragments while ignoring m_binds.
> This caused Batch Prepared Statements to fail becuase while at one point
> the statement had binds, executeBatch turned the PreparedStatement into
> a plain String without removing the binds.  I don't know why this wasn't
> causing an IndexOutOfBoundsException in the QueryExecutor at or about
> line 144, but this seems to fix it.
>
> It seems like m_bindTypes, m_origSqlFragments, m_executeSqlFragments
> might need to be reset as well, but this at least gets the regression
> tests to pass.
>
> Kris Jurka
>
>
> ------------------------------------------------------------------------
>
> Index: src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java
> ===================================================================
> RCS file: /projects/cvsroot/pgsql-server/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java,v
> retrieving revision 1.8
> diff -c -r1.8 AbstractJdbc1Statement.java
> *** src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java    2002/09/08 00:15:29    1.8
> --- src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java    2002/09/10 00:15:35
> ***************
> *** 170,175 ****
> --- 170,176 ----
>       {
>           String l_sql = replaceProcessing(p_sql);
>           m_sqlFragments = new String[] {l_sql};
> +         m_binds = new Object[0];
>           //If we have already created a server prepared statement, we need
>           //to deallocate the existing one
>           if (m_statementName != null) {
> ***************
> *** 213,218 ****
> --- 214,220 ----
>       {
>           String l_sql = replaceProcessing(p_sql);
>           m_sqlFragments = new String[] {l_sql};
> +         m_binds = new Object[0];
>           //If we have already created a server prepared statement, we need
>           //to deallocate the existing one
>           if (m_statementName != null) {
>
>
> ------------------------------------------------------------------------
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster


pgsql-patches by date:

Previous
From: Bruno Wolff III
Date:
Subject: Re: cube and earthdistance diffs
Next
From: Kris Jurka
Date:
Subject: JDBC Driver - Test Suite Drop w/ Cascase + optional jdbc2