On 2021-08-19 15:17, Adriano dos Santos Fernandes wrote:
Since RETURNING was created, we change values of isc_info_sql_stmt_type
so clients can understand that statements with RETURNING have values.
With GH-6815, RETURNING will return cursors (except for INSERT INTO ...
VALUES RETURNING which works as before).
Should we avoid mangle isc_info_sql_stmt_type for cursor-based
RETURNING, as there is isc_info_sql_stmt_flags since v3 which is able
to
put FLAG_HAS_CURSOR and make client know it must open a cursor, while
still know the statement type?
I think the biggest concern here is older tools or drivers that are not
aware of isc_info_sql_stmt_flags, but do use isc_info_sql_stmt_type to
inform how to handle/execute a statement, and would thus not be able to
handle this correctly. Given we already 'abuse' isc_info_sql_stmt_type
by returning isc_info_sql_stmt_exec_procedure for current RETURNING
statements, I think returning isc_info_sql_stmt_select for the new
situation is acceptable and probably even necessary.
If we want/need some API to correctly identify the type of statement
even when RETURNING is present, we would need to add yet another info
item (e.g. isc_info_sql_stmt_type2 or isc_info_sql_real_stmt_type, or
something like that and then maybe deprecate isc_info_sql_stmt_type in
favour of the new statement type item and isc_info_sql_stmt_flags).
As an aside, I wasn't aware of the existence of isc_info_sql_stmt_flags,
and I haven't been able to find a mention in, for example, the release
notes, nor in the doc directory. As such, this is an undocumented API,
and you can't expect people to use it.
Mark
Firebird-Devel mailing list, web interface at
https://lists.sourceforge.net/lists/listinfo/firebird-devel