BLOB fields

Ruslan Zasukhin sunshine at public.kherson.ua
Tue Feb 11 09:41:27 CST 2003


on 2/11/03 5:26 PM, Barney at barney at custombased.com wrote:

> Hi,
> 
> I'm having some trouble getting to grips with the use of a blob field
> any help would be appreciated.
> 
> I'd like to :
> 
> 1.) create a BLOB field on the fly and populate it with a picture
> 
> 2.) delete it again or alternatively delete the picture from it.
> 
> Here is my effort thus far but it is not working ?
> 
> 
> Dim Blb as Vfield
> Dim Pfield as VBloB
> Dim p as picture
> Dim cur as Vcursor
> Dim BO as VBaseObject
> Dim err as boolean
> 
> 
> p = flag  // pict file
> 
> Bo = window1.db.Baseobject("Assets")

> Blb = Bo.Field("FlagFld")

> Pfield = new VBlob("FlagFld",2*1024)
    ^^^^^^^^^^^^ this line not needed

> If Blb = nil then
>   Blb = Bo.CreateBLOBField("FlagFld",2*1024)
> End if

    yes this is correct creation

> cur = window1.db.sqlselect("Select FlagFld from Assets")
> 
> If me.menuvalue = 0 then  //get rid of picture
>   cur.field("FlagFld").SetBlank
>   err = cur.updateAll()

    ^^^^^^^^^^ what is this ?
        You want delete all pictures in all records?
        This not correct. You need in loop iterate cursor and do
    
    for
       cur.field("FlagFld").DeleteBLOB
       cur.Update
    end

> Elseif me.menuvalue = 1 then   //set picture into all records
>   Pfield.SetPicture(p)
>   err = cur.UpdateAll()
> 
> End if

    Again not correct.
    UpdateAl() must not be used with BLOB fields


> Should I be using a cursor to achieve this ?
> 
> Having successfully set a picture into all records, should I expect to see
> a second valantina database file somewhere holding the data ?
> 
> Also, I don't really understand the segment size bit. How do you know what
> to set this at. Is this something that depends on the size of the picture
> file ? In this case its 4k.

In ideal, it must be close to AVERAGE SIZE of pictures you store.

-- 
Best regards,
Ruslan Zasukhin      [ I feel the need...the need for speed ]
-------------------------------------------------------------
e-mail: ruslan at paradigmasoft.com
web: http://www.paradigmasoft.com

To subscribe to the Valentina mail list go to:
http://listserv.macserve.net/mailman/listinfo/valentina
-------------------------------------------------------------



More information about the Valentina mailing list