From wiki.ginstr.com
Jump to: navigation, search
(XML Attributes Description)
m (formatting)
Line 1: Line 1:
 +
<div style="float:right; clear:both; margin-left:0.5em;">__TOC__</div>
 
=queries.xml=
 
=queries.xml=
 
[[Category:XML_files]]
 
[[Category:XML_files]]
Line 12: Line 13:
 
! scope="col" | Description
 
! scope="col" | Description
 
|-
 
|-
| title="Attribute" | id
+
| title="Attribute" | <code>id</code>
 
| title="Description" | represents a <code>view</code> name
 
| title="Description" | represents a <code>view</code> name
 
|-
 
|-
| title="Attribute" | columns
+
| title="Attribute" | <code>columns</code>
 
| title="Description" | represents a list of column names which belong to the same table and will be a part of query result
 
| title="Description" | represents a list of column names which belong to the same table and will be a part of query result
 
|-
 
|-
| title="Attribute" | keys
+
| title="Attribute" | <code>keys</code>
 
| title="Description" | represents a list of <code>view</code> keys (column names) which belong to the same table and will be used to query the data
 
| title="Description" | represents a list of <code>view</code> keys (column names) which belong to the same table and will be used to query the data
 
|-
 
|-
| title="Attribute" | type
+
| title="Attribute" | <code>type</code>
 
| title="Description" | represents a list of query types
 
| title="Description" | represents a list of query types
  
Line 73: Line 74:
 
! scope="col" | Description
 
! scope="col" | Description
 
|-
 
|-
| title="Attribute" | AND
+
| title="Attribute" | <code>AND</code>
 
| title="Description" | returns documents for key group ('''default value''')
 
| title="Description" | returns documents for key group ('''default value''')
 
|-
 
|-
| title="Attribute" | OR
+
| title="Attribute" | <code>OR</code>
 
| title="Description" | returns documents for each key in key group
 
| title="Description" | returns documents for each key in key group
 
|-
 
|-
| title="Attribute" | INDEX
+
| title="Attribute" | <code>INDEX</code>
 
| title="Description" | returns list of document ids for key group
 
| title="Description" | returns list of document ids for key group
 
|}
 
|}

Revision as of 21:24, 12 July 2017

queries.xml

queries.xml is an XML file located in app/database/ folder.
This file contains all queries which are used to read any data from the database.
It is necessary to create a "layout" for that data which is identical to the persistent storage structure. These "layouts" are called views. Once a view is created data is copied based on query from the database view into the persistent storage structure.

XML Attributes Description

Attribute Description
id represents a view name
columns represents a list of column names which belong to the same table and will be a part of query result
keys represents a list of view keys (column names) which belong to the same table and will be used to query the data
type represents a list of query types

More information here

Example

<?xml version="1.0" encoding="utf-8"?>
<queries>
  <query 
    id="employeesByRecordId" 
    columns="
      employee_firstName,
      employee_lastName"
    keys="_id" />

  <query id="employeesByNFCTag" 
    columns="
      employee_firstName,
      employee_lastName"
    keys="employee_NFCtag" />

  <query id="devicesOverviewByNameAndFacilitySortByName" 
    columns="
      device_name,
      device_sequenceNo,
      device_buildingZone,
      device_floor,
      device_location,
      device_NFCtag"
    keys="device_facility,device_name" />

  <query 
    id="driversByFirstAndLastName" 
    columns="
      Driver_firstName,
      Driver_lastName,
      Driver_firstAndLastName,
      Driver_comments,
      Driver_subName"
    type="INDEX"
    keys="Driver_firstName,Driver_lastName" />
</queries>

View types

View type Description
AND returns documents for key group (default value)
OR returns documents for each key in key group
INDEX returns list of document ids for key group