[pgsql-jp: 27244] Re: JDBCでgetlastoid

Hiroyuki OYAMA oyama @ crayfish.co.jp
2002年 9月 2日 (月) 14:57:20 JST


クレイフィッシュの小山です。

org.postgresql.ResultSet.javaのこの辺でしょうか。

        /*
         * returns the OID of the last inserted row.  Deprecated in 7.2 because
         * range for OID values is greater than java signed int.
         * @deprecated Replaced by getLastOID() in 7.2
         */
        public int getInsertedOID()
        {
            return (int) getLastOID();
        }


        /*
         * returns the OID of the last inserted row
         * @since 7.2
         */
        public long getLastOID()
        {
                return insertOID;
        }


org.postgresql.Statement.javaにもありますね。

        /*
         * Returns the Last inserted/updated oid.  Deprecated in 7.2 because
         * range of OID values is greater than a java signed int.
         * @deprecated Replaced by getLastOID in 7.2
         */
        public int getInsertedOID() throws SQLException
        {
                if (result == null)
                        return 0;
                return (int)((org.postgresql.ResultSet) result).getLastOID();
        }

        /*
         * Returns the Last inserted/updated oid.
         * @return OID of last insert
         * @since 7.2
         */
        public long getLastOID() throws SQLException
        {
                if (result == null)
                        return 0;
                return ((org.postgresql.ResultSet) result).getLastOID();
        }


On Sun, 01 Sep 2002 15:28:54 +0900
naoki kishida <kishida @ fk.urban.ne.jp> wrote:
> JDBC接続でJavaからPostgreSQLに接続しているときに、直前にinsertした行の
> OIDを得るにはどうすればよいでしょうか?
______________
Hiroyuki OYAMA <oyama @ crayfish.co.jp>
System Operations Dept.
Crayfish Co.,Ltd. <http://Crayfish.CO.JP/>
  "超軽量Weblog(日記)ツールできました。"
   -> http://mod-blosxom.sourceforge.net/ja/





pgsql-jp メーリングリストの案内