TUniTable DeleteWHERE

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
testpresta
Posts: 32
Joined: Sat 07 Jun 2014 19:41

TUniTable DeleteWHERE

Post by testpresta » Wed 09 Jul 2014 14:46

Hello

I want to delete all records that match with a criteria.
I saw DeleteWhere function but there is no argument for the SQL Criteria ?
Should i put it in SQLFilter property ?
If so, i suppose Delete function will erase the full table, even if SQLFilter property is set ?

Thanks

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: TUniTable DeleteWHERE

Post by AlexP » Thu 10 Jul 2014 08:45

Hello,

The DeleteWhere method deletes the WHERE clause in a query http://www.devart.com/unidac/docs/index ... here().htm

To add the WHERE condition, you can use AddWhere
http://www.devart.com/unidac/docs/devar ... tring).htm

In case you want to delete several records that meet a specific condition, you need to write a query manually, for instance:

Code: Select all

UniConnection.ExecSQL('DELETE FROM TABLE WHERE condition');

testpresta
Posts: 32
Joined: Sat 07 Jun 2014 19:41

Re: TUniTable DeleteWHERE

Post by testpresta » Thu 10 Jul 2014 09:36

Thanks

Are you sure AddWhere method is not the same than setting FilterSQL Property ?

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: TUniTable DeleteWHERE

Post by AlexP » Thu 10 Jul 2014 12:44

The FilterSQL property and the AddWHERE method both add the WHERE condition to an SQL query.

testpresta
Posts: 32
Joined: Sat 07 Jun 2014 19:41

Re: TUniTable DeleteWHERE

Post by testpresta » Fri 11 Jul 2014 08:00

In fact i want to know what happens if a set a first filter with FilterSQL. Will AddWhere previous filters replaced ?

Thanks

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: TUniTable DeleteWHERE

Post by AlexP » Mon 14 Jul 2014 08:53

No, when using the AddWhere method, the condition will be added to the existing filter.

Post Reply