[Lazarus] Problem with access rights in Windows Mobile?

Felipe Monteiro de Carvalho felipemonteiro.carvalho at gmail.com
Wed Oct 26 10:10:19 CEST 2011


2011/10/26 "ArĂ­ Ricardo Ody" <aro52 at gmx.com>:
> The application has various methods that allocate open a TSQLDataset that
> points to the same ".db" file ...
> Maybe my programming technique must be changed... Or what?

My tipical solution is to create 1 unit which has a class which
manages a dataset. And dont declare this same dataset anywhere else.

You then add a method which returns an instance of this class, but
using the singleton approach it will return always the same object for
all places which need it. You can check this example:

http://openpokergrid.svn.sourceforge.net/viewvc/openpokergrid/WebServer/DB/dbplayer.pas?revision=277&view=markup

Here I mixed the singleton approach with reference counting, because I
dislike initialization/finalization sections. It will free the object
and the dataset when the reference count reaches zero. In a tipical
singleton approach it would only free in the finalization section.

-- 
Felipe Monteiro de Carvalho




More information about the Lazarus mailing list