0

Is there any way to get a list of the input parameters and their types and output parameters and their types for any MySQL command? I am primarily interested in select statements and stored procedure calls. I don't want to execute the command to get the information.

With Microsoft SQL Server, this information can be obtained from sys.sp_describe_first_result_set as described in New Metadata Discovery Features in SQL Server 2012.

I am open to any automate-able solutions that I can use. Ideally, it would be a stored procedure I could call or a native library I could wrap.

2015-12-11 Update

Is is possible to prepare a statement and then get the input and output types? For example, I can prepare, execute and deallocate a statement like so:

prepare stmt1 * from 'select * guestbook.entries';
execute stmt1;
deallocate prepare stmt1;

After preparing the statement, is it possible to query for metadata about the statement? The C API Prepared Statement Type Codes gives me hope. I didn't see anything like that in the .NET API.

The mysql_stmt_result_metadata docs looks really promising:

enter image description here

Cameron Taggart
  • 5,771
  • 4
  • 45
  • 70
  • I don't think there is anything similar to `sys.sp_describe_first_result_set`. You might have to create your own proc for MySQL. – zedfoxus Dec 11 '15 at 04:33
  • I custom proc is an acceptable solution. If you know what the proc would be, please add it as an answer. – Cameron Taggart Dec 11 '15 at 16:55
  • have a read about getting this information from the information_schema : [stored routines metadata](https://dev.mysql.com/doc/refman/5.7/en/stored-routines-metadata.html) – amdixon Dec 12 '15 at 01:03

0 Answers0