Special

Introducing the “Welcome to Xojo” Bundle!

New to Xojo and looking for guidance? We've put together a terrific bundle to welcome you! Xojo Bundle

This bundle includes six back issues of the magazine -- all of year 14 in printed book and digital formats -- plus a one-year subscription so you'll be learning all about Xojo for the next year. It's the perfect way to get started programming with Xojo. And you save as much as $35 over the non-bundle price!

This offer is only available for a limited time as supplies are limited, so hurry today and order this special bundle before the offer goes away!

Article Preview


Buy Now

PDF:

Databases for REAL

Large Database Objects

Working with pictures in databases

Issue: 10.1 (November/December 2011)
Article Description: No description available.
Article Length (in bytes): 3,114
Starting Page Number: 79
RBD Number: 10011
Resource File(s): None
Related Link(s): None
Known Limitations: None

Excerpt of article text...

Typically most database data consists of simple types such as INTEGER, TEXT, FLOAT, DATETIME and BOOLEAN. But sometimes you might have a need to store other things in your database, such as pictures, files or some other binary data. Databases have support for this using a column type called a BLOB, for binary large object.

Using a BLOB with Real Studio

To access a BLOB using real studio you have to use a RecordSet or database record. You cannot directly use SQL.

If you are working with a Picture, you can use the PictureValue property of the DatabaseField on a RecordSet like this:

Dim myDB As REALSQLDatabase

Dim rs As RecordSet

rs = myDB.SQLSelect("SELECT * FROM MyTable")

Dim picValue As Picture

If rs <> Nil Then

While Not rs.EOF

picValue = rs.Field("PicColumn").PictureValue

rs.MoveNext

Wend

rs.Close

End If

To create a new row with a Picture in the database, you would use the DatabaseRecord class:

Dim myDB As REALSQLDatabase

Dim rec As New DatabaseRecord

...End of Excerpt. Please purchase the magazine to read the full article.

Article copyrighted by REALbasic Developer magazine. All rights reserved.


 


|

 


Weblog Commenting and Trackback by HaloScan.com