Reviews
PHP Oracle Training TutorialsHandling Transactions
Taking Advantage of Standard Internet Protocols
Handling Transactions
As you can see from the preceding example, changes made through internet protocols to repository resources become permanent once a single operation on a resource has been completed.
In contrast, all SQL and PL/SQL operations that you perform on the XML data stored in Oracle XML DB are transactional, irrespective of whether you're using XMLType storage or the XML repository. This allows you to combine SQL and PL/SQL statements operating on XML data within a logical unit of work and explicitly commit the transaction or roll it back if necessary.
Suppose you want to create a folder in the XML repository and then upload an XML document in it. The following code fragment shows how this can be done in PL/SQL:
- rslt:=DBMS_XDB.createFolder('/public/xmlusr/emps/303')
- rslt:=DBMS_XDB.createResource('/public/xmlusr/emps/303/emp303.xml',
- xmldoc)
- COMMIT
The above PL/SQL code is transactional. If an error occurs during the execution of the createFolder function, then the results of execution of createFolder are discarded automatically.
On the other hand, when performing the same operations through FTP protocol, failure to create the resource doesn't affect the results of preceding operation. So, the following fragment of PHP code is not transactional:
- $login = ftp_login($ftpcon, $db_user, $db_pswd)
- ftp_chdir($ftpcon, '/public/xmlusr/emps')
- ftp_mkdir($ftpcon, '303')
- ftp_chdir($ftpcon, '/public/xmlusr/emps/303')
- ftp_fput($ftpcon, 'emp303.xml', $xmldoc, FTP_ASCII)
- ftp_close($ftpcon)
NOTE: Chapter 4 Transactions, presented earlier in this book, explains in detail how to use transactions in PHP/Oracle applications.
PHP Oracle Training Tutorials
- PHP Oracle Web Development
- XML Processing in PHP and Oracle Applications
- Creating XML with the DOM PHP Extension
- Querying a DOM Document with XPath
- Transforming and Processing XML with XSLT
- Performing XML Processing inside the Database
- Moving All the XML Processing into the Database
- Performing XSLT Transformations inside the Database
- Using Oracle Database for Storing, Modifying, and Retrieving XML Data
- Using XMLType for Handling XML Data in the Database
- Using XML Schemas
- Retrieving XML Data
- Using XMLType Views
- Performing DML Operations on XML Schema Based XMLType Views
- Using Oracle XML DB Repository
- Accessing Repository Resources with SQL
- Taking Advantage of Standard Internet Protocols
- Querying Data with Oracle XQuery
- Breaking up XML into Relational Data







