tailieunhanh - Building Oracle XML Applications phần 5
Hãy nói rằng chúng ta có các tập tin sau, lưu trữ các kết nối cơ sở dữ liệu được đặt tên và kết nối thích hợp Bên cạnh đó là đơn giản để thực hiện, bạn sẽ tìm thấy XPathGrep một sidekick tiện dụng trong công việc hàng ngày của bạn với XML | SELECT FROM doctor WHERE id @id xsql query This parameterized XSQL page can be used to retrieve information about doctors given the value of their email id in the requesting URL like this http xmlapps examples id bproto which returns the datagram xml version ROWSET ROW num 1 ID bproto ID FIRSTNAME Bryan FIRSTNAME LASTNAME Proto LASTNAME HOMEOFFICE French44 HOMEOFFICE ROW ROWSET Parameter references like @paramname in an XSQL page s xsql query are substituted with their appropriate parameter values from the query string whenever the page is requested. This means you can build a page that uses parameters to provide parts of the query statement like this xml version xsql query connection xmlbook select where 1 1 order 1 xmlns xsql urn oracle-xsql SELECT @select FROM @from WHERE @where ORDER BY @order xsql query This XSQL page allows the requester to control all the parts of the syntax of the SELECT statement. You can use XML attributes with the same names as the parameters to provide defaults in case the requester does not provide a specific value. Taking the last example a step further you can build a page that uses a parameter to represent the entire SQL statement xml version xsql query connection xmlbook xmlns xsql urn oracle-xsql SELECT FROM @sql xsql query Such a page allows any requester with the authorization to access the page the ability to return XML datagrams for any SQL statement on your server. This obviously is not something you would want to use on a production system without appropriate authentication. Since XSQL pages can be secured using standard web page security mechanisms this access can be set up so it is not abused. Customizing the XSQL Results The most basic way to get XML results from queries into your XSQL page is to include the text of the desired SQL query between the xsql query and xsql query tags. Using this technique each query in the page will produce the following structure by default A ROWSET element
đang nạp các trang xem trước