[Solved] Load JPG images into Firebird Database lazarus / 39-Graphics ---------------------------------------------------------------------- JSN · 2014-08-10 01:13 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. ---------------------------------------------------------------------- motaz · 2014-08-10 03:18 This is example of uploading files into Firebird database: http://freepascalanswers.wordpress.com/2012/02/22/upload-files-into- database/ And this for downloading: http://freepascalanswers.wordpress.com/2012/02/22/download-files-from- database/ ---------------------------------------------------------------------- JSN · 2014-08-10 05:53 Awesome, thank you, Motaz. ---------------------------------------------------------------------- motaz · 2014-08-10 06:45 You are welcome ---------------------------------------------------------------------- BigChimp · 2014-08-10 10:19 Quote from: JSN on August 10, 2014, 03:13:14 amIs 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. ---------------------------------------------------------------------- JSN · 2014-08-10 23:49 Quote from: BigChimp on August 10, 2014, 12:19:30 pmQuote from: JSN on August 10, 2014, 03:13:14 amIs 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 · 2014-08-11 08:10 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/imag es_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. ---------------------------------------------------------------------- JSN · 2014-08-11 15:45 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.