Oracle Database 10g XML SQL [Electronic resources] : Design, Build Manage XML Applications in Java, C, C++ PL/SQL نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Oracle Database 10g XML SQL [Electronic resources] : Design, Build Manage XML Applications in Java, C, C++ PL/SQL - نسخه متنی

Mark V. Scardina, Ben Chang, Jinyu Wang

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
توضیحات
افزودن یادداشت جدید

Chapter 20) is not available. For this example application, you will use special C++ classes that call OCI functions to generate an XMLType from a SQL/XML query over relational tables from the SALES sample schema. However, instead of simply returning a serialized stream of the data that would need to be reparsed, you will return an XMLType DOM called an XOB (XML object) that can be accessed directly through the new C++ XML APIs. You will then query the XOB with an XPath and serialize it for consumption or display. You can also save it back to the database.

The steps to create such an application are as follows:

Initialize the OCI environment from C++ and create a connection.

Initialize the OCIXMLDB and XDK contexts to operate on an XOB.

Log on to the database and submit the SQL/XML query.

Cast the result to an xmldocnode to prepare it for DOM operations.

Perform DOM operations with the XML* APIs.

Serialize the DOM or save back to the database with a C++ class calling OCI.

These steps are used in the following specific example, which creates a command-line selectxpq application that can accept as parameters the SQL/XML query and the XPath to evaluate and print the result. The following is an example selectxpq command line:

 selectxpq 'select xmlelement("Exec", xmlattributes(s.ENAME "Name"), 
xmlforest(s.JOB as "Job", s.SAL as "Salary")) from EMP s where
s.SAL>3000;" /Exec/Job"

The SQL/XML query returns this XML document using the sample schema:

 <Exec Name=”KING”>  
<Job>PRESIDENT</Job>
<Salary>5000</Salary>
</Exec>

The following is the XPath evaluation result:

 <Job>PRESIDENT</Job> 

/ 218