Arno
You have to re-query to get inserted/updated values. However there's a
non-standard way of getting auto-inc values. Have a look at:
http://instantdb.enhydra.org/software/documentation/jdbc.html
for details.
Regards
Peter Hearty
Lutris Technologies UK Ltd.
-----Original Message-----
From: Arno Schatz <arno@lutris.com>
To: instantDB <instantDB@enhydra.org>
Date: 10 May 2000 23:05
Subject: InstantDB: insert detection
>Hi,
>
>I was trying to insert a row into a resultset and read this row immediatly,
>without querying the DB again. Is this supposed to work in instantDB? See
>the code below.
>
>As you might see in the code example below, I am trying to get the id-value
>of a table where the id-column is marked as AUTO INCREMENT. Is there a
smart
>way to do this?
>
>
>Connection con = Transact.getConnection ();
>Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
> ResultSet.CONCUR_UPDATABLE);
>
>ResultSet uprs = stmt.executeQuery("SELECT * FROM usr");
>uprs.moveToInsertRow();
>uprs.updateString(2,"number 2");
>uprs.updateString(3,"jhjh");
>uprs.updateByte(4, (byte) 0);
>
>uprs.insertRow();
>uprs.moveToCurrentRow();
>System.out.println("iserted"+uprs.rowInserted());
>
>int id = uprs.getInt(1);
>System.out.println("id="+id);
>
>======
>id is always returned as null
>
>-Arno
>
>---------------------------------------------------------------------------
--
>To unsubscribe from this mailing list, send email to majordomo@enhydra.org
>with the text "unsubscribe instantdb" in the body of the email.
>If you have other questions regarding this mailing list, send email to
>the list admin at owner-instantdb@enhydra.org.
-----------------------------------------------------------------------------
To unsubscribe from this mailing list, send email to majordomo@enhydra.org
with the text "unsubscribe instantdb" in the body of the email.
If you have other questions regarding this mailing list, send email to
the list admin at owner-instantdb@enhydra.org.
|