![]() |
OpenSplice C# API
v6.x
OpenSplice C# Data Distribution Service Data-Centric Publish-Subscribe API
|
A subset of SQL syntax is used in several parts of OpenSplice:
Those expressions may use a subset of SQL, extended with the possibility to use program variables in the SQL expression. The allowed SQL expressions are defined with the BNF-grammar below. The following notational conventions are made:
Expression::= FilterExpression
| TopicExpression
| QueryExpression
FilterExpression::= Condition
TopicExpression::= SelectFrom {Where } ‘;’
QueryExpression::= {Condition}{‘ORDER BY’ (FIELDNAME // ‘,’) }
SelectFrom::= ‘SELECT’ Aggregation ‘FROM’ Selection
Aggregation::= ‘*’
| (SubjectFieldSpec // ‘,’)
SubjectFieldSpec::= FIELDNAME
| FIELDNAME ‘AS’ FIELDNAME
| FIELDNAME FIELDNAME
Selection::= TOPICNAME
| TOPICTNAME NaturalJoin JoinItem
JoinItem::= TOPICNAME
| TOPICNAME NaturalJoin JoinItem
| ‘(’ TOPICNAME NaturalJoin JoinItem ‘)’
NaturalJoin::= ‘INNER NATURAL JOIN’
| ‘NATURAL JOIN’
| ‘NATURAL INNER JOIN’
Where::= ‘WHERE’ Condition
Condition::= Predicate
| Condition ‘AND’ Condition
| Condition ‘OR’ Condition
| ‘NOT’ Condition
| ‘(’ Condition ‘)’
Predicate::= ComparisonPredicate
| BetweenPredicate
ComparisonPredicate::= FIELDNAME RelOp Parameter
| Parameter RelOp FIELDNAME
BetweenPredicate::= FIELDNAME ‘BETWEEN’ Range
| FIELDNAME ‘NOT BETWEEN’ Range
RelOp::= ‘=’ | ‘>’ | ‘>=’ | ‘<’ | ‘<=’ | ‘<>’ | like
Range::= Parameter ‘AND’ Parameter
Parameter::= INTEGERVALUE
| FLOATVALUE
| STRING
| ENUMERATEDVALUE
| PARAMETER
Note: INNER NATURAL JOIN, NATURAL JOIN, and NATURAL INNER JOIN are all aliases, in the sense that they have the same semantics. The aliases are all supported because they all are part of the SQL standard.
The syntax and meaning of the tokens used in the SQL grammar is described as follows:
Note: when RelOp is ‘like’, Unix filename wildcards must be used for strings instead of the normal SQL wildcards. This means any one character is ‘?’, any zero or more characters is ‘*’
Assuming Topic “Location” has as an associated type a structure with fields “flight_name, x, y, z”, and Topic “FlightPlan” has as fields “flight_id, source, destination”. The following are examples of using these expressions.
Example of a topic_expression:
SELECT flight_name, x, y, z AS height FROM ‘Location’ NATURAL JOIN ‘FlightPlan’ WHERE height < 1000 AND x < 23
Example of a query_expression or a filter_expression:
height < 1000 AND x <23