Alias returning by fields

Discussion of open issues, suggestions and bugs regarding IBDAC (InterBase Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
jsmart73
Posts: 4
Joined: Fri 02 Jun 2017 03:21

Alias returning by fields

Post by jsmart73 » Fri 02 Jun 2017 03:28

I am trying to do something like this in an IBCQuery for a Firebird database (2.5):

Code: Select all

insert into my_table (avalue) values (:avalue)
returning my_table_id as new_id, created, created_by
However, the defaulted out parameter is set to ret_my_table_id_as_new_id, not ret_new_id as I was hoping.

Can I alias these fields - Firebird supports this.
FWIW, the returned values are created by triggers on the table.

I'm using version 6.0.1 of Interbase Data Access Components.

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: Alias returning by fields

Post by ViktorV » Fri 02 Jun 2017 11:15

Most likely the impossibility to execute the query is not related to IBDAC functionality, but to Firebird work specificity. You can test it by executing the specified query using the standard means, for example, isql.exe Firebird utility.

jsmart73
Posts: 4
Joined: Fri 02 Jun 2017 03:21

Re: Alias returning by fields

Post by jsmart73 » Sun 04 Jun 2017 23:18

No, it's the IBDAC components auto parsing of the return parameters that are the problem. The SQL statement is fine.

I'm after a way of making a generic name for the return parameter so I can read it from a common procedure (ideally). IMO, IBDAC should be able to support this.

Thanks

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: Alias returning by fields

Post by ViktorV » Tue 06 Jun 2017 10:14

In order to get a detailed answer, please compose a small sample demonstrating the required functionality and send it to us using the contact form h[url]ttps://www.devart.com/company/contactform.html[/url] including scripts for creating and filling database objects.

jsmart73
Posts: 4
Joined: Fri 02 Jun 2017 03:21

Re: Alias returning by fields

Post by jsmart73 » Tue 06 Jun 2017 23:29

I'm not sure that it's necessary, really.
Just copy and paste the provided insert sql statement I provided above (as is) into an IBCQuery component, then check the parameters tab where it shows the returning names with ret_ prefixed. You'll see exactly the problem. The table name / field names are irrelevant. You don't need a connection or to execute anything. Simply copy/paste the sql statement and view the parameters.

Thanks

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: Alias returning by fields

Post by ViktorV » Fri 09 Jun 2017 10:15

We changed the behavior and this fix will be included in the next IBDAC build: now if aliases are used in the returning clause, then the parameter name will be set to RET_AliasName.
For the fields, that are specified after RETURNING, there are automatically generated output parameters with the RET_ prefix. This is described in the documentation: https://www.devart.com/ibdac/docs/index ... ataset.htm

jsmart73
Posts: 4
Joined: Fri 02 Jun 2017 03:21

Re: Alias returning by fields

Post by jsmart73 » Wed 14 Jun 2017 04:44

Thanks.
I look forward to the release.

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: Alias returning by fields

Post by ViktorV » Thu 15 Jun 2017 14:51

Thank you for interest to our product and your contribution in our product development.
You can follow the news about IBDAC releases in the at https://www.devart.com/news

Post Reply