CREATE TABLE TERMINAL_SAYIM(
KayitId Integer NOT NULL PRIMARY KEY AUTOINCREMENT,
AdresKodu Char(30) not null,
BelgeNo Char(30) not null,
BelgeTarihi DateTime not null,
LokasyonKodu Char(30) not null,
BolgeKodu Char(30) not null,
GozKodu Char(30) not null,
SSCC Char(30) not null,
SSCCKapandi Char(1),
Barkod Char(30) not null,
Miktar Integer not null check(miktar > 0),
OlcuBirimi Char(10),
Kontrolsuz Char(1) not null,
TekParca Char(1) not null,
TekParcaIndex Integer not null,
TerminalId Char(30),
KullaniciKodu Char(30),
OkutmaTarihSaati DateTime NOT NULL,
SeriNo Char(25),
Lot Char(25),
SKT Char(10),
IslemTuru Char(2),
Eslesti Char(1),
Nakledildi Char(1)
);
create index Idx_TERMINAL_SAYIM_AdresKodu on TERMINAL_SAYIM(AdresKodu asc);
create index Idx_TERMINAL_SAYIM_BelgeNo on TERMINAL_SAYIM(BelgeNo asc);
create index Idx_TERMINAL_SAYIM_LokasyonKodu on TERMINAL_SAYIM(LokasyonKodu asc);
create index Idx_TERMINAL_SAYIM_BolgeKodu on TERMINAL_SAYIM(BolgeKodu asc);
create index Idx_TERMINAL_SAYIM_GozKodu on TERMINAL_SAYIM(GozKodu asc);
create index Idx_TERMINAL_SAYIM_SSCC on TERMINAL_SAYIM(SSCC asc);
Not to offend you, just my 2 cents: Since application is targeted for WinCE (low CPU and hardware) I am trying to code it as fast as possible. "FieldByName" in your suggestion, first searches the field name among active fields. When find it returns index number. Finally the result. So, few ticks slower than "Fields[0]" usage.Don't worry, I don't get offended so easily! :) Since count(miktar) is the only field returned, I doubt q.Fields[0] will be much faster then q.FieldByName(''), but ok I got your point.
his problem I am facing will be only once/twice of the application usage. TryStrToInt will mostly work like IntToStr. Will raise an internal exception (which is controlled in function) very rarely. So, I'm fine with that at the moment.StrToIntDef will do it just fine, you still should check though why count() returns other then 0 when the table is empty? Is the field null somehow? I just checked(firebird 2.5), count returns 0 even if the table is empty.
My real wish is that AsInteger gets an internal control. If is null, return 0.That would be wrong. You must somehow differentiate between null and 0. By the way, it's working fine at my side(Lazrus Trunk/FPC 3.0.0). The field is 0 even on empty table.