Complex event processing cannot be specified using SQL data type when RDB referencing is used.
The JDBC driver temporarily converts SQL data types to generic SQL types (java.sql.Types), and then to complex event processing language data types. The following table shows the complex event processing language data types corresponding to the generic SQL types.
Refer to the manual of the relevant JDBC driver for information on the generic SQL types corresponding to each SQL data type. Refer to "1.1.6 Data Type" for information on the data types for the complex event processing language.
Generic SQL types defined using java.sql.Types | Complex event processing language data type |
---|---|
CHAR VARCHAR LONGVARCHAR | string |
BOOLEAN BIT | bool/boolean |
SMALLINT | short |
INTEGER | int/integer |
BIGINT | long |
REAL | float |
DOUBLE FLOAT | double |
Some generic SQL types that do not appear in the above correspondence table can be used if you convert the type.
General SQL types defined using java.sql.Types | Type conversion method | Complex event processing language data type |
---|---|---|
NUMERIC DECIMAL | Cast using bool, short, byte, int, long, float, or double. If the data size is greater than the conversion destination data type, data may be lost. | Type specified using cast |
DATE TIME TIMESTAMP | Add the toString() method. | string |
Other SQL types that do not appear above cannot be used with the complex event processing language.
Example
Example of mapping between Symfoware Server (referencing with native interface) data types and complex event processing language data types
Symfoware Server (referencing with native interface) SQL data types and complex event processing language data types are converted as shown below.
Refer to the manual of Symfoware Server for information on conversion between Symfoware Server SQL data types and generic SQL types.
Category | Symfoware Server SQL data type | Complex event processing language data type |
---|---|---|
Exact numeric type | SMALLINT | short |
INTEGER | int/integer | |
NUMERIC | Cast using bool, short, byte, int, long, float, or double. | |
Approximate numeric type | REAL | float |
FLOAT(p) p=1 to 23 | float | |
FLOAT(p) p=24 to 52 | double | |
DOUBLE PRECISION | double | |
Datetime type | DATE | Add the toString() method. |
TIME | ||
TIMESTAMP | ||
String type | CHARACTER | string |
VARCHAR | string | |
Language string types | NCHAR | string |
NCHAR VARYING | string | |
Other | BLOB | Not supported |
ROW_ID | ||
INTERVAL YEAR TO MONTH | ||
INTERVAL YEAR | ||
INTERVAL MONTH | ||
INTERVAL DAY TO HOUR | ||
INTERVAL DAY TO MINUTE | ||
INTERVAL DAY TO SECOND | ||
INTERVAL DAY | ||
INTERVAL HOUR TO SECOND | ||
INTERVAL HOUR | ||
INTERVAL MINUTE TO SECOND | ||
INTERVAL MINUTE | ||
INTERVAL SECOND |
Example
The following example shows complex event processing for outputting "M_DATE" when the input event "E1", which has the "id" and "e_date" string types as properties, is input and the "M_DATE" date in the "MY_DB" database is earlier than "e_date".
@Name('EPL1') select E1.id, db1.M_DATE.toString() from E1, sql:my_db ['SELECT M_DATE FROM MY_TBL'] as db1 where db1.M_DATE.toString()>E1.e_date;
The following example shows complex event processing for outputting "PRICE" when the input event "E2", which has the "id" string type and the "value" int type as properties, is input and the value of "PRICE" in the "MY_DB" database is greater than "value".
@Name('EPL2') select E2.id, cast(db2.PRICE, double) from E2, sql:mydb_db ['SELECT PRICE FROM MY_TBL'] as db2 where cast(db2.PRICE, double)>E2.value;