Real Software Forums
http://forums.realsoftware.com/

Store JPeg in SQLite
http://forums.realsoftware.com/viewtopic.php?f=3&t=33242
Page 1 of 1

Author:  jknight [ Fri Apr 02, 2010 9:35 pm ]
Post subject:  Store JPeg in SQLite

I am new to RB. Does anyone have a good example of how to store and retrieve jpeg files in a SQLite database?

Author:  timhare [ Fri Apr 02, 2010 10:22 pm ]
Post subject:  Re: Store JPeg in SQLite

Read through the sticky note at the top of this section: "Tips for using databases".

Author:  MonkeybreadSoftware [ Sat Apr 03, 2010 3:36 am ]
Post subject:  Re: Store JPeg in SQLite

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

Author:  rbasic20091005153 [ Sat Apr 03, 2010 9:49 am ]
Post subject:  Re: Store JPeg in SQLite

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.

Author:  sboss [ Sat Apr 03, 2010 10:25 am ]
Post subject:  Re: Store JPeg in SQLite

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

Author:  MonkeybreadSoftware [ Sat Apr 03, 2010 10:31 am ]
Post subject:  Re: Store JPeg in SQLite

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

Author:  jknight [ Sat Apr 03, 2010 11:24 pm ]
Post subject:  Re: Store JPeg in SQLite

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?

Author:  MonkeybreadSoftware [ Sun Apr 04, 2010 4:04 am ]
Post subject:  Re: Store JPeg in SQLite

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

Author:  simonjohn [ Tue Apr 06, 2010 1:02 pm ]
Post subject:  Re: Store JPeg in SQLite

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!

Author:  chrisjk [ Tue Apr 06, 2010 3:43 pm ]
Post subject:  Re: Store JPeg in SQLite

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

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/