Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> OO4O, BLOB, AddNew and "Row must be locked"

OO4O, BLOB, AddNew and "Row must be locked"

From: Wiwo <wolfgang.wirner_at_web.de>
Date: 23 Dec 2005 01:01:31 -0800
Message-ID: <1135327799.700101.278510@g44g2000cwa.googlegroups.com>


Hi there,

I have no success with inserting a BLOB into a new record. I always get the message "Row must be locked for this operation". My code:

create table TEST (

        MYBLOB blob default empty_blob()
);

    Dim objOraSession As OraSession
    Dim objOraDatabase As OraDatabase
    Dim objOraDynaset As OraDynaset
    Dim objOraField As OraField
    Dim objOraBlob As OraBlob

    Set objOraSession = New OraSessionClass     Set objOraDatabase = objOraSession.OpenDatabase("database", "user/password", 2)

    Set objOraDynaset = objOraDatabase.CreateDynaset("SELECT * FROM test", 2)

    Set objOraField = objOraDynaset.Fields("myblob")     Set objOraBlob = objOraField.value

    objOraDatabase.BeginTrans
    objOraDynaset.AddNew
    objOraBlob.CopyFromFile "d:\test.txt"     objOraDynaset.Update
    objOraDatabase.CommitTrans

When I first save the record and then use objOraDynset.Edit the operation succeeds. But I can't use this design in my application, I need to do all in one transaction, and the new record is only usable after commiting the transaction. Otherwise I will not be able to rolback the whole changes.

So is there no way to lock a row when I use AddNew or is there another possibilty to do this?

Many thanks for your help
Wiwo Received on Fri Dec 23 2005 - 03:01:31 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US