View Issue Details

IDProjectCategoryView StatusLast Update
0025511LazarusDatabase Componentspublic2014-01-21 09:50
ReporterJurassic PorkAssigned ToMaxim Ganetsky 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version1.0.12Product Build 
Target Version1.4Fixed in Version1.4 
Summary0025511: Example of using image for sqlite Database
DescriptionDeadly Mushrooms
TagsNo tags attached.
Fixed in Revision43743, 43755
LazTarget1.4
WidgetsetWin32/Win64
Attached Files
  • MushRoomsDataBase_new.7z (271,550 bytes)
  • sqlite_mushrooms_patch1.patch (1,286 bytes)
    Index: unit1.lfm
    ===================================================================
    --- unit1.lfm	(revision 43747)
    +++ unit1.lfm	(working copy)
    @@ -179,7 +179,7 @@
       end
       object DBText1: TDBText
         Left = 88
    -    Height = 20
    +    Height = 24
         Top = 48
         Width = 240
         Alignment = taCenter
    Index: unit1.pas
    ===================================================================
    --- unit1.pas	(revision 43747)
    +++ unit1.pas	(working copy)
    @@ -106,7 +106,7 @@
     procedure TForm1.Bt_PrintClick(Sender: TObject);
     begin
       frReport1.LoadFromFile(ExtractFilePath(application.ExeName) +
    -    '\Mushroom_Report.lrf');
    +    'Mushroom_Report.lrf');
       frReport1.ShowReport();
     end;
     procedure TForm1.DBEdit1Change(Sender: TObject);
    @@ -213,9 +213,9 @@
     
     procedure TForm1.frReport1EnterRect(Memo: TStringList; View: TfrView);
     begin
    -    if View.Name = 'Picture2' then
    -       if   DBEdit1.Text <> '' then
    -  TFrPictureView(View).Picture.LoadFromFile(ExtractFilePath(ParamStr(0)) +
    +   if  (View.Name = 'Picture2') AND
    +   (frDBDataSet1.DataSet.FieldByName('Image_Link').AsString <> '') then
    +    TFrPictureView(View).Picture.LoadFromFile(ExtractFilePath(ParamStr(0)) +
       'images' +  DirectorySeparator +  frDBDataSet1.DataSet.FieldByName('Image_Link').AsString);
     end;
     
    

Activities

Reinier Olislagers

2014-01-10 19:00

developer   ~0072354

See forum thread
http://forum.lazarus.freepascal.org/index.php/topic,18147.msg127478.html#msg127478

Maxim Ganetsky

2014-01-11 18:53

developer   ~0072371

Last edited: 2014-01-11 18:55

View 2 revisions

Several notes:

1. Please translate comments in source into English.
2. Please fix issues with hardcoded absolute path to database.
3. Maybe it is good idea to add some readme file, at least describing that this example requires SQLite library and which version of it.
4. Maybe a number of images can be reduced in order to avoid unnecessary bloat. Now we have similar images with different resolution.

Other than that, example is OK.

Jurassic Pork

2014-01-16 03:30

reporter   ~0072481

Last edited: 2014-01-16 03:30

View 2 revisions

a new version of the project is available here :

http://www.developpez.net/forums/d1403742/autres-langages/pascal/lazarus/lazreport-outil-d-insertion-d-image/#post7650793

you need to be registered to see and download attachments in this forum.

There is a readme and a patch added to the project.

Maxim Ganetsky

2014-01-16 20:58

developer   ~0072494

Please upload it here.

Jurassic Pork

2014-01-16 23:29

reporter  

MushRoomsDataBase_new.7z (271,550 bytes)

Jurassic Pork

2014-01-16 23:30

reporter   ~0072499

done !

the new archive file is MushRoomsDataBase_new.7z

Maxim Ganetsky

2014-01-17 00:14

developer   ~0072502

Added in examples/database/sqlite_mushrooms, thanks. Excellent example.

I didn't include your patch, because it is not needed in Lazarus 1.3 and I plan to merge relevant LazReport changes to Lazarus 1.2 too.

What's your full name? I will add you to contributors list.

Jurassic Pork

2014-01-17 06:30

reporter  

sqlite_mushrooms_patch1.patch (1,286 bytes)
Index: unit1.lfm
===================================================================
--- unit1.lfm	(revision 43747)
+++ unit1.lfm	(working copy)
@@ -179,7 +179,7 @@
   end
   object DBText1: TDBText
     Left = 88
-    Height = 20
+    Height = 24
     Top = 48
     Width = 240
     Alignment = taCenter
Index: unit1.pas
===================================================================
--- unit1.pas	(revision 43747)
+++ unit1.pas	(working copy)
@@ -106,7 +106,7 @@
 procedure TForm1.Bt_PrintClick(Sender: TObject);
 begin
   frReport1.LoadFromFile(ExtractFilePath(application.ExeName) +
-    '\Mushroom_Report.lrf');
+    'Mushroom_Report.lrf');
   frReport1.ShowReport();
 end;
 procedure TForm1.DBEdit1Change(Sender: TObject);
@@ -213,9 +213,9 @@
 
 procedure TForm1.frReport1EnterRect(Memo: TStringList; View: TfrView);
 begin
-    if View.Name = 'Picture2' then
-       if   DBEdit1.Text <> '' then
-  TFrPictureView(View).Picture.LoadFromFile(ExtractFilePath(ParamStr(0)) +
+   if  (View.Name = 'Picture2') AND
+   (frDBDataSet1.DataSet.FieldByName('Image_Link').AsString <> '') then
+    TFrPictureView(View).Picture.LoadFromFile(ExtractFilePath(ParamStr(0)) +
   'images' +  DirectorySeparator +  frDBDataSet1.DataSet.FieldByName('Image_Link').AsString);
 end;
 

Jurassic Pork

2014-01-17 06:40

reporter   ~0072506

My full name is Philippe PICARD

a patch for sqlite_mushrooms example has been added here
1 - Height of the TDBText DBText1
2 - a slash for the path of Mushroom_Report.lrf in the PrintClick procedure has been removed ( now the report can be opened on linux - tested on Ubuntu 12.04)
3 - bad test for frReport1EnterRect procedure

patch with svn lazarus revision 43747

Maxim Ganetsky

2014-01-17 23:04

developer   ~0072523

Last edited: 2014-01-17 23:13

View 2 revisions

Applied, thanks. You are added to contributors list.

Next time please don't add patches to resolved bug, because it is very easy to miss it. Create new bug or reopen resolved one.

After some discussions it was decided not to merge it to fixes_1_2 now, because LazReport OnDbImageRead support needs more work and thus can't be merged.

Issue History

Date Modified Username Field Change
2014-01-10 18:54 Jurassic Pork New Issue
2014-01-10 18:54 Jurassic Pork File Added: MushRoomsDataBase.7z
2014-01-10 19:00 Reinier Olislagers Note Added: 0072354
2014-01-11 18:53 Maxim Ganetsky LazTarget => 1.4
2014-01-11 18:53 Maxim Ganetsky Note Added: 0072371
2014-01-11 18:53 Maxim Ganetsky Assigned To => Maxim Ganetsky
2014-01-11 18:53 Maxim Ganetsky Status new => feedback
2014-01-11 18:53 Maxim Ganetsky Target Version => 1.4
2014-01-11 18:55 Maxim Ganetsky Note Edited: 0072371 View Revisions
2014-01-16 03:30 Jurassic Pork Note Added: 0072481
2014-01-16 03:30 Jurassic Pork Status feedback => assigned
2014-01-16 03:30 Jurassic Pork Note Edited: 0072481 View Revisions
2014-01-16 20:58 Maxim Ganetsky Note Added: 0072494
2014-01-16 20:58 Maxim Ganetsky Status assigned => feedback
2014-01-16 23:29 Jurassic Pork File Added: MushRoomsDataBase_new.7z
2014-01-16 23:30 Jurassic Pork Note Added: 0072499
2014-01-16 23:30 Jurassic Pork Status feedback => assigned
2014-01-17 00:10 Maxim Ganetsky File Deleted: MushRoomsDataBase.7z
2014-01-17 00:14 Maxim Ganetsky Fixed in Revision => 43743
2014-01-17 00:14 Maxim Ganetsky Note Added: 0072502
2014-01-17 00:14 Maxim Ganetsky Status assigned => resolved
2014-01-17 00:14 Maxim Ganetsky Fixed in Version => 1.4
2014-01-17 00:14 Maxim Ganetsky Resolution open => fixed
2014-01-17 06:30 Jurassic Pork File Added: sqlite_mushrooms_patch1.patch
2014-01-17 06:40 Jurassic Pork Note Added: 0072506
2014-01-17 23:04 Maxim Ganetsky Fixed in Revision 43743 => 43743, 43755
2014-01-17 23:04 Maxim Ganetsky Note Added: 0072523
2014-01-17 23:13 Maxim Ganetsky Note Edited: 0072523 View Revisions