iTP Active Transaction Pages (iTP ATP) Programmer's Guide
ATP Objects, Properties, and Methods
iTP Active Transaction Pages (iTP ATP) Programmer’s Guide—522292-002
4-20
atp.SQL Object
atp.SQL Object Usage Considerations
The examples discussed in Section 3, ATP Web Page and Script Structure, demonstrate
important design and usage techniques. The following text includes some special rules
and guidelines for using the atp.SQL object.
SELECT Statements
SQL SELECT statements always require the following three calls:
1. atp.SQL constructor, to prepare the statement and declare a cursor.
2. execute() method, to open a cursor.
3. next() method, to fetch one result row.
For example:
s1 = new atp.SQL ("select * from =account");
if (s1 == null){
atp.print ("failed to create SQL object")
atp.quit (0)
}
if (s1.sqlcode) {
atp.print ("SQL error = "+s1.sqlcode)
atp.quit (0)
}
s1.execute();
if (s1.sqlcode){
atp.print("SQLexecute failed:" +s1.sqlcode)
atp.quit (0)
}
while (s1.next())
{
atp.print (s1.column_value["account.account_type"]);
}
s1.close();
Map Class Defines
Names of tables, views, and other files in SQL statements can be either map class
defines or physical file names. Set up defines by including MapDefine commands
when you define the atp.pway server class in the ATP configuration file
(atp.config). For example, the following directive maps the name cust to a
specific location in the file system.
MapDefine =cust /G/data02/djcanta3/cust)
For more examples, see ATP in the WebServer Configuration File on page 2-8.