Re: JDBC Driver - Batch Prepared Statements

From: Barry Lind <barry(at)xythos(dot)com>
To: Kris Jurka <jurka(at)ejurka(dot)com>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: JDBC Driver - Batch Prepared Statements
Date: 2002-09-10 17:45:20
Message-ID: 3D7E2FB0.80109@xythos.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-patches by date

  From Date Subject
Next Message Kris Jurka 2002-09-10 19:22:22 JDBC Driver - Test Suite Drop w/ Cascase + optional jdbc2
Previous Message Bruno Wolff III 2002-09-10 13:45:02 Re: cube and earthdistance diffs