sort order columns in ibconnection.pp

System Information

  • Operating system: all
  • Processor architecture: all
  • Compiler version: trunc

Steps to reproduce

Create a table in a firebird database. For example:

CREATE TABLE CUSTOMER ( ID integer NOT NULL, CUSTOMER_NAME varchar(200), ADDRESS_LINE varchar(200), PLZ varchar(20), CITY varchar(200), EMAIL varchar(50), BANK varchar(50), BIC varchar(50), IBAN varchar(50), CONSTRAINT PK_CUSTOMER_0 PRIMARY KEY (ID) );

Create a new project in Lazarus, add IBConnection, SQLTransaction and SQLQuery and set necessary properties. Open "Edit all SQL statements" by right click on SQLQuery. Select table CUSTOMER in "Table and Fields"

What is the current bug behavior?

The sort order in "Key fields" and "Select/Update/Insert fields" is by field_name

What is the expected (correct) behavior?

The sort order in "Key fields" and "Select/Update/Insert fields" should be by rdb$field_position

Possible fixes

The function TIBConnection.GetSchemaInfoSQL(stColumns,... returns ... ORDER BY r.rdb$field_name instead of ... ORDER BY r.rdb$field_position

ibconnection.pp.patch