Problem with 1.11

Pete Gates pete at fxlibrary.co.uk
Wed Apr 26 21:10:13 CDT 2006


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?

Thanks,
Pete Gates



More information about the Valentina mailing list