Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Wed Oct 16, 2019 12:45 pm
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: Store JPeg in SQLite
PostPosted: Fri Apr 02, 2010 9:35 pm 
Offline

Joined: Fri Apr 02, 2010 9:25 pm
Posts: 2
I am new to RB. Does anyone have a good example of how to store and retrieve jpeg files in a SQLite database?


Top
 Profile  
Reply with quote  
 Post subject: Re: Store JPeg in SQLite
PostPosted: Fri Apr 02, 2010 10:22 pm 
Offline

Joined: Fri Jan 06, 2006 3:21 pm
Posts: 12388
Location: Portland, OR USA
Read through the sticky note at the top of this section: "Tips for using databases".


Top
 Profile  
Reply with quote  
 Post subject: Re: Store JPeg in SQLite
PostPosted: Sat Apr 03, 2010 3:36 am 
Offline
User avatar

Joined: Wed May 10, 2006 2:42 pm
Posts: 2985
Location: Germany
The answer is simply: put them in a blob field.

And here is a little example for a picture database:
http://www.monkeybreadsoftware.net/exam ... base.shtml

Greetings
Christian

_________________
See you in Orlando, Florida for Real World 2013
More details and registration here:
http://www.realsoftware.com/community/realworld.php


Top
 Profile  
Reply with quote  
 Post subject: Re: Store JPeg in SQLite
PostPosted: Sat Apr 03, 2010 9:49 am 
Offline
User avatar

Joined: Sat Apr 04, 2009 5:10 pm
Posts: 954
What does the MonkeyBread plugin have to do with 'store and retrieve jpeg files in a SQLite database'? Does one need a special plugin to do what he/she is trying to do? Or is he trying to convince jknight to buy something that he or she doesn't need?

REALbasicUsersGuide explains how to do it at the very end of Chapter 11.

_________________
Mac OS X 10.5.8/REALBasic 2008 R5.1 ~ REALBasic 2009 R4
--------------------------------------------------
Please don't use my topics in order to advertise your plug-ins.
Watch out for European spammers who try to sell plug-ins you don't even need.


Top
 Profile  
Reply with quote  
 Post subject: Re: Store JPeg in SQLite
PostPosted: Sat Apr 03, 2010 10:25 am 
Offline

Joined: Sun Oct 14, 2007 1:08 pm
Posts: 105
Location: ATL
rbasic20091005153 wrote:
What does the MonkeyBread plugin have to do with 'store and retrieve jpeg files in a SQLite database'? Does one need a special plugin to do what he/she is trying to do? Or is he trying to convince jknight to buy something that he or she doesn't need?

REALbasicUsersGuide explains how to do it at the very end of Chapter 11.


Christian (hopefully I spelled it correctly) was showing one way to do it. As in most things there is more than one way to skin a cat.

scott

_________________
ARBP President.
visit http://arbpmembers.org


Top
 Profile  
Reply with quote  
 Post subject: Re: Store JPeg in SQLite
PostPosted: Sat Apr 03, 2010 10:31 am 
Offline
User avatar

Joined: Wed May 10, 2006 2:42 pm
Posts: 2985
Location: Germany
rbasic20091005153 wrote:
What does the MonkeyBread plugin have to do with 'store and retrieve jpeg files in a SQLite database'?


Maybe nothing. But I have a sample project for a picture database which may be a good start point.
Whether jknight uses MBS functions to decode/encode picture objects to JPEG format, is his decision.

Greetings
Christian

_________________
See you in Orlando, Florida for Real World 2013
More details and registration here:
http://www.realsoftware.com/community/realworld.php


Top
 Profile  
Reply with quote  
 Post subject: Re: Store JPeg in SQLite
PostPosted: Sat Apr 03, 2010 11:24 pm 
Offline

Joined: Fri Apr 02, 2010 9:25 pm
Posts: 2
Thanks everyone. I was able to store and retrieve the files using the information you provided and the user guide. It would be nice to avoid the use of a temporary file to convert from a string back to a picture. Any hints on this?


Top
 Profile  
Reply with quote  
 Post subject: Re: Store JPeg in SQLite
PostPosted: Sun Apr 04, 2010 4:04 am 
Offline
User avatar

Joined: Wed May 10, 2006 2:42 pm
Posts: 2985
Location: Germany
That is the reason I make plugins and have this functions for picture to string and back:
// JPEG:

JPEGStringToPictureMBS(buf as string) as picture
JPEGStringToPictureMBS(buf as string,allowdamaged as Boolean) as picture
PictureToJPEGStringMBS(pic as picture,quality as integer) as string

// PNG:

PictureToPNGStringMBS(pic as picture, gamma as single) as string
PictureToPNGStringMBS(pic as picture, mask as picture, gamma as single) as string
PictureToPNGStringMBS(pic as picture, gamma as single, Interlace as Boolean, FilterType as integer) as string
PictureToPNGStringMBS(pic as picture, mask as picture, gamma as single, Interlace as Boolean, FilterType as integer) as string
PNGStringToPictureMBS(data as string, gamma as single) as picture
PNGStringToPNGPictureMBS(data as string, gamma as single) as PNGpictureMBS

// Tiff:

TIFFStringToPictureMBS(data as string) as picture
TIFFStringToTiffPictureMBS(data as string) as TiffPictureMBS

// BMP:

BMPStringtoPictureMBS(data as string) as picture
Picture.BMPDataMBS(ResolutionValueDPI as integer=72) as string

// GIF:

GifStringToGifMBS(data as string) as GIFMBS
GifStringToPictureMBS(data as string) as Picture


Greetings
Christian

_________________
See you in Orlando, Florida for Real World 2013
More details and registration here:
http://www.realsoftware.com/community/realworld.php


Top
 Profile  
Reply with quote  
 Post subject: Re: Store JPeg in SQLite
PostPosted: Tue Apr 06, 2010 1:02 pm 
Offline
User avatar

Joined: Sat Apr 19, 2008 12:44 pm
Posts: 442
Location: Dorset, UK
The example code I posted in http://forums.realsoftware.com/viewtopic.php?f=3&t=32216 stores files in a database using binary stream - might be useful. FYI MBS plugins are very good -probably not needed for this task, but very good - some folks don't like the idea of anyone making money out their hard work!
As in most things there is more than one way to skin a cat.
Good, I hate cats!

_________________
Simon Larkin
QiSQL Database Solutions

SQL Tutorial : http://qisql.com/qisql_sqlite_lessons.html


Top
 Profile  
Reply with quote  
 Post subject: Re: Store JPeg in SQLite
PostPosted: Tue Apr 06, 2010 3:43 pm 
Offline

Joined: Fri Mar 12, 2010 2:48 am
Posts: 43
Location: London, UK
Christian is also extremely quick to respond to queries about the MBS plugins, I had replies in just a few minutes to separate questions I asked him on Easter Monday!

Chris

_________________
Chris

RS2010 R2 running on Mac Pro (early 2009) and Mac OS X 10.6.3


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group