TAILIEUCHUNG - Oracle XSQL- P27

Oracle XSQL- P27Welcome to the exciting world of eXtended Structured Query Language (XSQL) development! What’s so exciting? Efficiency and ease of use. XSQL isn’t some razzle-dazzle technology to wow your users. It also isn’t the latest X standard du jour that no one can stop talking about until you ask, “But what does it do for me today?” The problem with all of the great stuff out there is that no one technology does it all. | 500 Chapter 18 public void handleAction Node result Document doc DocumentFragment queryActionFrag XSQLPageRequest pageRequest getPageRequest Element queryElem my-special-query Text queryStr SELECT name FROM product queryStr queryAction new XSQLQueryHandler pageRequest queryElem try queryActionFrag catch SQLException e reportError result queryActionFrag In this case you create the element named my-special-query and hard-code the SQL that you wish to pass. The result will be all of the names for all of the products. Since you don t use the action element at all you can invoke the action handler with the following simple XSQL xml version encoding UTF-8 xsql action handler NoXsqlQuery xmlns xsql urn oracle-xsql connection momnpup Hopefully this discussion has given you a firm grasp of the various ways that you can reuse the built-in action handlers within your own action handlers. The process is simple and flexible. You ve seen how to call multiple action handlers and even call action handlers that don t have their own element in the XSQL page. You ll see more use of built-in action handlers as the chapter progresses. JDBC Connections In the previous discussion you used built-in action handlers to work with this the database. This approach is very easy if you wish to attach the result to the datagram. It hides the complexities of JDBC entirely. But there are many good reasons that you Custom Action Handlers 501 might need to use JDBC directly. If you wish to use the results in an intermediate step prior to returning data then it may be easier to use a JDBC connection. This discussion examines the best way to do this. The following class uses the page s JDBC connection to execute a simple SQL statement. The connection is named in the XSQL page and is already part of the JDBC connection

TỪ KHÓA LIÊN QUAN
TÀI LIỆU LIÊN QUAN