[Lazarus] TJPegImage on CGI app

Leonardo M. Ramé l.rame at griensu.com
Tue Aug 31 17:38:39 CEST 2010


Hi Lazarus List and Alvaro,

Below is the reply to this message from my friend Alvaro in Spain, who
is a part-time Delphi programmer.
 
> On Tue, Aug 31, 2010 at 6:03 AM, Peter E Williams <pew at iinet.net.au>
wrote:
> Hi Alvaro,
>         
>         forwarded below is another yet to be answered post to the
Lazarus
>         programmers list. I would appreciate your thoughts on it. The
techniques
>         for solving this problem are identical in Lazarus and Delphi.
>         
>         Best Regards,
>                PEW
>         Hobart, Tasmania, Australia
>         
>         
>         Hi All,
>         
>         A few months ago I posted some messages about converting my
dBase code
>         (in Delphi) to lazarus. I was advised that I should NOT use
>         Dataset.RecNo but instead I should use bookmarks. Can someone
please
>         advise me how to rewrite:
>         
>         with Hexx_Data_DBF.FieldDefs do
>          Hexx_Data_DBF_RecNo := Dataset.RecNo;
>         
>         to use the safer method of using bookmarks???
>         
>         type
>         
>          { Thxboard }
>         
>          Thxboard = class(TForm)
>            Hexx_Data_DBF: TDbf;
>         
>         var
>          TraceFile_DBF_RecNo, Hexx_Data_DBF_RecNo : integer;
>        
[...]
         // here I have the Hexx_Data_DBF file open and begin to loop
through it in a while loop.
>            while (not Hexx_Data_DBF.EOF) and not found do
>              begin
>                if (pattern_is_db_current(pattern1)) then
>                  begin
>                    save_options(pattern1);
>                    found := true;
                 // here I save the RecNo in a variable
>                    with Hexx_Data_DBF.FieldDefs do
>                      Hexx_Data_DBF_RecNo := Dataset.RecNo;
                 // the close the database
>                    close_db;
>                    if trace_moves then
>                      begin
                     // open a different TDbf file (Trace_File)
>                        open_trace_file;
>                        With Trace_File_DBF do
>                        try
                       // go to the RecNo of the saved Trace_File's
variable
>                          with Trace_File_DBF.FieldDefs do
>                               Dataset.RecNo := (TraceFile_DBF_RecNo);
                       // save the Hexx_Data_DBF's RecNo into the
Trace_File
>                          FieldByName('record_no' ).AsInteger :=
>         Hexx_Data_DBF_RecNo;

                     // hmmm.... not sure whether I should be using
finally or except here.

>                        //finally
>                        except
>                          showmessage( 'An exception occured in
>         write_updated_pattern - writing to trace file.');
>                          close_trace_file;
>                        end;
>                      end;
                 // reopen the Hexx_Data_DBF file
>                    open_db;
                 // and the go back to the RecNo saved in the variable
>                    with Hexx_Data_DBF.FieldDefs do
>                      Dataset.RecNo := (Hexx_Data_DBF_RecNo);
>                  end;
             // then use the Next procedure to continue looping through
the DBF datafile
>                Hexx_Data_DBF.Next;
>              end;
>         [...]

> Alvaro GP wrote:
>         
> Hi Peter 
> 
> I never used bookmarks when I programmed in Delphi. Some people say
> that you shouldn't use RecNo because if you ever upscale your
> application to a SQL database, in the world of SQL servers there isn't
> the concept of "record number" but instead you browse the found
> records using a "Next" method repeatedly until there isn't any new
> records to read. 
> 
> If you have no intention to use SQL databases, you can safely continue
> using RecNo. 
> --
> Alvaro GP
> Lite Applications
> www.liteapplications.com

-- 
Proudly developing Quality Cross Platform Open Source Games
Since 1970 with a Commodore PET 4016 with 16 KRAM
http://pews-freeware-games.org (<--- brand new)





More information about the Lazarus mailing list