Re: [Lazarus] How do you install Lazarus on Debian?

2012-11-08 Thread Howard Lee Harkness
I tried that first. Didn't work. Some problem with

deb http://www.hu.freepascal.org/lazarus/ lazarus-stable universe


On Thu, Nov 8, 2012 at 1:49 PM, bsquared  wrote:

>
> Detailed instructions are here:
> http://wiki.lazarus.**freepascal.org/Installing_**Lazarus<http://wiki.lazarus.freepascal.org/Installing_Lazarus>
>



-- 
Howard Lee Harkness
(214) 390-4896
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] How do you install Lazarus on Debian?

2012-11-08 Thread Howard Lee Harkness
I was not able to find the deb files. How do you download them? When I did
a search for "lazarus install on debian", I got a list of installation
instructions for everything except Debian -- and directions for doing a
source checkout and build.

BTW, I missed the part about needing to configure fpc and fpc-packages
before doing the make. After an apt-get install fpc, make appears to be
running just fine in the lazarus directory. Now to figure out how to start
it up...

On Thu, Nov 8, 2012 at 1:40 PM, Chavoux Luyt  wrote:

> Hi Howard
>
> On 8 November 2012 21:26, Howard Lee Harkness <
> howard.lee.harkn...@gmail.com> wrote:
>
>> I'm a relative n00b at Linux admin stuff, but I'd really like to be able
>> to run Lazarus on the Debian system I've just inherited at my new contract.
>>
>> I have done a checkout of the Lazarus svn repository per the instructions
>> in http://wiki.freepascal.org/Getting_Lazarus. But when I execute "make"
>> in the lazarus directory, I just get a bunch of error messages.
>>
> Do you have a specific reason why you want to install Lazarus from source
> (svn)? In general I find it easier in Debian to download the .deb files and
> install from there. Normally these will also ensure that the prerequisite
> packages (e.g. fpc) are also installed.
>
> HTH
> Chavoux
>
>
> --
> ___
> Lazarus mailing list
> Lazarus@lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
>
>


-- 
Howard Lee Harkness
(214) 390-4896
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] How do you install Lazarus on Debian?

2012-11-08 Thread Howard Lee Harkness
edit/units/-/nogui
-Fu../components/lazcontrols/lib/-/nogui -Fu../units/-/nogui '
make[2]: -iVSPTPSOTO: Command not found
make[2]: Entering directory `/etc/lazarus/ide'
FE. -FUunits/- -Fu../packager/units/- -Fu../components/codetools/units/-
-Fu../components/lazutils/lib/- -Fu../lcl/units/- -Fu../lcl/units/-/nogui
-Fu../ideintf/units/-/nogui -Fu../components/synedit/units/-/nogui
-Fu../components/lazcontrols/lib/-/nogui -Fu../units/-/nogui   lazbuild.lpr
make[2]: FE.: Command not found
make[2]: [lazbuild.exe] Error 127 (ignored)
make[2]: Leaving directory `/etc/lazarus/ide'
make[1]: Leaving directory `/etc/lazarus/ide'
make -C lcl
make[1]: -iVSPTPSOTO: Command not found
make[1]: Entering directory `/etc/lazarus/lcl'
/bin/rm -f units/-/alllclunits.ppu
FE. -FUunits/-  alllclunits.pp
make[1]: FE.: Command not found
make[1]: [alllclunits.ppu] Error 127 (ignored)
/bin/cp -f Makefile.compiled units/-/LCLBase.compiled
make[1]: Leaving directory `/etc/lazarus/lcl'
make -C components/lazcontrols
make[1]: -iVSPTPSOTO: Command not found
make[1]: Entering directory `/etc/lazarus/components/lazcontrols'
/bin/rm -f units/-/lazcontrols.ppu
FE. -FUunits/-  lazcontrols.pas
make[1]: FE.: Command not found
make[1]: [lazcontrols.ppu] Error 127 (ignored)
/bin/cp -f Makefile.compiled units/-/LazControls.compiled
make[1]: Leaving directory `/etc/lazarus/components/lazcontrols'
make -C components/synedit
make[1]: -iVSPTPSOTO: Command not found
make[1]: Entering directory `/etc/lazarus/components/synedit'
/bin/rm -f units/-/allsynedit.ppu
FE. -FUunits/-  allsynedit.pas
make[1]: FE.: Command not found
make[1]: [allsynedit.ppu] Error 127 (ignored)
/bin/cp -f Makefile.compiled units/-/SynEdit.compiled
make[1]: Leaving directory `/etc/lazarus/components/synedit'
make -C ideintf
make[1]: -iVSPTPSOTO: Command not found
make[1]: Entering directory `/etc/lazarus/ideintf'
/bin/rm -f units/-/ideintf.ppu
FE. -FUunits/-  ideintf.pas
make[1]: FE.: Command not found
make[1]: [ideintf.ppu] Error 127 (ignored)
/bin/cp -f Makefile.compiled units/-/IDEIntf.compiled
make[1]: Leaving directory `/etc/lazarus/ideintf'
make -C components/synedit/design
make[1]: -iVSPTPSOTO: Command not found
make[1]: Entering directory `/etc/lazarus/components/synedit/design'
/bin/rm -f units/-/allsyneditdsgn.ppu
FE. -FUunits/-  allsyneditdsgn.pas
make[1]: FE.: Command not found
make[1]: [allsyneditdsgn.ppu] Error 127 (ignored)
/bin/cp -f Makefile.compiled units/-/SynEditDsgn.compiled
make[1]: Leaving directory `/etc/lazarus/components/synedit/design'
make -C ide ide
make[1]: -iVSPTPSOTO: Command not found
make[1]: Entering directory `/etc/lazarus/ide'
make -C ../tools svn2revisioninc OS_TARGET= CPU_TARGET= OPT=''
make[2]: -iVSPTPSOTO: Command not found
make[2]: Entering directory `/etc/lazarus/tools'
make[2]: *** No rule to make target `svn2revisioninc'.  Stop.
make[2]: Leaving directory `/etc/lazarus/tools'
make[1]: *** [revisioninc] Error 2
make[1]: Leaving directory `/etc/lazarus/ide'
make: *** [ide] Error 2
root@debian:/etc/lazarus#

-- 
Howard Lee Harkness
(214) 390-4896
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] RE : TQuery.Open 100x slower than same code using PostrgreSQL

2012-02-06 Thread Howard Lee Harkness
After several hours (over a period of a couple of months) of battling this
problem, I finally found the cause. I was not looking in the right place.
Turns out that I had a dependent query that were being opened after the
client TQuery. Actually, there were 3 different dependent queries, only one
of which was causing the problem. On my system, I never ran into the
problem, primarily because my testing was not comprehensive enough -- and
the attorney ran into it almost immediately every time he used it (and he
just complained that it was too slow). I finally just recorded *exactly*
what he was doing, and then easily duplicated the problem.

The problem query was the "cases" table, which has a client ID foreign key,
an OID (primary key), a date and a large text field. PostgreSQL did not
have any slowdown at all with this database schema, so I was surprised to
see that SQLite took two orders of magnitude longer to open that same table.

What I did was simply close the case table whenever doing the incremental
search. That works, although it seems to be a bit of a hack.



On Sun, Aug 7, 2011 at 3:08 AM, Ludo Brands  wrote:

> >
> > There has GOT to be something I'm not understanding. I
> > thought SQLite was going to speed things up, not slow them down.
> >
>
> Clearly you are not providing enough information to reproduce the problem.
> So far it has all been guess work for people trying to help. Fe. your
> initial request for help "forgot" to mention that there were several
> dependant queries. If you upload the project we can take a look at it. Data
> aren't needed. Populating with random data is easy. Seen the size of your
> project (I guess this mailing list has attachment size limits) upload it
> somewhere and post the link.
>
> Ludo
>
>
> --
> ___
> Lazarus mailing list
> Lazarus@lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
>



-- 
Howard Lee Harkness
(214) 390-4896
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Date format conversion function?

2011-12-22 Thread Howard Lee Harkness
On Thu, Dec 22, 2011 at 2:30 AM,   wrote:
>
> See FormatDateTime in sysutils.
>
> And TDateEdit has a Date property which is of type TDateTime.
>
> Michael.
>

I discovered that about thirty minutes after I posted the request.

Thanks!
-- 
Howard Lee Harkness
(214) 390-4896

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] Date format conversion function?

2011-12-21 Thread Howard Lee Harkness
I am using SQLite in a small application, and using TDateEdit to pick
a date. The date is returned in the Text field (I can't find a
DateTime property in this control) in the format 'mm/dd/', and to
use INSERT in SQLite, it wants dates in the format '-mm-dd'. Yes,
I can write a reformatting function, but I would expect one to be
already available somewhere.

I'm having some trouble believing that there is no such function in
Lazarus, but I just can't find it. If somebody here knows where such a
function (or equivalent functionality in a class) may be found, please
enlighten me.

TIA!
-- 
Howard Lee Harkness
(214) 390-4896

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] TQuery.Open 100x slower than same code using PostrgreSQL

2011-08-06 Thread Howard Lee Harkness
Now I'm seeing a very slow response to opening the main table, even
with no dependent tables.

I set the SQL in the TQuery, then do an open. It takes 4 to 6 seconds
to populate the TDBGrid. When I was using PostgreSQL with the same
database, it was instant.

  qClients.Close;
  qClients.SQL.Text:='select * from clients where lastname is not NULL
order by lastname,firstname,middlename';
  qClients.Open; // takes 4 to 6 seconds here

There has GOT to be something I'm not understanding. I thought SQLite
was going to speed things up, not slow them down.

On Wed, Aug 3, 2011 at 11:10 AM, Howard Lee Harkness
 wrote:
> I have added some code to only open a query if the corresponding
> tabsheet is selected, which I think speeds things up sufficiently.
> Still would like to know why a TQuery component would take 2 or 3
> seconds to open, even on a slow machine.
>
> Here is the SQL from my address table query:
>
> select * from addresses
> where ID = :ID
> order by atype,asof
>
> "atype" is a string (home, work, etc.) and "asof" is a date.
>
> The SQL for the other two queries is very similar.
>
> In the synchronization procedure to set the :ID value for each query:
>
>   closeDependentQueries;
>   CurrentClientID := qClients.FieldByName('ID').AsInteger;
>   qAddresses.Params.ParamByName('ID').Value := CurrentClientID;
>   qCases.Params.ParamByName('ID').Value := CurrentClientID;
>   qPhones.Params.ParamByName('ID').Value := CurrentClientID;
>
> I have not yet played around with the foreign key stuff, and I'm not
> really sure how to enable & use foreign keys in SQLite, anyway.
>
> On Mon, Aug 1, 2011 at 4:21 PM, Howard Lee Harkness
>  wrote:
>> I have a dummy database and complete program I can let you look at if
>> you would like. Nothing particularly proprietary about the code; it's
>> a trivial application. The database is the sensitive part, and I have
>> it dummied out.
>>
>> I posted the schema a few days ago, and I've added a zipcode table to
>> that. I had initially thought I had solved the performance problem,
>> but when I got to the client, and ran it on his machine (which is
>> about 100x slower than mine). I had not noticed the lag on my machine,
>> but it was really awful on his.
>>
>> The whole project is in a 1.6Mb zip, expands to just over 7Mb. Would
>> you like me to email it directly to you, or post it?
>>
>> On Mon, Aug 1, 2011 at 1:56 PM, Michael Van Canneyt
>>  wrote:
>>>
>>>
>>> On Mon, 1 Aug 2011, Howard Lee Harkness wrote:
>>>
>>>> I thought I had fixed the performance problem, but it is still there.
>>>> What I am doing is opening 3 dependent queries after selecting a
>>>> record in the main table. It takes 8 or 9 seconds to do the 3 calls to
>>>> TQuery.Open. Any clues as to what I might be doing wrong? The sample
>>>> queries done from sqlite3.exe return instantaneously, so I am
>>>> concluding that I have not set something up correctly in the LCL.
>>>
>>> Can you provide test data and a sample program ? Without that, it's very
>>> hard to give recommendations.
>>>
>>> The architecture of the sqlite components is not fundamentally different
>>> from
>>> the other database, and those do work instantaneously.
>>>
>>> Michael.
>>>
>>> --
>>> ___
>>> Lazarus mailing list
>>> Lazarus@lists.lazarus.freepascal.org
>>> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
>>>
>>
>>
>>
>> --
>> Howard Lee Harkness
>> (214) 390-4896
>>
>
>
>
> --
> Howard Lee Harkness
> (214) 390-4896
>



-- 
Howard Lee Harkness
(214) 390-4896

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Chain procedure in FPC/Lazarus?

2011-08-03 Thread Howard Lee Harkness
Thanks! I found it after somebody mentioned TProcess.

On Wed, Aug 3, 2011 at 3:19 PM, Howard Page-Clark  wrote:
> On 03/8/11 8:41, Howard Lee Harkness wrote:
>>
>> In Delphi, I recall that there is an Exec procedure for calling
>> another .exe, and a Chain procedure for transferring to another .exe.
>> I assume that these are also in FPC/Lazarus, but I haven't found any
>> Lazarus documentation for these calls. Could somebody tell me where to
>> look?
>>
> try
> http://wiki.lazarus.freepascal.org/Executing_External_Programs
> CreateProcess() is the principal function call.
>
> H.
>
> --
> ___
> Lazarus mailing list
> Lazarus@lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
>



-- 
Howard Lee Harkness
(214) 390-4896

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Chain procedure in FPC/Lazarus?

2011-08-03 Thread Howard Lee Harkness
2011/8/3 "Arí Ricardo Ody" :
> TProcess

That was what I needed. Using that as the search term got me the
relevant documentation.

Thanks!

-- 
Howard Lee Harkness
(214) 390-4896

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] Chain procedure in FPC/Lazarus?

2011-08-03 Thread Howard Lee Harkness
In Delphi, I recall that there is an Exec procedure for calling
another .exe, and a Chain procedure for transferring to another .exe.
I assume that these are also in FPC/Lazarus, but I haven't found any
Lazarus documentation for these calls. Could somebody tell me where to
look?

-- 
Howard Lee Harkness
(214) 390-4896

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] I thought it was solved -- TQuery.Open very slow.

2011-08-03 Thread Howard Lee Harkness
I have added some code to only open a query if the corresponding
tabsheet is selected, which I think speeds things up sufficiently.
Still would like to know why a TQuery component would take 2 or 3
seconds to open, even on a slow machine.

Here is the SQL from my address table query:

select * from addresses
where ID = :ID
order by atype,asof

"atype" is a string (home, work, etc.) and "asof" is a date.

The SQL for the other two queries is very similar.

In the synchronization procedure to set the :ID value for each query:

   closeDependentQueries;
   CurrentClientID := qClients.FieldByName('ID').AsInteger;
   qAddresses.Params.ParamByName('ID').Value := CurrentClientID;
   qCases.Params.ParamByName('ID').Value := CurrentClientID;
   qPhones.Params.ParamByName('ID').Value := CurrentClientID;

I have not yet played around with the foreign key stuff, and I'm not
really sure how to enable & use foreign keys in SQLite, anyway.

On Mon, Aug 1, 2011 at 4:21 PM, Howard Lee Harkness
 wrote:
> I have a dummy database and complete program I can let you look at if
> you would like. Nothing particularly proprietary about the code; it's
> a trivial application. The database is the sensitive part, and I have
> it dummied out.
>
> I posted the schema a few days ago, and I've added a zipcode table to
> that. I had initially thought I had solved the performance problem,
> but when I got to the client, and ran it on his machine (which is
> about 100x slower than mine). I had not noticed the lag on my machine,
> but it was really awful on his.
>
> The whole project is in a 1.6Mb zip, expands to just over 7Mb. Would
> you like me to email it directly to you, or post it?
>
> On Mon, Aug 1, 2011 at 1:56 PM, Michael Van Canneyt
>  wrote:
>>
>>
>> On Mon, 1 Aug 2011, Howard Lee Harkness wrote:
>>
>>> I thought I had fixed the performance problem, but it is still there.
>>> What I am doing is opening 3 dependent queries after selecting a
>>> record in the main table. It takes 8 or 9 seconds to do the 3 calls to
>>> TQuery.Open. Any clues as to what I might be doing wrong? The sample
>>> queries done from sqlite3.exe return instantaneously, so I am
>>> concluding that I have not set something up correctly in the LCL.
>>
>> Can you provide test data and a sample program ? Without that, it's very
>> hard to give recommendations.
>>
>> The architecture of the sqlite components is not fundamentally different
>> from
>> the other database, and those do work instantaneously.
>>
>> Michael.
>>
>> --
>> ___
>> Lazarus mailing list
>> Lazarus@lists.lazarus.freepascal.org
>> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
>>
>
>
>
> --
> Howard Lee Harkness
> (214) 390-4896
>



-- 
Howard Lee Harkness
(214) 390-4896

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] I thought it was solved -- TQuery.Open very slow.

2011-08-01 Thread Howard Lee Harkness
I have a dummy database and complete program I can let you look at if
you would like. Nothing particularly proprietary about the code; it's
a trivial application. The database is the sensitive part, and I have
it dummied out.

I posted the schema a few days ago, and I've added a zipcode table to
that. I had initially thought I had solved the performance problem,
but when I got to the client, and ran it on his machine (which is
about 100x slower than mine). I had not noticed the lag on my machine,
but it was really awful on his.

The whole project is in a 1.6Mb zip, expands to just over 7Mb. Would
you like me to email it directly to you, or post it?

On Mon, Aug 1, 2011 at 1:56 PM, Michael Van Canneyt
 wrote:
>
>
> On Mon, 1 Aug 2011, Howard Lee Harkness wrote:
>
>> I thought I had fixed the performance problem, but it is still there.
>> What I am doing is opening 3 dependent queries after selecting a
>> record in the main table. It takes 8 or 9 seconds to do the 3 calls to
>> TQuery.Open. Any clues as to what I might be doing wrong? The sample
>> queries done from sqlite3.exe return instantaneously, so I am
>> concluding that I have not set something up correctly in the LCL.
>
> Can you provide test data and a sample program ? Without that, it's very
> hard to give recommendations.
>
> The architecture of the sqlite components is not fundamentally different
> from
> the other database, and those do work instantaneously.
>
> Michael.
>
> --
> ___
> Lazarus mailing list
> Lazarus@lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
>



-- 
Howard Lee Harkness
(214) 390-4896

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] I thought it was solved -- TQuery.Open very slow.

2011-08-01 Thread Howard Lee Harkness
I thought I had fixed the performance problem, but it is still there.
What I am doing is opening 3 dependent queries after selecting a
record in the main table. It takes 8 or 9 seconds to do the 3 calls to
TQuery.Open. Any clues as to what I might be doing wrong? The sample
queries done from sqlite3.exe return instantaneously, so I am
concluding that I have not set something up correctly in the LCL.

-- 
Howard Lee Harkness
(214) 390-4896

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] RE : SQLite performance problem. Simple query takes too long. (SOLVED)

2011-07-29 Thread Howard Lee Harkness
Ok, I found a fix, although I'm not really sure that I have fixed the
problem in the best way. What I did was to close all of the dependent
queries while doing the incremental search until the user selects a
client entry in the main dbgrid. Now the incremental search is as fast
as it was in PostgreSQL.

Although this dialog did not point directly to a solution, I learned a
lot, which eventually enabled me to find the bottleneck.

If any of you should think of a better way, please let me know.
Otherwise, I think it's good enough to deliver tomorrow. I spoke with
the customer and explained the slight difference in behavior, and he
thinks that is an improvement, because it will help prevent
accidentally entering phone #, address, etc. for the wrong client.

Thanks for the help!

On Fri, Jul 29, 2011 at 2:21 PM, Howard Lee Harkness
 wrote:
> On Fri, Jul 29, 2011 at 1:42 PM, Ludo Brands  wrote:
>> I traced through TSqlQuery.Close and there isn't happening a lot, except for
>> cleaning up prepared statements and cursors. And that is where your direct
>> BEGIN/COMMIT could very well confuse sqlite.
>> sqlite3_finalize(fstatement) is used to unprepare a statement. But is
>> fstatement still valid after you have restarted a transaction? I doubt it.
>> Do replace the ExecuteDirect with a TSqlQuery component. It is only a small
>> change and it removes a lot of causes of errors.
>
> Ok, it seems like a reasonable suggestion, so I tried that.
>
> The TSQLQuery object:
>  object qDIU: TSQLQuery
>    IndexName = 'DEFAULT_ORDER'
>    AutoCalcFields = False
>    Database = FormDatabase.SQLite3Connection
>    Transaction = FormDatabase.SQLTransaction
>    ReadOnly = False
>    Params = <>
>    left = 308
>    top = 48
>  end
>
> The updated procedure:
> procedure TfrmMain.ExecSQL(sql:string);
> begin
> //     FormDatabase.SQLite3Connection.ExecuteDirect(sql);
> //     FormDatabase.SQLite3Connection.ExecuteDirect('commit');
> //     FormDatabase.SQLite3Connection.ExecuteDirect('begin transaction');
>       qDIU.SQL.Text:=sql;
>       qDIU.ExecSQL;
>       FormDatabase.SQLTransaction.CommitRetaining;
> end;
>
> I also tracked down one other usage of ExecuteDirect in another form
> (not used for this test, but just in case) and applied the same
> change.
>
> The result: No improvement. If anything, things got slightly worse.
>
> However, I think maybe I have some insight into what is causing the
> problem. It looks like the lookups for the dependent tables are
> happening multiple times. Not sure why that would be (I didn't think I
> did anything to that part of the code other than change database
> engines), but I hope to find out shortly.
> --
> Howard Lee Harkness
> (214) 390-4896
>



-- 
Howard Lee Harkness
(214) 390-4896

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] RE : RE : SQLite performance problem. Simple query takestoolong.

2011-07-29 Thread Howard Lee Harkness
On Fri, Jul 29, 2011 at 1:42 PM, Ludo Brands  wrote:
> I traced through TSqlQuery.Close and there isn't happening a lot, except for
> cleaning up prepared statements and cursors. And that is where your direct
> BEGIN/COMMIT could very well confuse sqlite.
> sqlite3_finalize(fstatement) is used to unprepare a statement. But is
> fstatement still valid after you have restarted a transaction? I doubt it.
> Do replace the ExecuteDirect with a TSqlQuery component. It is only a small
> change and it removes a lot of causes of errors.

Ok, it seems like a reasonable suggestion, so I tried that.

The TSQLQuery object:
  object qDIU: TSQLQuery
IndexName = 'DEFAULT_ORDER'
AutoCalcFields = False
Database = FormDatabase.SQLite3Connection
Transaction = FormDatabase.SQLTransaction
ReadOnly = False
Params = <>
left = 308
top = 48
  end

The updated procedure:
procedure TfrmMain.ExecSQL(sql:string);
begin
// FormDatabase.SQLite3Connection.ExecuteDirect(sql);
// FormDatabase.SQLite3Connection.ExecuteDirect('commit');
// FormDatabase.SQLite3Connection.ExecuteDirect('begin transaction');
   qDIU.SQL.Text:=sql;
   qDIU.ExecSQL;
   FormDatabase.SQLTransaction.CommitRetaining;
end;

I also tracked down one other usage of ExecuteDirect in another form
(not used for this test, but just in case) and applied the same
change.

The result: No improvement. If anything, things got slightly worse.

However, I think maybe I have some insight into what is causing the
problem. It looks like the lookups for the dependent tables are
happening multiple times. Not sure why that would be (I didn't think I
did anything to that part of the code other than change database
engines), but I hope to find out shortly.
-- 
Howard Lee Harkness
(214) 390-4896

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] RE : SQLite performance problem. Simple query takes toolong.

2011-07-29 Thread Howard Lee Harkness
QLite3Connection instance and
> TSQLQuery.Transaction to the SQLTransaction instance. Active:= False,
> SQL.Text:=''.
>
> Now to execute an insert query (assuming
> TSQLite3Connection.Connected:=true):
>    SQLQuery.SQL.Text:=sql;
>    SQLQuery.ExecSQL;
>    SQLTransaction.CommitRetaining;
>
> That's it. SQLTransaction.CommitRetaining; does the COMMIT and a BEGIN to
> start a new transaction.
>
> Just to be complete, I'm using lazarus 0.9.31 svn with fpc 2.5.1 svn.
>
> Ludo



-- 
Howard Lee Harkness
(214) 390-4896

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] SQLite performance problem. Simple query takes too long.

2011-07-29 Thread Howard Lee Harkness
I have established that the problem is not in SQLite, but has to be in
my code somewhere. I suspect it is related to the transaction/commit
problem I posted a few days ago, and I plan to track that down today
if I can. I need to finish this application by tomorrow.

2011/7/29 Martin Schreiber :
> Am Donnerstag 28 Juli 2011, 22:01:32 schrieb Howard Lee Harkness:
>> Unfortunately, it has a lot of information that is sensitive (belongs
>> to a client). I will look at building a database with dummy data. I
>> can, however, provide the schema, if that would help.
>>
> I tested with MSEide+MSEgui, it is instant too, see attachment.
> Suggestion: test with a similar simple Lazarus application.
>
> Martin
>
> --
> ___
> Lazarus mailing list
> Lazarus@lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
>
>



-- 
Howard Lee Harkness
(214) 390-4896

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] SQLite performance problem. Simple query takes too long.

2011-07-28 Thread Howard Lee Harkness
Unfortunately, it has a lot of information that is sensitive (belongs
to a client). I will look at building a database with dummy data. I
can, however, provide the schema, if that would help.

On Thu, Jul 28, 2011 at 2:10 PM, Martin Schreiber  wrote:
> On Thursday 28 July 2011 17:54:03 Howard Lee Harkness wrote:
>> I am doing a conversion of a small database application from
>> PostgreSQL to SQLite.
>>
>> I have gotten the program to work, but it it about 2 orders of
>> magnitude slower than the PostgreSQL version. In particular, a query
>> like
>>
>>     select distinct clients.* from clients where  lastname like
>> 'Hark%' order by lastname, firstname, middlename;
>>
> Can you post the database file at a place where I can download it or send it
> to my Email address if it is not too big?
>
> Martin
>
> --
> ___
> Lazarus mailing list
> Lazarus@lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
>



-- 
Howard Lee Harkness
(214) 390-4896

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] SQLite performance problem. Simple query takes too long.

2011-07-28 Thread Howard Lee Harkness
I am doing a conversion of a small database application from
PostgreSQL to SQLite.

I have gotten the program to work, but it it about 2 orders of
magnitude slower than the PostgreSQL version. In particular, a query
like

select distinct clients.* from clients where  lastname like
'Hark%' order by lastname, firstname, middlename;

...take nearly 3 seconds, whereas in the PostgreSQL version, it was
done instantly. Before I indexed the clients table on lastname, it was
something like 6 seconds. This is for a table with about 8000 records,
and the above query returns 3 rows. I tried reducing the "order by"
clause to just lastname, but that made no difference. I even removed
the "order by" clause completely, and that made no difference. I tried
without "distinct" and that made no difference. What did make a
difference was running the above query using sqlite3.exe from the
command line -- which was instantaneous. This implies that the LCL
components are taking 3 seconds to do some sort of setup for the
query.

This makes no sense to me. The LCL looks fairly straightforward. Here
is the call:

 qClients.Close;
 qClients.SQL.Text:=sql; // where sql contains the above select statement
 qClients.Open;

The Open step is the one taking the time. The database setup is below,
since I suspect that may be where the problem is. I hope this is
enough info.

Any clue about what is taking so long?

Environment:
Windows 7
SQLite3.dll
Lazarus 9.30 using TSQLite3Connection, TSQLTransaction, TSQLQuery,
TDataSource, TDBGrid

object FormDatabase: TFormDatabase
  Left = 473
  Height = 240
  Top = 169
  Width = 184
  Caption = 'FormDatabase'
  OnDestroy = FormDestroy
  LCLVersion = '0.9.30'
  object SQLite3Connection: TSQLite3Connection
Connected = True
LoginPrompt = False
DatabaseName = 'DB.s3db'
KeepConnection = True
Password = 'test'
Transaction = SQLTransaction
UserName = 'user'
Options = []
left = 53
top = 123
  end
  object SQLTransaction: TSQLTransaction
Active = True
Action = caNone
Database = SQLite3Connection
left = 53
top = 67
  end
end


excerpts from main form:

  object dsClients: TDatasource
DataSet = qClients
OnStateChange = Sync
OnDataChange = dsClientsDataChange
OnUpdateData = Sync
left = 552
top = 64
  end

  object qClients: TSQLQuery
IndexName = 'DEFAULT_ORDER'  // what is this, and why can't I
change it?  I tried IndexFieldNames = 'lastname' but that was EVEN
SLOWER
AutoCalcFields = False
Database = FormDatabase.SQLite3Connection
Transaction = FormDatabase.SQLTransaction
ReadOnly = False
SQL.Strings = (
  'select * from clients'
  'order by lastname,firstname,middlename'
)
Params = <>
left = 504
top = 64
  end

-- 
Howard Lee Harkness

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] SQLitePass package install problems

2011-07-28 Thread Howard Lee Harkness
What is the status of SQLitePass? I went to what was supposed to be a
download page for it (http://source.online.free.fr/), but what appears
to be the only link to download the actual components was a link to a
dead GeoCities page. Is this available anywhere? Has it changed names?
Does it differ from the components in sqlite3laz 0.4?

Speaking of the latter, is there any user documentation for sqlite3laz
*anywhere*?

2010/7/12 K. P. :
> Thanks Jaroslaw,
> it does indeed work - quite different from Delphi. This will teach me not to
> assume too much but rather search for documentation!
> Cheers
> Kai
>
>> Date: Sat, 10 Jul 2010 11:20:23 +0200
>> From: j@poczta.fm
>> To: lazarus@lists.lazarus.freepascal.org
>> Subject: Re: [Lazarus] SQLitePass package install problems
>>
>> from SqlitePass docs:
>>
>> Packages Installation for Lazarus users (>=0.9.20)
>>
>> 1. Uninstall any previous version of SqlitePassDbo components :
>> Choose [Components] [Configure Installed Packages] from IDE menu
>> 2. Select the Laz_SqlitePassDbo_Runtime and
>> Laz_SqlitePassDbo_Designtime packages and click [Uninstall the
>> selection] then [Save and quit the dialog].
>> 3. Compile the Laz_SqlitePassDbo_Runtime package. Compile and
>> install the Designtime package : Choose [File] [Open] from the IDE menu
>> and select
>> ..\SQLitePass\Packages\Lazarus\Laz_SqlitePassDbo_Designtime.lpk. In
>> package dialog, Choose compile - this way, the Laz_SqlitePassDbo_Runtime
>> will automatically be compiled. Then select install to rebuild the IDE.
>> 4. Check installation : Select SqlitePassDbo on Component palette
>> pages and drop a SqlitePassDatabase and a SqlitePassDataset on a new
>> form. Check the components versions are correct in object inspector.
>>
>> it works :)
>>
>> --
>> Doladuj telefon przez Internet.
>> Sprawdz >>> http://linkint.pl/f2778
>>
>>
>> --
>> ___
>> Lazarus mailing list
>> Lazarus@lists.lazarus.freepascal.org
>> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
>
> 
> Hotmail: Free, trusted and rich email service. Get it now.
> --
> ___
> Lazarus mailing list
> Lazarus@lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
>
>



-- 
Howard Lee Harkness
(214) 390-4896

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Problem with SQLite commit in Lazarus

2011-07-27 Thread Howard Lee Harkness
For now, I have a fairly ugly workaround, since I have another more
important task to finish:

The performance of the SQLite database is very poor. I was able to
speed it up a bit by putting indices on most of the commonly-search
columns on the main table, but it's still about 20 to 30 times slower
than the PostgreSQL version that I am replacing. As I slowly get back
up to speed in Lazarus (it's been 3 years since I wrote the last
iteration), it occurs to me that I may need some more sophisticated
tools than I currently have. I also see that the current version of
Lazarus made several subtle changes to the IDE, and I can't even find
the way to get the stack trace anymore. Probably nothing that can't be
solved with sufficient time and effort, but I was really hoping this
migration would be a lot easier.

Is there some way that I can get SQLite to just read all of the tables
into memory during the run of the program? Surely that would speed
things up.

2011/7/27 Max Vlasov :
>
>
> On Wed, Jul 27, 2011 at 6:28 AM, Howard Lee Harkness
>  wrote:
>>
>> I am guessing that I am missing some basic detail in the setup
>> somewhere, or not understanding some subtlety in the operation of
>> SQLite. I would greatly appreciate somebody sending me a clue on how
>> to deal with this. TIA!
>> --
>
>
> Howard, looking at the file
> \fpc\\source\packages\fcl-db\src\sqldb\sqlite\sqlite3conn.pp
> I suggest you to set breakpoints in StartdbTransaction and CommitRetaining
> and look at the call stack for the place that starts and ends the
> transaction without your intervention. The only problem could be the fpc
> sources usually compiled without debug info, don't know whether this
> applicable to fpc packages.
>
> Max
>
> --
> ___
> Lazarus mailing list
> Lazarus@lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
>
>



-- 
Howard Lee Harkness
(214) 390-4896

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] Problem with SQLite commit in Lazarus

2011-07-26 Thread Howard Lee Harkness
I am migrating a small Lazarus database application from PostgreSQL to
SQLite (PostgreSQL was overkill, and I need something which is
zero-config and can run from a flash drive on different machines). In
the process, I have run into several little oddities in the way that
SQLite differs from other DBMs with which I am familiar. Most of them
I have been able to puzzle out, but this one has me befuddled.

I construct an SQL insert statement in variable sql, and then do the following:

FormDatabase.SQLite3Connection.ExecuteDirect(sql);
FormDatabase.SQLite3Connection.ExecuteDirect('commit');

First time through, no problems. Second time through with another row
of data, and I get an exception with a message saying there is no
active transaction when it reaches the commit (both inserts actually
get saved in the table, however). If I omit the commit, nothing gets
saved to the table on exit from the program. If I add the line:

FormDatabase.SQLite3Connection.ExecuteDirect('begin');

...before the lines above, it gives an exception complaining that I
can't nest transactions.

I am guessing that I am missing some basic detail in the setup
somewhere, or not understanding some subtlety in the operation of
SQLite. I would greatly appreciate somebody sending me a clue on how
to deal with this. TIA!
-- 
Howard Lee Harkness

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus