V4MD & Lingo: PNGs from directory into BLOB field

c3o at mail.c3o.org c3o at c3o.org
Thu Aug 28 09:21:39 CDT 2003


Hello,

I'm more or less a beginner at Lingo, and I'm desperately trying to
transfer files (PNGs) from a directory into a Valentina DB.

The code I've written (see bottom of mail, mainly copied from the manual
PDFs) produces no errors -- Valentina even says: * V4MD *:
Cursor_BLOB_WriteData...done -- but the "datacode" BLOB field remains Null.
As I understand it, I'm allocating the buffer and then writing it's content
to the database -- but never actually filling it. Is that correct? If so,
how can I fill it?
If it's not possible from within Director, can I maybe import the file into
something like mySQL and then import the data through ODBC?

I've searched high and low for any clues (or even sample code), but can't
find much.
I read an old thread on this list about saving QuickTime files into the DB,
in which somebody recommended using the binaryIO Xtra. Do I need this, and
how would it work?
I know Valentina has a #picture type for JPEGs which would probably make
things much easier, but in this case the files need to be PNG (because of
transparency).

I'd be really grateful for advice or newbie-friendly instructions.

Kind regards,
Christopher


----- [lingo] ------

 set gMyDataBase = new( xtra "VDataBase" )
  ValentinaDebugLevel(2)
  OpenDatabase(gMyDataBase, the moviePath & "lmp_lb.vdb")
  set gCursor = new( Xtra "VCursor", GetRef(gMyDataBase), "SELECT * FROM
data WHERE RecID =0")
  
  -- fileList[ ] is an array of filenames (full Windows path)
  
  repeat with i = 1 to fileList.count  
    importFileInto member(10), fileList[i]
    photoSize = member(10).size
    photoRef = MemBuffer_Allocate(photoSize)
    BLOB_WriteData(gCursor, "datacode", photoRef, photoSize)
    MemBuffer_Free(photoRef)
  end repeat

--------------------------------------------------------------------
mail2web - Check your email from the web at
http://mail2web.com/ .




More information about the Valentina mailing list