Pages

Sunday, September 15, 2013

ColdFusion Oracle Functions

The ColdFusion Markup Language, or simply ColdFusion, is a scripting language that makes it simple for you to design HTML pages and connect them to online databases, such as in Oracle. To make the connection and use the data from the database on your site, use the built-in functions designed for each task.

Query Functions

    These represent the bulk of what you use to interact with an Oracle database. Functions such as QueryAddColumn and QueryAddRow let you modify the structure of the tables in the database, while QuerySetCell lets you modify the data in a specified cell. QueryNew lets you create an empty query so you can collect information from the database, while ValueList and QuotedValueList allow you to structure the results from an executed query so they appear as you want them to.

Transaction Functions

    ColdFusion's transaction functions let you commit information to an Oracle database or recover data, if needed. The TransactionCommit function lets you save a query, such as an insert, to the database. The TransactionSetSavePoint function lets you create save points for an active transaction, depending on whether you think you need to back up your information. You can create more than one save point by calling the function multiple times. The TransactionRollback function lets you load a save point.

Output Functions

    ColdFusion's output functions aren't designed specifically for use with an Oracle database, but they allow you to take information from one and print it. The WriteOutput function takes information, such as the data returned from a query, and adds it to the output stream. The WriteLog function lets you create a log of activity. You can use this to track your database interactions, such as queries and transactions, or any exceptions caught in your script.

Exception Handling

    ColdFusion has only one exception handling function: the "Throw." To use this, you write a script that uses a "try-catch" block of code, similar to many programming language, where you attempt to perform a task, such as committing a record to the database. If a problem occurs, such as using an invalid value, you throw the error to your exception handler, where you program some sort of response -- for example, correcting the value or informing the user about the error.

0 comments:

Post a Comment