View Issue Details

IDProjectCategoryView StatusLast Update
0034697FPCDatabasepublic2018-12-13 08:48
ReporterValdir Marcos Assigned ToMichael Van Canneyt  
Status resolvedResolutionfixed 
Target Version3.2.0Fixed in Version3.3.1 
Summary0034697: IBConnection - No fields for inclusion in where statement found
DescriptionI have attached a small sample project.

IBConnection doesn't seem to be parsing DML commands from a simple table with primary key.

SQLQuery3.ParseSQL := True;
Steps To ReproduceRun the program;
Click on "TStringField" button. It will open Form3;
Click on "Open for Edit" button. It will load information;
Change information about "Observation" field;
Click on "Save" button. It will show extra information about transactions;
Then, comes the message:

[Debugger Exception Notification]

Project project1 raised exception class 'EDatabaseError' with message:
IBConnection1 : No update query specified and failed to generate one. (No fields for inclusion in where statement found)

 At address 57F999

[Ignore this exception type]

[Break] [Continue]
Additional InformationFirebird 2.5.8

Create Table TableText
  ID Integer Not Null Primary Key,
  Observacao VarChar(1000) Collate Unicode_CI_AI

Insert Into TableText(ID, Observacao) Values(1, 'aaaaaaa');

Select * From TableText;
TagsNo tags attached.
Fixed in Revision1525.
Attached Files


Valdir Marcos

2018-12-13 04:50


Michael Van Canneyt

2018-12-13 08:47

administrator   ~0112529

Last edited: 2018-12-13 08:48

View 2 revisions

I looked at your example. You forgot to include several units, so it did not compile. But I managed.

As for the problem: this is as designed.

If UsePrimaryKeyAsKey is set, the TSQLQuery will determine the primary key of the database table, and will set the ProviderFlags accordingly on the fields (it sets pfInKey on the correct fields).
The ProviderFlags are used to create the update statement.

However, you created persistent fields. In that case UsePrimaryKeyAsKey is ignored.
When there are persistent fields, the TSQLQuery component has no way of knowing if it may change the Providerflags. So, in that case, it is assumed that you set the providerflags correctly for the update statement, because the TSQLQuery will not touch the ProviderFlags properties of the fields.

So what you need to do is set pfInKey on the ID field's providerflags and the update will work.

I have documented this in rev. 1525 of the documentation.

We may think of some additional option for TSQLQuery to update pfInKey anyway in case of persistent fields, but this needs careful consideration.

Maybe a command in the IDE to set pfInKey on the persistent fields is the best way.

Issue History

Date Modified Username Field Change
2018-12-13 04:50 Valdir Marcos New Issue
2018-12-13 04:50 Valdir Marcos File Added: No fields for inclusion in where statement
2018-12-13 08:15 Michael Van Canneyt Assigned To => Michael Van Canneyt
2018-12-13 08:15 Michael Van Canneyt Status new => assigned
2018-12-13 08:16 Michael Van Canneyt Project Lazarus => FPC
2018-12-13 08:47 Michael Van Canneyt Fixed in Revision => 1525.
2018-12-13 08:47 Michael Van Canneyt Note Added: 0112529
2018-12-13 08:47 Michael Van Canneyt Status assigned => resolved
2018-12-13 08:47 Michael Van Canneyt Fixed in Version => 3.3.1
2018-12-13 08:47 Michael Van Canneyt Resolution open => fixed
2018-12-13 08:47 Michael Van Canneyt Target Version => 3.2.0
2018-12-13 08:48 Michael Van Canneyt Note Edited: 0112529 View Revisions