Apama 10.15.4 | Connecting Apama Applications to External Components | Standard IAF Plug-ins | The Database Connector IAF Adapter (ADBC) | The ADBC Event application programming interface | Named queries
 
Named queries
 
Using named queries
Creating named queries
Apama applications can use named queries. Named queries are templates with parameterized values and are stored in Apama projects. Queries of this type provide advantages for queries that will be used multiple times. They also serve to keep the SQL query strings separate from the application's EPL code.
To use a named query, your EPL code needs to specify the query template name and the template parameter names and values to use when it initializes the query. The template name and parameters are used when the query is submitted to the database.
You define a named query as a query template in the ADBC adapter's ADBC-queryTemplates-SQL.xml file. This file contains some pre-built named queries:
*findEarliest — Get the row with the earliest time (based on the stored event's timestamp).
*findLatest — Get the row with the latest time.
*getCount — Get the number of rows in a table.
*findAll — Get all the rows from a table.
*findAllSorted — Get all the rows from a table ordered by column.