JDBC changes for 7.2... some questions...
От | Ned Wolpert |
---|---|
Тема | JDBC changes for 7.2... some questions... |
Дата | |
Msg-id | XFMail.20010821130615.ned.wolpert@knowledgenet.com обсуждение исходный текст |
Ответы |
Re: JDBC changes for 7.2... some questions...
Re: JDBC changes for 7.2... some questions... |
Список | pgsql-jdbc |
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Folks- I'm looking into some modifications for the Castor project on how we get identies from inserted objects into the database. Specifically, if we have used the SERIAL type to link in a sequence number during row insertion, it would be great to get that sequence number when we do the insert. Both Oracle and mssql have something to provide this. Getting the OID would be second-best solution for us. Now, I understand that in the Statement class, we have getInsertedOID() in the table. However, the problem we run into is that this isn't accessiable if we use something like poolman to provide database pooling of connections. (You get the poolMan Statement object which is wraps the Statement classes of the driver.) So, what I'm looking for is some of the following ways to get the primary key back, or the OID if nothing else... 1) Being able to use the RETURNING clause in prepared statements, like this "INSERT INTO tableName (key1,...) VALUES (value1,...) RETURNING primKeyName INTO ?" Which is what Oracle provides. 2) Working like Sybase and call "select @@OID" on the next call, which would be trapped by the statment object to return a resultset with the oid of the last inserted oid. 3) or, someother way that where one doesn't need direct access to method calls to get 'getInsertedOID()', but indirect ones. Thoughts? Virtually, Ned Wolpert <ned.wolpert@knowledgenet.com> D08C2F45: 28E7 56CB 58AC C622 5A51 3C42 8B2B 2739 D08C 2F45 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE7gr83iysnOdCML0URAj+QAJ91RZXOoEA+xnu68YhIA4euNfIWOgCfcG1/ 5L5ATkdL/wPwTnbQy0NI2jI= =l/7B -----END PGP SIGNATURE-----
В списке pgsql-jdbc по дате отправления: