From: | Kris Jurka <jurka(at)ejurka(dot)com> |
---|---|
To: | Olaf Liepelt <olafl(at)comrad(dot)co(dot)nz> |
Cc: | pgsql-jdbc(at)postgresql(dot)org, pgsql-patches(at)postgresql(dot)org |
Subject: | Re: not fully fixed |
Date: | 2002-11-04 04:40:58 |
Message-ID: | 3DC5FA5A.8F04EB0F@ejurka.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc pgsql-patches |
The previous patch for using an updateable result set to set null values
was incomplete because it only handled the storing of the database
values, while not properly updating the in memory result during
updateRowBuffer(). While the blob case actually threw an exception, no
other case really worked correctly.
Thanks for the complete example that makes debugging so much easier. In
the future please post problems to the pgsql-jdbc(at)postgresql(dot)org list
instead of me personally. This will ensure the problem is dealt with if
I am busy or away.
Kris Jurka
Olaf Liepelt wrote:
>
> The bugfix for updating result sets with null values does not work for blob dataypes:
>
> code:
>
> public class PGTest {
> public static void main(String args[])
> throws Exception
> {
> String sql = "create table t(a serial primary key, b int, c bytea)";
> Class.forName("org.postgresql.Driver");
> Connection conn = DriverManager.getConnection("jdbc:postgresql://localhost:5432/test", "comrad", "");
> try
> {
> Statement stmt = conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
> stmt.executeUpdate(sql);
> sql = "INSERT INTO t (a, b) VALUES (3, 4)";
> stmt.executeUpdate(sql);
> stmt.close();
> } catch (SQLException sqle)
> {
> sqle.printStackTrace();
> }
>
> try
> {
> sql = "select * from t for update";
> Statement stmt = conn.createStatement();
> ResultSet rs = stmt.executeQuery(sql);
> rs.next();
> rs.updateObject("a", new Integer(2));
> rs.updateNull("c");
> rs.updateRow();
> conn.commit();
> } catch (SQLException sqle)
> {
> sqle.printStackTrace();
> }
>
> Statement stmt = conn.createStatement();
> stmt.executeUpdate("DROP TABLE t");
> stmt.executeUpdate("DROP sequence t_a_seq");
> stmt.close();
> conn.close();
> }
> }
>
> Thank for quick response last time.
> Regards Olaf
Attachment | Content-Type | Size |
---|---|---|
updatersnull.patch | text/plain | 2.4 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Dave Cramer | 2002-11-04 04:43:24 | Re: Importing data into the database using JDBC |
Previous Message | Dror Matalon | 2002-11-04 04:30:49 | Re: Importing data into the database using JDBC |
From | Date | Subject | |
---|---|---|---|
Next Message | Barry Lind | 2002-11-04 07:44:48 | Re: DatabaseMetaData.getTables() problem |
Previous Message | Kris Jurka | 2002-11-02 22:26:22 | Re: DatabaseMetaData.getTables() problem |