Page 1 of 1

Alias returning by fields

Posted: Fri 02 Jun 2017 03:28
by jsmart73
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.

Re: Alias returning by fields

Posted: Fri 02 Jun 2017 11:15
by ViktorV
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.

Re: Alias returning by fields

Posted: Sun 04 Jun 2017 23:18
by jsmart73
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

Re: Alias returning by fields

Posted: Tue 06 Jun 2017 10:14
by ViktorV
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.

Re: Alias returning by fields

Posted: Tue 06 Jun 2017 23:29
by jsmart73
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

Re: Alias returning by fields

Posted: Fri 09 Jun 2017 10:15
by ViktorV
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

Re: Alias returning by fields

Posted: Wed 14 Jun 2017 04:44
by jsmart73
Thanks.
I look forward to the release.

Re: Alias returning by fields

Posted: Thu 15 Jun 2017 14:51
by ViktorV
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