16.10.2015 Views

Getting Startedwith pureQuery

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

128<br />

<strong>Getting</strong> Started with <strong>pureQuery</strong><br />

If you are using IBM Optim Development Studio, you can add a replacement SQL<br />

statement by opening a <strong>pureQuery</strong>Xml file with the tool’s <strong>pureQuery</strong>XML Editor. Rightclick<br />

on the statement that you want to replace and select Edit Statement, as shown in<br />

Figure 6.14. Then, enter the new statement that you want to use, as shown in Figure 6.15.<br />

Figure 6.14 - Edit a statement in a <strong>pureQuery</strong>Xml file by using the <strong>pureQuery</strong>XML<br />

Editor<br />

Figure 6.15 - In the <strong>pureQuery</strong>XML Editor, type the replacement SQL statement that<br />

you want to use<br />

If you are not using IBM Optim Development Studio and you want to use this feature, you<br />

will need to modify the <strong>pureQuery</strong>Xml file directly. In a <strong>pureQuery</strong>Xml file,<br />

statementDescriptor elements describe the SQL statements that the application<br />

executes. To replace an SQL statement, locate the statementDescriptor element for<br />

that statement, and set the new SQL statement as the value of the processedSql<br />

element. After you make changes to statement sets, for use in static execution, you must<br />

set the value of their configureStatus attributes to REQUIRED.<br />

If you specify to the StaticBinder utility a <strong>pureQuery</strong>Xml file that contains replacement<br />

statements, and the isBindable attributes are set to true for the statements, the utility<br />

binds the alternate statements instead of the original statements. If you are using dynamic<br />

SQL, <strong>pureQuery</strong> uses the original SQL statements by default. Use the <strong>pureQuery</strong> property<br />

pdq.enableDynamicSQLReplacement to direct <strong>pureQuery</strong> to use the replacement SQL<br />

statements. The value TRUE directs <strong>pureQuery</strong> to use the replacement SQL statements;<br />

the value FALSE directs <strong>pureQuery</strong> to use the original SQL statements. The default value<br />

is FALSE.<br />

The ability to specify replacement SQL statements is a very powerful feature that can help<br />

you to replace SQL statements in situations in which you cannot modify the source code.<br />

Be aware, however, that using this feature can reduce the security of your application, if<br />

you do not sufficiently protect the <strong>pureQuery</strong>Xml file. Someone could maliciously add<br />

replacement SQL statements to a <strong>pureQuery</strong>Xml file to cause the application to execute<br />

them instead of the SQL statements in the application. For SQL statements that execute

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!