<span style='font-family:Verdana'><span style='font-size:12px'>I'll try this approach.<br />
<br />
Thank you very much<br />
<br />
Ricardo<br />
<br />
<p style="margin:0px; padding:0px;" >
</p>
<blockquote style="border-left: 1px solid #CCC; padding-left: 5px; margin-left: 5px; margin-bottom: 0px; margin-top: 0px; margin-right: 0px;" type="cite">
<p style="margin:0px; padding:0px;" >
<span style="font-family:Verdana"><span style="font-size:12px">----- Original Message -----</span></span></p>
<p style="margin:0px; padding:0px;" >
<span style="font-family:Verdana"><span style="font-size:12px">From: Felipe Monteiro de Carvalho</span></span></p>
<p style="margin:0px; padding:0px;" >
<span style="font-family:Verdana"><span style="font-size:12px">Sent: 10/26/11 06:10 AM</span></span></p>
<p style="margin:0px; padding:0px;" >
<span style="font-family:Verdana"><span style="font-size:12px">To: Lazarus mailing list</span></span></p>
<p style="margin:0px; padding:0px;" >
<span style="font-family:Verdana"><span style="font-size:12px">Subject: Re: [Lazarus] Problem with access rights in Windows Mobile?</span></span></p>
<br />
<div>
<div>
<pre style="white-space: pre-wrap; word-wrap: break-word; font-size:11;pre">
2011/10/26 "Arí Ricardo Ody" <aro52@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
--
_______________________________________________
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus</pre>
</div>
</div>
</blockquote>
<p style="margin:0px; padding:0px;" >
</p>
</span></span>