Xbasic
a5_sql_schema_to_json Function
Syntax
C jsonSchema = a5_sql_schema_to_json(sn as SQL::Schema [, options as C])
Arguments
- snSQL::Schema
A SQL::Schema object.
- optionsCharacter
Description
Generates a JSON object describing a schema for a SQL database.
Discussion
The a5_sql_schema_to_json() Function takes a schema of a SQL database and generates a JSON representation of the schema showing all tables in the database, and their relationships.
Type the following commands in the Interactive window:
dim cn as SQL::Connection
?cn.Open("::Name::northwind")
= .T.
dim sn as SQL::Schema
?cn.GetSchema(sn)
= .T.
dim jsonSchema as C
jsonSchema = a5_sql_schema_to_json(sn,"{ show_field_type_info : true }")
showvar( jsonSchema)See Also