Problem with 1.11

Pete Gates pete at fxlibrary.co.uk
Wed Apr 26 22:03:31 CDT 2006


**

>Hi Pete,
>
>So I assume this is VCOM 1.11, Windows, Delphi. Right?
No, it's the C DLL being called from Delphi.

>Advice from start. If you need so intensive updates, and IF you do not use
>and not going to use REMOTE server, then use not SQL but API way. IT will
>work in TIMES faster.
Where is the API way described, I can only find SQL info? How can I do a search via API?

I'm hoping I've got it fixed, it looks like a cursor wasn't being released - hopefully!

Thanks,
Pete

>/ Hi,
/>/ I've got a table structure like this (Version 1.11 Valentina):
/>/ 
/>/ CREATE TABLE system
/>/ (key String(64,"ASCII") NOT NULL UNIQUE INDEXED,
/>/ stringdata VarChar(200,"ASCII"),
/>/ intdata Long,
/>/ booldata Boolean);
/>/ 
/>/ I'm doing a rapid modification of 1 row (there are only half a dozen
/>/ rows in the table) and after several 10s of thousands of updates, access
/>/ to the database slows to a crawl - only an update a second. Accessing
/>/ other tables also becomes very slow.
/>/ 
/>/ Delphi code but you'll get the idea (also as a separate question is
/>/ there a single 'INSERT OR UPDATE' statement?):
/>/ 
/>/ var
/>/   search: CursorRef;
/>/ begin
/>/   search := DataBase_SqlSelect(userdb, pchar(format('SELECT * FROM
/>/ system WHERE key=%s', [QuotedStr(key)])), kServer, kReadWrite, kRandom);
/>/   if Cursor_GetRecordCount(search) > 0 then
/>/   begin
/>/     Field_PutString(Cursor_GetField(search, 'stringdata'),
/>/ pchar(value.k_string));
/>/     Field_PutLong(Cursor_GetField(search, 'intdata'), value.k_int);
/>/     Field_PutBoolean(Cursor_GetField(search, 'booldata'),
/>/ byte(value.k_bool));
/>/     Cursor_Updaterecord(search);
/>/     Cursor_Remove(search);
/>/   end else
/>/   begin
/>/     Cursor_Setblank(search);
/>/     Field_PutString(Cursor_GetField(search, 'key'), pchar(key));
/>/     Field_PutString(Cursor_GetField(search, 'stringdata'),
/>/ pchar(value.k_string));
/>/     Field_PutLong(Cursor_GetField(search, 'intdata'), value.k_int);
/>/     Field_PutBoolean(Cursor_GetField(search, 'booldata'),
/>/ byte(value.k_bool));
/>/     Cursor_Addrecord(search);
/>/     Cursor_Remove(search);
/>/   end;
/>/   DataBase_Flush(userdb);
/>/ 
/>/ Any ideas?
/



More information about the Valentina mailing list