Lazarus 3.0 (2023.12.21.)
Letöltés

  • Oldal:
  • 1

TÉMA:

Válasz:RecordCount 2008 dec. 15 08:34 #273

  • Gábor
  • Gábor profilkép
  • Adminisztrátor
  • Adminisztrátor
  • Hozzászólások: 504
  • Köszönetek: 86
"ha jól sejtem akkor TDBF-el dolgozol vagy valami hasonló rettenettel. Ezekkel az volt a gond, hogy a törölt rekordok valójában nem törlődtek a táblából, csak kaptak egy jelzőt, hogy 'TÖRÖLVE'. Ha jól emlékszem akkor pack -ot kellett csinálni. Talán a TDBF oszálynak van is Pack vagy Packing metódusa."

Minden dBASE változat így működik.




Ezt használd:
function GetExactRecordCount: Integer;

A következőket kimásoltam a TDBF manual -ból:

5.5 Why does RecordCount return too many records?
When no index is active, the RecordCount property returns the total number of records in
the table including deleted ones. When an index is active, it returns a number based upon
internal index tree, usually very large. RecordCount is made for speed, and has the sequential
property, so TDBGrid can approximately show using it’s scrollbar the position of the current
record in the range.
If you need exact number of active records, use the ExactRecordCount function, which is very
slow (it reads all records from beginning to end).

7.7 ExactRecordCount
property ExactRecordCount: Integer read GetExactRecordCount;
Examine ExactRecordCount to determine the exact number of records in the current dataset.
This takes into account deleted, filtered and indexed records. This in contrary to Record-
Count, which will always give a rough upper bound estimate. Note that this property needs
to scan the complete dataset to find the number of records that are active, while RecordCount
is just a simple calculation.
Hogyan kérdezzünk okosan? / Mit kell tennünk kérdezés előtt? -- Lazarus 3.0 -- FPC 3.2-- GNU/Linux 5.15.0 x86_64

Válasz:RecordCount 2008 dec. 10 13:10 #267

  • Thotacc
  • Thotacc profilkép
  • Új tag
  • Új tag
  • Hozzászólások: 8
  • Köszönetek: 0
Üdv,

ha jól sejtem akkor TDBF-el dolgozol vagy valami hasonló rettenettel. Ezekkel az volt a gond, hogy a törölt rekordok valójában nem törlődtek a táblából, csak kaptak egy jelzőt, hogy 'TÖRÖLVE'. Ha jól emlékszem akkor pack -ot kellett csinálni. Talán a TDBF oszálynak van is Pack vagy Packing metódusa.

T.

RecordCount 2008 okt. 01 12:38 #247

  • glaci52
  • glaci52 profilkép Témaindító
  • Új tag
  • Új tag
  • Hozzászólások: 10
  • Köszönetek: 0
Az a problémám, hogy

m:=retegrend.recordcount;

a visszadott értékként, a törölt rekordokat is beszámolja, holott az élő rekordok száma 3.

Milyen parancsot kell adni ahhoz, hogy csak az élő rekordok számát adja vissza.
Köszi.

  • Oldal:
  • 1