Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Delphi TTable with filter does not work
"Jan Doggen" <massoft_at_tref.nl> wrote
> we're accessing Oracle 8 tables through TCP/IP with Delphi 4 (+BDE).
>
> TTables with a filter seem to randomly work/not work.
<snipped>
Not sure what the problem is, but it is a Very Bad Idea (tm) to use TTable filters in Delphi.
The filters that are applied locally. This causes an increase in memory requirements as Delphi needs the full contents of the cursor. It also means that the filtering is done locally and not (as it should) by the RDBMS via a WHERE clause. In addition, by using filters on a cursor, you can also make mistakes ito locking.. thinking that you are only locking the rows filtered when you are in fact locking the entire database cursor. Local filters are simply not something I would recommend when developing client-server software in Delphi (or VB for that matter).
The purpose of the filter method of the TTable class IMO is for use with file-based databases such as MS-Access, dBASE, FoxPro and the like. Not for using against a dinkum database server which has none of the limitation of a local file-based database.
Let me explain. The traditional local file-base approach:
-- OPEN file.table CREATE & APPLY FILTER 'where clientid=123' READ file.table INTO record PROCESS record UPDATE record -- Applying the same logic in SQL does not make sense: -- cursor: SELECT * FROM clients cursor:filter = 'clientid=123' PROCESS cursor:record -- You are accessing the _entire_ table in the database. A simple 'SELECT * FROM clients WHERE clientid=123' is what SQL and RDBMS are designed for. Even if you are applying a SQL WHERE clause, I still can not see any good reasons for wanting to apply additional local filters to that cursor and not using SQL as intended. -- BillyReceived on Thu Sep 20 2001 - 04:55:01 CDT