Recent

Author Topic: [Solved] Load JPG images into Firebird Database  (Read 8120 times)

JSN

  • New Member
  • *
  • Posts: 38
[Solved] Load JPG images into Firebird Database
« on: August 10, 2014, 03:13:14 am »
I am an old Delphi programmer with a new Client who has a database of JPEG images. I have written a Delphi utility to save the database images to a temporary folder. But the Client needs to keep the files in a database for security reasons, not in a folder. Their in-house software engineer has recently switched to Lazarus Version 1.2.4 and Firebird Version 2.5.3.26778.

Is there a Lazarus Tutorial available that will help me load the JPG image files into their Firebird database, and then read the files into their Lazarus application? I have not been able to find examples via the Forum Search option.

Any help will be greatly appreciated.
« Last Edit: August 29, 2014, 03:37:36 am by JSN »

motaz

  • Sr. Member
  • ****
  • Posts: 495
    • http://code.sd
Re: Load JPG images into Firebird Database
« Reply #1 on: August 10, 2014, 05:18:51 am »

JSN

  • New Member
  • *
  • Posts: 38
Re: Load JPG images into Firebird Database
« Reply #2 on: August 10, 2014, 07:53:44 am »
Awesome, thank you, Motaz.

motaz

  • Sr. Member
  • ****
  • Posts: 495
    • http://code.sd
Re: Load JPG images into Firebird Database
« Reply #3 on: August 10, 2014, 08:45:28 am »
You are welcome

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: Load JPG images into Firebird Database
« Reply #4 on: August 10, 2014, 12:19:30 pm »
Is there a Lazarus Tutorial available that will help me load the JPG image files into their Firebird database, and then read the files into their Lazarus application? I have not been able to find examples via the Forum Search option.
You could also have a look at examples\database\sqlite_mushrooms (specifically TForm1.ChangeImage)
Though written for sqlite, the same concepts apply to Firebird (without code changes).

I've submitted a patch against current Lazarus trunk at
http://bugs.freepascal.org/view.php?id=26579
that adds support for Firebird embedded to that example.

Thanks.
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

JSN

  • New Member
  • *
  • Posts: 38
Re: Load JPG images into Firebird Database
« Reply #5 on: August 11, 2014, 01:49:43 am »
Is there a Lazarus Tutorial available that will help me load the JPG image files into their Firebird database, and then read the files into their Lazarus application? I have not been able to find examples via the Forum Search option.
You could also have a look at examples\database\sqlite_mushrooms (specifically TForm1.ChangeImage)
Though written for sqlite, the same concepts apply to Firebird (without code changes).

I've submitted a patch against current Lazarus trunk at
http://bugs.freepascal.org/view.php?id=26579
that adds support for Firebird embedded to that example.

Thanks.

Appreciate the response, BigChimp. But I'm at a loss what to do with the files: "mushrooms_firebird.diff", "imagetest.fbk", and "mushrooms_firebird.sql".

I tried searching the Forums on how to install a patch, which returned only one result, and that question was replied with a suggestion to install a new version which contained a bug fix that addressed the question.

In Lazarus, under the Tools menu, there is a "Diff..." menu item. Is that where "mushrooms_firebird.diff" gets installed?

Sorry, complete Lazarus Newbie here. The folder "C:\Lazarus\examples\database" doesn't contain the folder "sqlite_mushrooms". I am guessing the files you created and posted in the Patch area would resolve that, but I don't know how to proceed to install these files.

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: Load JPG images into Firebird Database
« Reply #6 on: August 11, 2014, 10:10:29 am »
Sorry, JSN, you're right - that example is not available in Laz 1.2.4 only in development versions.

I've uploaded the example here for now
https://bitbucket.org/reiniero/fpc_laz_patch_playground/downloads/images_mushrooms_laz124.zip

adapted for Laz 1.2.4

Background
A .diff file gets generated with the diff command and (as Lazarus uses the subversion revision control system represents the difference of a file with the original file in subversion.
To go from the original file to the new file you apply the diff by running the patch command.
See Creating a patch and Applying a Patch at
http://wiki.lazarus.freepascal.org/Creating_A_Patch

The diff tool in the tools menu unfortunately can generate only an older format diff file and cannot apply the diff so it's rather useless.
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

JSN

  • New Member
  • *
  • Posts: 38
Re: Load JPG images into Firebird Database
« Reply #7 on: August 11, 2014, 05:45:20 pm »
Thank you, Big Chimp, for your time in creating an example for 1.2.4.

And thanks again for the explanation of diff files and the link to the Diff/Wiki page. For now, being new to Lazarus, I think I will just stay away from DIFF.  %)

The more I use Lazarus, the more impressed about all the features and work the Development Team has done and continues to do.

 

TinyPortal © 2005-2018