| <!ELEMENT sapi:sql - O EMPTY> <!ATTLIST sapi:sql -- SQL query -- query %Text #REQUIRED -- query content - type %Text #REQUIRED -- type of query -- name %Text #REQUIRED -- name of CMS environment variable -- title %Text #IMPLIED -- element title -- > |
Start tag: mandatory, End tag: omitted
Attributes definition
query = %Text [CN]
Mandatory. The value of this attribute contains a SQL query to the CMS data repository.
type = %Text [CN]
Mandatory. The value of this attribute contains the query type value.
name = %Text [CN]
Mandatory. The value of this attribute contains the name of the target CMS environment variable.
title = %Text [CN]
Mandatory. The value of this attribute contains the element title.
SAPI can directly interact with a database. For this purpose a CMS environment variable containing an associated array of query values should be created using the SAPI:SQL element. The value of the variable can be returned by the SAPI:APPLY element. For example:
| <sapi:sql type="fetch-array" query="select * from table1" name="dbfetch" title="SQL query example " /> <sapi:apply select="field1.value" /> |
6.5.1.1 Attribute query
Attributes definition
query = %Text [CN]
Mandatory. The value of this attribute contains an SQL query to the CMS data repository (see CMS Data Repository).
6.5.1.2 Attribute type
Attributes definition
type = %Text [CN]
Mandatory. The value of this attribute contains the element type value.
In the current SAPI version just one type of the «fetch-array» queries is allowed. This query returns into the target CMS environment variable an associated array with query results.
6.5.1.3 Attribute name
Attributes definition
name = %Text [CN]
Mandatory. The value of this attribute contains the name of the target CMS environment variable (see section Recommended CMS Environment Variables).
6.5.1.4 Attribute title
Attributes definition
title = %Text [CN]
Mandatory. The value of this attribute contains the element title.