当前位置: 首页 > 网络学院 > 客户端脚本教程 > APPML > sql

APPML
AppML HTML 报告
AppML 过滤函数
AppML HTML 列表
AppML HTML 表单
AppML XML 报告

APPML 中的 sql


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-03-04   浏览: 313 ::
收藏到网摘: n/a

The <sql> element is used to define a subset of records from a database. The <sql> element can contain any legal SQL statement.
<sql>元素用于定义一条来自于数据库中的记录子集。<sql>元素可以嵌套任何合法的SQL语句。

An <sql> element defined as a child of the <database> element will be the DEFAULT SQL for the application.
如果<sql>元素是作为<database>元素的子元素定义的,它将成为应用程序默认的SQL。

To define a particular SQL for the HTML report, HTML list, or HTML form, add an <sql> element as a child of <htmlreport>, <htmllist>, or <htmlform>.
可以通过添加<htmlreport>、<htmllist>或<htmlform>的子元素来为HTML报告、HTML列表、HTML表单定义一个特殊的SQL。

If the <sql> element is omitted in either <htmlreport>, <htmllist>, or <htmlform>, the application will use the default SQL under the <database> element.
如果在<htmlreport>、<htmllist>或<htmlform>中忽略了<sql>元素,那么应用程序将会在<database>元素下使用默认的SQL。

Note: If a <filters> element is present, the <sql> MUST contain all the data fields the user may query!
注意:如果存在<filters>元素,那么<sql>必须嵌套用户所能查询的所有数据字段!


<sql> Attributes
<sql>属性

The <sql> element may have the following attributes:
<sql>元素可以包含下面的属性:

Attribute
属性
Value
Description
描述
database access
sql
oracle
Some part of the SQL syntax is different in different databases. The database attribute allows you to create different SQL's for a MS Access database, an SQL Server database, and an Oracle database
在不同的数据库中,部分SQL语法是不尽相同的。数据库属性允许你为MS Access数据库或Oracle数据库创建不同的SQL


Use the default SQL in the HTML report:
在HTML报告中使用默认的SQL:

<?xml version="1.0" ?>
<appml>
<database>
<connection>northwind</connection>
<sql>SELECT CompanyName,ContactName,City FROM Suppliers</sql>
</database>
<htmlreport />
</appml>

Define a particular SQL for the HTML report:
为HTML报告定义一个特殊的SQL:

<?xml version="1.0" ?>
<appml>
<database>
<connection>northwind</connection>
<sql>SELECT CompanyName,ContactName,City FROM Suppliers</sql>
</database>
<htmlreport>
<sql>SELECT CompanyName,City FROM Suppliers</sql> </htmlreport>
</appml>

Define a particular SQL for the HTML list:
为HTML列表定义一个特殊的SQL:

<?xml version="1.0" ?>
<appml>
<database>
<connection>northwind</connection>
<maintable>suppliers</maintable>
<keyfield>supplierid</keyfield>
<sql>SELECT CompanyName,ContactName,City FROM Suppliers</sql>
</database>
<htmllist>
<sql>SELECT CompanyName,City FROM Suppliers</sql> </htmllist>
</appml>

Define a particular SQL for the HTML form:
为HTML表单定义一个特殊的SQL:

<?xml version="1.0" ?>
<appml>
<database>
<connection>northwind</connection>
<maintable>suppliers</maintable>
<keyfield>supplierid</keyfield>
<sql>SELECT CompanyName,ContactName,City FROM Suppliers</sql>
</database>
<htmlform>
<sql>SELECT CompanyName,City FROM Suppliers</sql> </htmlform>
</appml>

Define a particular SQL for the XML report:
为XML报告定义一个特殊的SQL:

<?xml version="1.0" ?>
<appml>
<database>
<connection>northwind</connection>
<maintable>suppliers</maintable>
<keyfield>supplierid</keyfield>
<sql>SELECT CompanyName,ContactName,City FROM Suppliers</sql>
</database>
<xmlreport>
<sql>SELECT CompanyName,City FROM Suppliers</sql> </xmlreport>
</appml>

Define SQL's for different databases:
为不同的数据库定义SQL:

In the example below there are no differences between the three SQL's, but it shows how to describe different SQL's for different databases. One example of a different SQL syntax in the three databases is when working with conditional statements (IIF / CASE WHEN).
在下面这个案例当中,三个SQL都没有区别,但是,它所展示的是如果在不同的数据库中描述不同的SQL。其中一个案例:当与条件语句(IIF / CASE WHEN)一起使用时,SQL语法在三个数据库中的不同:

<?xml version="1.0" ?>
<appml>
<database>
<connection>northwind</connection>
<sql>SELECT CompanyName,ContactName,City FROM Suppliers</sql>
</database>
<htmlreport>
<sql database="access">SELECT CompanyName FROM Suppliers</sql> <sql database="sql">SELECT CompanyName FROM Suppliers</sql>
<sql database="oracle">SELECT CompanyName FROM Suppliers</sql>
</htmlreport>
</appml>


评论 (0) All

登陆 | 还没注册?