[yunqa.de] Re: sort table question

  • From: "Radovan Antloga" <radovan.antloga@xxxxxxxx>
  • To: <yunqa@xxxxxxxxxxxxx>
  • Date: Fri, 19 Oct 2007 16:13:43 +0200

I would like to explain more. I connect to same test.db3
with SQLiteSpy or with my program. I do nothing special
in my program in D7. Table has 18903 records. I don't
understand why SQLiteSpy takes aprox. same time (about
4 seconds) always but my program is not. When I change
with PRAGMA temp_store = memory I get about same
time (~1 second) every time. Why using file temp tables in
SQLiteSpy works ok but not in my program.

Here is my code:

program test1;

{$APPTYPE CONSOLE}

uses
 Windows, SysUtils,
 DISQLite3Api, DISQLite3Collations;

var
 DB: sqlite3;
 t: cardinal;
 i: integer;

begin
 Set8087CW($133F);

 sqlite3_check(sqlite3_open(PAnsiChar('test.db3'), @DB), DB);

 sqlite3_create_collation(// Compile Error? Read first comment above!
       DB, // Handle to database
       'SYSTEM', // The new collations's name.
       SQLITE_UTF16, // String encoding for function callback.
       nil, // User data.
       SQLite3_Compare_System_UTF16LE); // Function callback

 sqlite3_create_collation(
       DB,
       'SYSTEMNOCASE',
       SQLITE_UTF16,
       nil,
       SQLite3_Compare_System_NoCase_UTF16LE);

 for i := 1 to 30 do
 begin
   t := GetTickCount;

sqlite3_check(sqlite3_exec(DB, PAnsiChar('select * from person order by name'), nil, nil, nil), DB);

writeln(IntToStr(i) + ' time: ' + FormatFloat('#,##0', GetTickCount - t));
 end;

 sqlite3_check(sqlite3_close(DB), DB);

 WriteLn('Done - Press ENTER to Exit');
 ReadLn;
end.

Regards,
Radovan
_______________________________________________
Delphi Inspiration mailing list
yunqa@xxxxxxxxxxxxx
//www.freelists.org/list/yunqa



Other related posts: