BLOB fields

Barney barney at custombased.com
Wed Feb 12 04:26:29 CST 2003


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)
  
  If Blb = nil then
    Blb = Bo.CreateBLOBField("FlagFld",2*1024)
  End if
  cur = window1.db.sqlselect("Select FlagFld from Assets")
  
  If me.menuvalue = 0 then  //get rid of picture
    cur.field("FlagFld").SetBlank
    err = cur.updateAll()

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

  End if
  
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.

Thanks

Barney








More information about the Valentina mailing list