On Aug 11, 2006, at 10:09 AM, Björn Eiríksson wrote:


On 11.8.2006, at 16:05, Jeffrey Martin wrote:

Dear list denizens,

I know it is possible to store/retrieve a graphic in REALSQLdatabase as a binary object. The way to do it is as intuitively obvious as getting an elephant through my front door. RB (2006R3). I have a canvas where my graphic will go and it seems that no property will go with the update statement for my db record. The SQLExecute with the update statement is expecting a string, it seems. Does anyone know of any very simple example code anywhere that does this? There is nothing like a simple example to learn how. RB makes some things so easy and others that would seem easy, are like getting to the moon.

You need to serialize the Picture to a PNG image or JPEG image, you can either do this in memory with plugins or you can do it with REALbasic by first writing the image to a temp file and then streaming the temp file to the database.

We supply a plugin that does this: http://www.einhugur.com/Html/ GraphicsFormats/index.html

And there are at least two other 3rd party Plugins that also offer similar solutions.

You can use the ever popular work around like

PictToString(p as picture) as string    
        dim dbrec as databaseRecord
        dim s as string

        dbrec = new databaseRecord
        dbrec.JPEGColumn("any") = p
        return dbrec.StringValue("any")

And the reverse
StringToPict(s as string) as picture
        dim dbrec as DatabaseRecord

        dbrec = new DatabaseRecord

        dbrec.Column("any") = s
        return dbrec.JPEGColumn("any")

This works for a pretty wide range of pictures

 _______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to