Details
-
Task
-
Status: Open (View Workflow)
-
Critical
-
Resolution: Unresolved
-
None
-
None
Description
Oracle supports the DBMS_SQL package which allows dynamic SQL with describing SQL statement in and out parameters to support fully dynamic SQL. There are much metadata that can be gotten from a SQL statement though, which would require a lot of functions to be implemented for this in MariaDB. My suggestion is instead to create just one statement to describe a prepared SQL statement and that the output of this is a JSON struct that contains all relevant data.
For example:
DECLARE
|
sql_desc JSON;
|
BEGIN
|
PREPARE s1 FROM 'SELECT c1 col1, c2 col2 FROM tab1 t1 WHERE col1 > ?'; |
DESCRIBE s1 INTO JSON sql_desc; |
...
|
END; |
Where the JSON in sql_desc describes the returned data:
{"fields": [{"name": "c1", "org_name": "col1", "table": "t1", "org_table": "tab1", "length": 11, "type": "INTEGER"},
|
{"name": "c2", "org_name": "col2", "table": "t1", "org_table": "tab1", "length": 10, "type": "VARCHAR"}],
|
"params": {"count": 1}}
|
Attachments
Issue Links
- relates to
-
MDEV-35697 Script/routine to parse SQL enough to enumerate real used tables.
- Open