V4RB BLOB HELP!
Ruslan Zasukhin
sunshine at public.kherson.ua
Wed Mar 12 10:47:31 CST 2003
on 3/12/03 2:36 AM, Jason Moehlman at jmoehlma at moehlman.com wrote:
> Hello all,
>
> I was wondering if anyone has had any luck with BLOB jpeg fields. The
> last step in a conversion project from RealDB to V4RB is to get the
> images code converted.
>
> Everything else has been extremely straight forward. I have read the
> tutorial and reference code on V4RB BLOB/Picture, but no luck.
>
> There are no errors during the reading or writing, the canvas object is
> populated initially with a drag/drop event. The image is there
> initially but once the update takes place and the record pointer is
> moved and the data read back there is nothing in the BLOB field.
>
> The included RealDB code works fine.
>
> The db_images() is a canvas object. The image is a JPEG.
>
> rsdb is a record set, vcdb is a VCURSOR.
>
> RealDB writing to DB
> rsdb.field(db_images(i).name).jpEGValue=db_images(i).backdrop
>
> V4RB writing to DB
> vcdb.Blobfield(db_images(i).name).setpicture(db_images(i).backdrop)
>
> RealDB reading from DB
> db_images(i).backdrop=rsdb.field(db_images(i).name).jpEGValue
>
> Valentina reading from DB
> db_images(i).backdrop=vcdb.Blobfield(db_images(i).name).getpicture()
Hi Jason
1) DO NOT use BLOB.SetPicture() and BLOB.GetPicture() methods.
This are very old and to be removed methods.
----
2) the most correct and safe way -- to use Vpicture.SetPicture() methods.
But important to note that THIS methods require bitmpas:
on MAC this is PICT
on windows this is DIB
REALbasic returns us bitmaps from its ImageWell.
---
3) But you say you ALREADY have correct JPG inside of Canvas ?
Then you cannot use Vpicture,SetPicture(), because it self do JPG
compression.
You need then to use simply VBLOB.WriteData(), VBLOB.readData().
Although this way is good ONLY and ONLY you are going to use this db with
YOUR RB APP. IF you plan use db with e.g. Director this will not work.
In future version I need add to V4RB functions that will store READY JPGs
and GIFs and TIFFs into Picture field...
-----
4) and Last.
so you do VBLOB.WriteData()
But I wonder if you not forget to do
curs.AddRecord()
Or
curs.UpdateRecord()
Code must looks as
VBLOB.WriteData()
curs.UpdateRecord()
--
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