[CONC-347] Add new api function mariadb_stmt_fetch_fields Created: 2018-07-25  Updated: 2021-05-10  Resolved: 2021-05-10

Status: Closed
Project: MariaDB Connector/C
Component/s: Documentation
Affects Version/s: None
Fix Version/s: 3.1.0

Type: Task Priority: Major
Reporter: Georg Richter Assignee: Georg Richter
Resolution: Fixed Votes: 0
Labels: None


 Description   

To get metadata information for the binary protocol (prepared statements), a resultset handle must be allocated via mysql_stmt_result_metadata() which contains a pointer to stmt-> fields. Afterwards this handle must be released via mysql_free_result().

Instead of allocating and freeing memory it would be much simpler to have an additional API function mariadb_stmt_fetch_fields() which just returns stmt->fields:

MYSQL_FIELD STDCALL *mariadb_stmt_fetch_fields(MYSQL_STMT *stmt)
{
  if (stmt)
    return stmt->fields;
  return NULL;
}



 Comments   
Comment by Georg Richter [ 2018-07-25 ]

Hi, can you please review - implementation can be found in cc_python branch.

Comment by Lawrin Novitsky [ 2018-07-25 ]

Are you sure that you should do the same in mysql_stmt_result_metadata? i.e. only copy pointer to fields from stmt. What if application somehow stores and uses that MYSQL_RES structure after stmt handler somehow changed? well, probably effectively means closed. I can't think of any good reason for that, but still.
Currently, C/ODBC can use only new mariadb_stmt_fetch_fields. Thus it won't lose much, if mysql_stmt_result_metadata stays as is.

Generated at Thu Feb 08 03:04:40 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.