Skip to main content

Queries

CSP supports several different ways to query Caché:

Ways to Query Caché
Query Type CSP Tag and Attributes Description
Class Query

<csp:query>

  • name — reference for the returned %ResultSetOpens in a new tab object

  • classname— name of the class containing the query

  • queryname — name of the query

  • P1,P2,...,PN — query parameter values

Executes a class query defined in a Caché class. Returns a %ResultSetOpens in a new tab object. Use <csp:while> to iterate through the result set.

Dynamic SQL

<script>

  • language — value is sql

  • name — reference for the returned %ResultSetOpens in a new tab object

  • P1,P2,...,PN — query parameter values

  • mode — Runtime mode for the query: Logical, ODBC, Display, or System

Executes the query in-line in the CSP code. Returns a %ResultSetOpens in a new tab object. Use <csp:while> to iterate through the result set.

More Ways to Query Caché
Query Type CSP Tag and Attributes Description
Embedded SQL

<script>

  • language — for cursor based, the value is sql. For non-cursor based, the value is esql

  • cursor — for cursor based only, reference for the cursor.

  • mode — Runtime mode for the query: Logical, ODBC, Display, or System

Supports both cursor and non-cursor based. For non-cursor based, only the language attribute is supported. For cursor-based, use <csp:while> to iterate through the result set. The <csp:while> tag supports the cursor and into attributes. The value should be the same as that in the <script> tag. The value of into is the list of variables containing the query results.

Note:

For an example of using a <csp:query> tag to execute a Class Query, see the CSP Tags: <csp:query> section of Part I of this tutorial.

To learn more about using SQL with CSP, read the discusion of “SQL” in the Tag-Based Development with CSP section of Using Caché Server Pages.

To learn more about Embedded SQL in Caché, read Embedded SQL in Using Caché SQL. To learn more about Dynamic SQL in Caché read Dynamic SQL in Using Caché SQL.

FeedbackOpens in a new tab