Forum > Databases

DBImage: how to use?

<< < (6/7) > >>

taazz:
1) the readonly status is present when you first create the fields/fielddefs as well there is no need to run a new query on the server just before you commit just make sure that the fields. Readonly property is set when the fields are created and you are done.
2) A New property is needed to give the user a choice to leave out read only fields from the update-insert etc or not, just in case the underline object is not a table but a view and readonly fields needs to be included so the triggers would work.

In any case it is up to the user to select how s/he want the query to behave a blanket type of property, that will enable/disable the inclusion of the readonly fields to the final sql, would be very useful but not required at this point.
to put it simple : One must know what one is doing with his/her  fields before one is allowed to insert/update anything to a production database. So the current behavior is in my book desired and if well documented should not be changed.

Just my .002 cents.

BigChimp:

--- Quote from: taazz on January 16, 2014, 04:24:42 pm ---1) the readonly status is present when you first create the fields/fielddefs as well there is no need to run a new query on the server just before you commit just make sure that the fields. Readonly property is set when the fields are created and you are done.

--- End quote ---
AddFieldDefs is run once for each query preparation - moving it somewhere else may be doable but has to take into account that Firebird is a multi-user db. A table we just used may now have an additional field etc.
Not likely, but possible.


--- Quote from: taazz on January 16, 2014, 04:24:42 pm ---2) A New property is needed to give the user a choice to leave out read only fields from the update-insert etc or not, just in case the underline object is not a table but a view and readonly fields needs to be included so the triggers would work.

--- End quote ---
Assumptions here - unless you checked what updatable views return in the column I mentioned.


--- Quote from: taazz on January 16, 2014, 04:24:42 pm ---In any case it is up to the user to select how s/he want the query to behave a blanket type of property, that will enable/disable the inclusion of the readonly fields to the final sql, would be very useful but not required at this point.

--- End quote ---
Well, having the db layer provide sensible defaults is IMO important. If the user knows what he's doing he's free to deviate from those defaults.
Cf the way insertsql etc get generated: they are provided for the user but the user can change them.


--- Quote from: taazz on January 16, 2014, 04:24:42 pm ---to put it simple : One must know what one is doing with his/her  fields before one is allowed to insert/update anything to a production database. So the current behavior is in my book desired and if well documented should not be changed.

--- End quote ---
Agreed. However, you may be coming from an Interbase/Delphi background where it is obvious that these kinds of fields are not set read-only by the db layer. I and others don't - but as you say, if properly documented, it certainly works.

Just my 2 cents ;)

taazz:

--- Quote from: BigChimp on January 16, 2014, 04:54:49 pm ---
--- Quote from: taazz on January 16, 2014, 04:24:42 pm ---1) the readonly status is present when you first create the fields/fielddefs as well there is no need to run a new query on the server just before you commit just make sure that the fields. Readonly property is set when the fields are created and you are done.

--- End quote ---
AddFieldDefs is run once for each query preparation - moving it somewhere else may be doable but has to take into account that Firebird is a multi-user db. A table we just used may now have an additional field etc.
Not likely, but possible.

--- End quote ---
erm I do get the feeling that I am missing something important or I've lost all eloquence and reson ( not that I had much to begin with). I'm only stating that placing the checks of read only fields in the addfielddefs procedure instead of the updaterecord procedure is the prefered way to handle things. I never said to move the addfieldsdefs from its current position to somewhere else. at least that is what I get from your statement that you understood.


--- Quote from: BigChimp on January 16, 2014, 04:54:49 pm ---
--- Quote from: taazz on January 16, 2014, 04:24:42 pm ---2) A New property is needed to give the user a choice to leave out read only fields from the update-insert etc or not, just in case the underline object is not a table but a view and readonly fields needs to be included so the triggers would work.

--- End quote ---
Assumptions here - unless you checked what updatable views return in the column I mentioned.

--- End quote ---

No no assumptions don't look the firebird only case what ever you do on the sqlquery component is global to all databases.


--- Quote from: BigChimp on January 16, 2014, 04:54:49 pm ---

--- Quote from: taazz on January 16, 2014, 04:24:42 pm ---In any case it is up to the user to select how s/he want the query to behave a blanket type of property, that will enable/disable the inclusion of the readonly fields to the final sql, would be very useful but not required at this point.

--- End quote ---
Well, having the db layer provide sensible defaults is IMO important. If the user knows what he's doing he's free to deviate from those defaults.
Cf the way insertsql etc get generated: they are provided for the user but the user can change them.

--- End quote ---

Agreed! I'm only saying that it already provides sensible defaults.


--- Quote from: BigChimp on January 16, 2014, 04:54:49 pm ---

--- Quote from: taazz on January 16, 2014, 04:24:42 pm ---to put it simple : One must know what one is doing with his/her  fields before one is allowed to insert/update anything to a production database. So the current behavior is in my book desired and if well documented should not be changed.

--- End quote ---
Agreed. However, you may be coming from an Interbase/Delphi background where it is obvious that these kinds of fields are not set read-only by the db layer. I and others don't - but as you say, if properly documented, it certainly works.

Just my 2 cents ;)

--- End quote ---

Not really my main line of data server was MSSQL from 6 to 2015 firebird in comparison is on the constipated side of the fence if it did not had the wonderful embedded server as a single dll to share with your application I would have never used it to begin with, not when postgreSQL is a few clicks away and MSSQL express literally covers any none enterprise use I had so far on windows environments with out problems. 

PS. Still haven't read the link you provided about calculated fields on firebird, probably will not before Monday either.

BigChimp:

--- Quote from: taazz on January 16, 2014, 06:37:41 pm ---erm I do get the feeling that I am missing something important or I've lost all eloquence and reson ( not that I had much to begin with).

--- End quote ---
Me likewise ;)


--- Quote from: taazz on January 16, 2014, 06:37:41 pm ---I'm only stating that placing the checks of read only fields in the addfielddefs procedure instead of the updaterecord procedure is the prefered way to handle things. I never said to move the addfieldsdefs from its current position to somewhere else. at least that is what I get from your statement that you understood.

--- End quote ---
More or less, yes. Glad that's sorted out.


--- Quote from: taazz on January 16, 2014, 06:37:41 pm ---No no assumptions don't look the firebird only case what ever you do on the sqlquery component is global to all databases.

--- End quote ---
The code we're talking about is Firebird only though: it's in ibconnection.pas, not in the sqlquery code.

(I'll leave the question about what kind of metadata a updatable view on FB against a computed by field would produce as is, it doesn't really matter anyway...)


--- Quote from: taazz on January 16, 2014, 06:37:41 pm ---Not really my main line of data server was MSSQL from 6 to 2015 firebird in comparison is on the constipated side of the fence if it did not had the wonderful embedded server as a single dll to share with your application I would have never used it to begin with, not when postgreSQL is a few clicks away and MSSQL express literally covers any none enterprise use I had so far on windows environments with out problems. 

PS. Still haven't read the link you provided about calculated fields on firebird, probably will not before Monday either.

--- End quote ---
Ok no problem. It's not as if we're rushing to fix something here anyway - just chatting along ;)

Just to (hopefully) clarify or perhaps painfully harp on: I'm talking about a firebird specific field type called a "computed by" field... which probably has equivalent/similar manifestations in other dbs, but I'm *only* talking about the Firebird defintion. Likewise I'm excluding fields for which a user may have select but not insert/update grants etc.

mariodosreis:
The above examples arte ok for displaying a imaage. I do beleave we need something like EDBImage; i use it since Delphi 3... I tried to convert for Lazarus:
 TEDBImage and TQREDBImage v1.6 (Enhaced TDBImage and TQRDBImage):
  by Sebastián Mayorá - Argentina - DelphiHelper@yahoo.com.ar

TQREDBimage was designed for printing image files. It has the same features that TEDBImage has.

»EDBImage works like TDBImage except :
   - It can manage .ico .bmp .wmf .emf .jpg .jpeg. Without a line of code !!!
   - Can copy to clipboard .bmp .wmf .jpg .jpeg   
   - Event OnLoadCustomImage is fired when the image type is unknown, so you can load "any" type of images (gif, tiff, png,....)
**NEW ver 1.5**:
   - property ZoomToFit: boolean  : when TRUE and the image size is smaller than component the image is zoomed to component size (keeping aspect ratio).
   - property ShrinkToFit: boolean: when TRUE and the image size is bigger than component the image is reduced to component size (keeping aspect ratio)
   - If you download (Highly recomended) GraphicEx ((c) Dipl. Ing. Mike Lischke)from www.lischke-online.de  .Tiff, .gif, .tga,
       and 25 more formats available (yes, 25 formats).
   In order to use .tiff, .gif , etc from GraphicEx ((c) Dipl. Ing. Mike Lischke) YOU MUST AGREE GraphicEx license (read License.txt of GraphicEx).

   To provide support for these formats you must change GraphicConfiguration.inc before installing TEDBImage and TQREDBImage
   
»Changing GraphicConfiguration.inc
1- Read carefully License.txt and GraphicConfiguration.inc.
2- If you do not agree, please don't change anything.
3- To enable a format (eg. Tiff) {$define TIFFGraphic}
4- To Disable a format (eg. Tiff  {.$define TIFFGraphic} or comment line  //{$define TIFFGraphic}
5- Disable as much formats as you can to save memory (exe file grow 550 Kb with all formats)
6- Save all files modified and recompile packages. (Use Build All if available)

Note: for TESTING PURPOSES ONLY, I have this configuration
{.$define SGIGraphic}             // *.bw, *.rgb, *.rgba, *.sgi images are supported
{.$define AutodeskGraphic}        // *.cel, *.pic images
{$define TIFFGraphic}            // *.tif, *.tiff images
{.$define TargaGraphic}           // *.tga, *.vst, *.icb, *.vda, *.win images
{.$define PCXGraphic}             // *.pcx, *.pcc, *.scr images
{.$define PCDGraphic}             // *.pcd images
{.$define PortableMapGraphic}     // *.ppm, *.pgm, *.pbm images
{.$define CUTGraphic}             // *.cut (+ *.pal) images
{$define GIFGraphic}             // *.gif images
{.$define RLAGraphic}             // *.rla, *.rpf images
{.$define PhotoshopGraphic}       // *.psd, *.pdd images
{.$define PaintshopProGraphic}    // *.psp images
{.$define PortableNetworkGraphic} // *.png images
{.$define EPSGraphic}             // *.eps images


If you don't want to use GraphicEx comment the line
{$DEFINE GraphicEX}
in uEDBR.pas and recompile.
   
»What you can do with EDBImage is:
  - Copy, Cut and paste from clipboard. No code needed.
  - LoadFromFile and SaveToFile (New in v1.3)
  - Load "any" type of TGraphic using OnLoadCustomImage event:
   If you need OTHER kind of graphics (such GIF, TIFF, etc)
      then you should write something like this in OnLoadCustomImage Event:

       procedure TForm1.EDBImage1LoadCustomImage(var B: TGraphic; Stream: TStream);
       begin 
            B := TXXX.Create;      {XXX is your class of Graphic (TGifImage, TTiffImage, etc).}
           B.LoadFromStream( Stream );
       end;              //That is ALL.!!! - do not call B.Free.



»Please mail me for: - Bugs
                    - Suggestions
                    - say Hello.
                    - Comments
                    - etc...

»New in version. 1.6
- Packages for Delphi 7 (vclSer70.dpk, dclSer70.dpk)
- Fixed problem with DBCtrlGrid.
- Fixed problem when not using GraphicEx. (Thanks to Roberto Mamoru Matuda)
- Listen to Ctrl + Z and Esc keys.
- Thanks to Nick Spurrier, Roberto Mamoru Matuda, John Faubion, Pierre du Plessis,
   Jaro Griscik, david david, Daniel Cañas, Rolf-Dieter Schenkel, Mauricio Vargas Echeverry,
   Thiago de Goz Ferreira, Shraga Milon, Juan Badell for their support, emails and suggestions

»New in version. 1.4
- Optimized LoadPicture;
- Some bugs fixed
- Added LoadFromFile and SavetoFile methods

»Known Issues
- Current version Tested with D7, D6. Previous version tested with D6, D5 and D4.
- OnLoadCustomImage  tested with TGIFImage (from RXLib)
- Some random bugs with .gif (using GraphicEx)
- QREDBImage: set ZoomToFit and ShrinkToFit always to TRUE to avoid some strange QR behavior.



Thanks to:
  - Thanks to Nick Spurrier, Roberto Mamoru Matuda, John Faubion, Pierre du Plessis,
    Jaro Griscik, david david, Daniel Cañas, Rolf-Dieter Schenkel, Mauricio Vargas Echeverry,
    Thiago de Goz Ferreira, Shraga Milon, Juan Badell for their support, emails and suggestions
  - Mohsen Rahmani, Mr. Hong, René Simon, Dayne and everyone for their help.
  - Dipl. Ing. Mike Lischke for making GraphicEx, it is wonderful.
  - Thanks you for try it.

THIS IS FREEWARE - USE AT YOUR OWN RISK, ETC, ETC   


»Install
0- Before install, remove previous versions of EDBImage (and QREDBImage)
   Choose Component | Install Packages..., select EDBimage and hit Remove.
   (delete or rename: edbImage.*, qrEDBimage.* )

1-Open VCLser40.dpk (Dephi4), VCLser50.dpk (Delphi5), VCLser60.dpk (Delphi6) or VCLser70.dpk (Delphi7)
Menu Project-Options in Directory/Conditionals tab
set OutputDirectory to C:\Windows\System (or your system directory)
Compile it. DO NOT install, it is just a runtime package.

2-Open DCLser40.dpk (Dephi4), DCLser50.dpk (Delphi5), DCLser60.dpk (Delphi6) or  DCLser70.dpk (Delphi7)
Compile it, then Install It. This is the Designtime package.

3- Enjoy!!

4- Send me an email with your opinion. Thank you!

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version