Schemas

Every query in SQL Designer is originally derived from a Schema.  A schema is basically a collection of meta-data that describes the database objects and the relationships that exist between those objects.  The schema effectively describes what tables and fields may be used in a query and holds the rules and methods that determine how queries may be constructed when using that schema.

 

Editing Schemas

There are two ways to edit a schema using the sample application. You may load a query from the left hand panel and then click on the edit link shown here, or, you may choose an option from the Schema menu at the top of the application.

 

Once a schema is loaded, or, a new schema created, the Schema Editor form is displayed, allowing you to construct and/or edit the schema's objects and properties.

 

SQL Designer provides a simple mechanism for presenting the user with a fully assembled schema editor form that can be invoked simply by instantiating the fSchema form, assigning the cSchema object property and displaying the form.  This method is demonstrated in the sample application.  It is also worth mentioning here that all of the individual components of SQL Designer's Schema Editor (Schema Panel Design Surface, Field Editor, and Property Panel) are also exposed and documented. If your application demands substantially more flexibility than with the pre-built editor allows, you may easily construct your own schema editor environment within your host application.

 

 

Functions Available From the Schema Editor

Once the schema editor is invoked as shown here, you are provided with access to the following:

 

 

Identifying Schemas

Every schema maintains a GUID property that uniquely identifies the schema. When SQL Designer loads a Query, it makes a request to the host application for the schema on which the query was based.  It does this by raising the SchemaNeeded event which requests a reference to the schema by using its GUID.

 

By using GUID identifiers, the host application has the option to save schemas on the file system, using the GUID as the file name, or, by using the GUID as a key for storing the definition in the database or other persistent repository.

 

It is also worth noting here that Query definitions also have a GUID property and schemas can include references to query definitions as part of their table meta data.  for additional information on this approach, see the topic on Queries.