Data model is a representaion of a database used by query builder.
It defines the following main parameters:
Data model can be created and modified by the special utility called “Data Model Editor”. The created model can be stored into XML file for future use.
What are the main parts of data model?
Table in data model represents one table in database but one table in database can be represented several times in our data model through table aliases (see working with table aliases topic for details). Tables are now shown to the end user - they are necessary only for internal using since Easy Query needs to know which tables can be used and how they should be linked to each other. Usually you starts data model definition from the adding tables and specifying the links between them.
Each entity in data model represents for your end user some object from the real word (e.g. Customer, Order, Employee, etc.). Each entity can contans several attributes, for example “Customer name”, “Number of orders”, “Company address”, “Tax fee”, etc. In most cases an entity attribute corresponds to some field in database table but it is not obligatory. You can define more compound attributes which will be calculated by some expression. For example you have “USERS” table in your database which have fields “FirstName” and “LastName”. You can represent these fields by corresponding attribute in your data model and additionally you can define new attribute (let call it “Full Name”) which will be calculated as FirstName + ' ' + LastName. Each entity attribute in data model can have one or more value editors where the developer can specify list of available values for this attribute (so the user will need to select one of those values) or some other requirements for user input corresponded to this attribute. Additionally each entity attribute has list of available operator (about operators - see below). First operator in list is the default one - it will be selected automatically when user selects the entity attribute when create query condition.
Operator represents and some logical comparison or other predicate (e.g. LIKE, IN, BETWEEN, etc) used to define query conditions. For example: “is equal to”, “is less than”, “starts with”, etc. Each operator defines the way it will be represented for user (e.g. “is not equal to”), the expression which will be used in result SQL statement (for previous example it will be <>) and several other parameters (for example an operator contains list of types which it can be used for).
You can maintain multiple data dictionaries and let your user switch between them at run-time.