Home
IBM Informix Web DataBlade Module Application Developer`s Guide
Contents
1. wbTagVersions wbPreviews Previous 4 Rows Next 4 Rows v 8 16 IBM Informix Web DataBlade Module Application Developer s Guide Special Characters in Variable Expressions The following figure shows the Web browser output for the final set of rows retrieved Figure 8 6 Web Browser Walking Window Walking Window 3 alking Window URL http domain port hr_app Mlval walking htm Previous 4 Rows Special Characters in Variable Expressions Quotation marks can be used to suppress evaluation of selected sequences of characters that otherwise would be interpreted as part of a variable expression For example in the following expression double quotes are placed around the string Hello Citizen to prevent the comma from being treated as a parameter separator lt MIVAR gt S SUBSTR Hello Citizen 5 lt MIVAR gt Double quotes may be included as part of a variable expression by placing them within another set of double quotes Additionally since a blank space terminates an attribute assignment you must place double quotes around any variable expression containing a space as in the following example lt MIVAR NAME varl gt x y lt MIVAR gt lt MIBLOCK COND EQ x y S varl gt Values are equal lt MIBLOCK gt Using Variable Processing Functions in AppPages 8 17 Special Characters in Variable Expressions Since a greate
2. To prevent these problems you can use either of the following methods m Validate non text fields and escape quotation marks for all variables coming from text form fields in your SQL statement lt MISQL SQL INSERT INTO FOO VALUES REPLACE name REPLACE address gt m Use the PREPARE attribute to put the users input into placeholders for literals in the query For example lt MIVAR gt SETVAR val 1 name SETVAR val 2 address lt MIVAR gt lt MISQL SQL INSERT INTO FOO VALUES PREPARE S val gt 6 22 IBM Informix Web DataBlade Module Application Developer s Guide Generating XML Formatted Data Generating XML Formatted Data You can use the MISQL AppPage tag to generate XML formatted data based on rows in a table You can do this in two ways m Use the MISOL AppPage tag to retrieve only data from the table and specify your own XML tags m Use XML specific attributes of the MISOL AppPage tag to generate default XML tags as well as retrieve data from the table Both methods are discussed in the following sections AppPages that create XML formatted data must use the extension xml in their names you must have an xml extension in the wbExtensions table in your database You can check whether this exists by invoking AppPage Builder APB and clicking Admin Menu and Edit Extension Look for the xml extension in the list box If there i
3. Gonzo SQL executed update employees set onsite t where first_name in Betty Gonzo RADIOLIST The RADIOLIST system dynamic tag creates an HTML radio button list based on the attributes you specify RADIOLIST has the following tag attributes Attribute Mandatory Description NAME Yes SQL Yes CHECKED No Specifies the value of the NAME attribute of the radio buttons in the radio button list Specifies the SQL statement that returns a list of items to compose the radio button list Specifies the SQL statement that returns a single item that is initially checked 1 of 2 Using Dynamic Tags in AppPages 9 11 RADIOLIST Attribute Mandatory Description CHECKONE No Specifies the value of a single item initially checked PRE No Specifies text that precedes every radio button field POST No Specifies text that follows every radio button field Default is lt BR gt 2 of 2 Tip By definition a radio button list can have only one item selected at a time The following example illustrates the use of RADIOLIST to display infor mation about employees based on the following employees table schema create table employees first_name varchar 40 last_name varchar 40 title varchar 40 onsite boolean department varchar 40 9 12 IBM Informix Web DataBlade Module Application Developer s Guide The following example is the radiolist ht
4. URL http domain port hr_app Mlval APB20 apb html Add Object Add a new object to the database Edit Object Edit delete and view objects stored in the database Manage user accounts and projects AppPage Bullder 2 0 Main Menu User Name Default Project TEXTAREA Width Versioning default 80 Off User Level 0 Default Object TEXTAREA Height WebLint Checking AppPage 20 Off 2 4 IBM Informix Web DataBlade Module Application Developer s Guide Step 2 Create User Defined Dynamic Tags To create a project in APB 1 From the Main Menu click Admin Menu 2 From the Admin Menu click Add Project 3 Onthe Add Project AppPage type getting_startedas the name of the project in the Project text box 4 Type a description of the getting_started project in the Description text area 5 Click Save The Add Project AppPage appears and displays a message that the getting started project was created After getting started has been successfully added as a project use the following procedure to make getting started your default project To make getting started your default project 1 Click Admin Menu 2 Click Edit User 3 Select getting_started from the Default Project list box and click Save Step 2 Create User Defined Dynamic Tags User defined dynamic tags allow you to specify standard components that appear on every AppPage such as hea
5. lt HTML gt lt HEAD gt lt TITLE gt WebURLEncode Example lt TITLE gt lt HEAD gt lt BODY gt lt H2 gt Select a job title lt H2 gt lt MISQL SOL select distinct title WebURLEncode title from employees order by title gt lt A HREF SWEB_HOME MIval encode html title 2 gt 1 lt A gt lt BR gt lt MISQL gt lt MIBLOCK COND XST title gt lt MISOL SQL select distinct department from employees where title S title gt lt BR gt The title position is in the lt B gt 1 lt B gt department lt BR gt lt MISQL gt lt MIBLOCK gt lt BODY gt lt HTML gt If you do not encode text within links and the text contains spaces the links do not function properly Using DataBlade Module Functions in AppPages 12 15 WebURLEncode The following figure shows sample Web browser output Figure 12 5 WebURLEncode Web Browser WebURLEncode Example URL http domain port hr_app Mlval encode amp title htm Select a job title Event Coordinator Line Worker Product Manager Salesman Senior Line Worker Senior Salesman The Event Coordinator position is in the marketing department 12 16 IBM Informix Web DataBlade Module Application Developer s Guide FileToHTML FileToHTML The FileToHTMLO function converts a file on the operating system file system into an HTML data type You typically use the File ToHTMLO function in an INSERT o
6. Functions That Use or Return the HTML Data Te Example of Using an HTML Data Type Using DataBlade Module Functions in ss In This Chapter WebExplode WebLint WebRelease WebUnHTML WebURLDecode WebURLEncode FileTOoHTML 3 WebRmtShutdown 9 3 9 3 9 4 9 5 9 8 9 8 9 11 9 15 9 17 9 18 9 19 9 21 10 3 10 3 10 4 10 6 10 8 11 3 11 3 11 4 11 5 12 3 12 4 12 8 12 11 12 12 12 14 12 15 12 17 12 19 Table of Contents vii Chapter 13 Chapter 14 Appendix A Appendix B Appendix C Appendix D Using Other Webdriver Features In This Chapter Adding HTTP Headers to sAppPapes Retrieving Non HTML Pages Using Cookies Uploading Client Files Setting the Directory Example Passing Image Map Conidinais IMG Tag FORM Tag Two Pass Query Processing Using DataBlade Module API Functions in asics In This Chapter The Web DataBlade Module API Pahon WebHtmlToBuf WebBufToHtml Debugging Web DataBlade Module Applications AppPage Builder Schema Web DataBlade Module Variables Notices Glossary Index viii IBM Informix Web DataBlade Module Application Developer s Guide 13 3 13 3 13 3 13 4 13 7 13 8 13 9 13 12 13 12 13 14 13 15 14 3 14 3 14 5 14 8 Introduction In This Introduction About This Manual E Organization of This Manual Types of Users y Software Dependencies Assumptions About Your Locale Document
7. If in your AppPage you specify the dynamic tag lt IMG ID my_imag xtension jpeg ALIGN CENTER gt sample output to the client is lt IMG BORDER 0 HEIGHT 40 WIDTH 332 ALT My Image SRC hr map MIval my_image jpeg ALIGN CENTER gt In the previous two examples hr map is the value of WEB_LHOME automat ically generated by Webdriver If your AppPage contains the dynamic tag lt IMG ID my_image COND XST SDISPLAY gt the WebExplode function generates the IMG tag only if the DISPLAY variable has been assigned a value within that AppPage Warning The body of a dynamic tag can contain another dynamic tag However do not call the same dynamic tag recursively or you might consume your system resources Special Characters in Dynamic Tags An entity reference instructs the browser to look up symbols as it renders an AppPage and replace them with equivalent characters You must replace the character with its entity reference if the character occurs within your dynamic tag content Character Entity Reference amp 64 Using Dynamic Tags in AppPages 9 21 Special Characters in Dynamic Tags 9 22 IBM Informix Web DataBlade Module Application Developer s Guide Using UDR Tags in AppPages In This Chapter What Is a User Defined Routine UDR Tag Where Are UDR Tags Stored Specifying a UDR Tag in an AppPage Creating a UDR Tag 10 3 10 3 10 4 10 6 10 8 10 2 IBM Informix We
8. MIVAR Tag MIVAR Tag The MIVAR tag enables you to assign and display variables Use variables with AppPage tags to dynamically generate and format the results of SOL statements and to process errors The following table lists the MIVAR tag attributes Attribute NAME DEFAULT COND ERR Mandatory Description No Specifies the name of the variable specified by the text between the start and end MIVAR tags If NAME is not specified the text between the start and end MIVAR tags is output Variables within the text are expanded Specifies the default value for any unassigned variables between the start and end MIVAR tags This value can be another variable Tag is enabled only if this condition evaluates to TRUE nonzero If the COND attribute is not present it is executed Specifies how an error should be processed Because multiple errors can occur on an AppPage use the ERR attribute to link the error processing to a particular MIERROR tag For more information on the ERR attribute see ERR Attribute on page 6 29 For more information on the COND attribute see COND Attribute on page 6 31 Using Tags in AppPages 6 27 NAME Attribute NAME Attribute Use the NAME attribute to assign the value of the text between the start and end MIVAR tags to that variable name The following var1 html AppPage demonstrates how to assign variables lt HTML gt lt HEAD
9. You can assign a default value to a parameter by specifying the parameter and its value as a name value pair for example paraml valuel A parameter that does not need a default value is specified by the parameter followed by an equal sign with no value following for example param1 Delimit parameters by using a commercial at before and after the parameter name within the body of the dynamic tag When you insert or update a dynamic tag in the wbTags table AppPage Builder verifies the tag to check that all of the parameters in the content column delimited by the character are also listed in the parameters column When the WebExplode function encounters a dynamic tag in an AppPage the function verifies the tag to check that all parameters requiring a value are assigned a value Example of Creating a User Defined Dynamic Tag The following IMG dynamic tag which invokes the standard HTML IMG tag based on information retrieved in a SELECT statement of the wbBinaries table that stores images displays the image identified by the mandatory SRC parameter The parameters to the IMG dynamic tag are ID path and extension Each parameter has a default value Using Dynamic Tags in AppPages 9 19 Example of Creating a User Defined Dynamic Tag Web Browser APB Add Dynamic Tag Figure 9 5 Example of a User URL http domain port hr_app Mlval APB20 apb html Defined Dynamic e Tag AppPage Builder 2 0 _ M
10. lt BODY gt lt HTML gt Using Variables in AppPages 5 9 Web Server and Web Browser Variables The value of the HTTP_USER_AGENT environment variable is Mozilla 3 0 WinNT I 5 10 http domain port hr_app Mlval env_var html The following sample output is returned to the client lt HTML gt lt HEAD gt lt TITLE gt Display a Variable lt TITLE gt lt HEAD gt lt BODY gt lt HR gt The value of the HTTP_USER_AGENT environment variable is Mozilla 3 0 WinNT I lt HR gt lt BODY gt lt HTML gt The following is sample Web browser output Figure 5 1 Web Browser Display a Variable Disvl Variabl isplay a Variable To add a Web browser or Web server variable to your Webdriver configuration 1 Invoke the Web DataBlade Module Administration Tool in your browser For detailed information on this step refer to the IBM Informix Web DataBlade Module Administrator s Guide 2 Display the details of your Webdriver configuration For detailed information on this step refer to the IBM Informix Web DataBlade Module Administrator s Guide 3 Goto the Add User Variable AppPage For detailed information on this step refer to the IBM Informix Web DataBlade Module Administrator s Guide 4 Type the name of the Web browser or Web server variable in the Variable Name text box IBM Informix Web DataBlade Module Application Developer s Guide Session Variables 5 Enter on
11. A data object that exceeds 255 bytes in length A large object is logically stored in a table column but physically stored independently of the column because of its size Large objects can contain non ASCII data A set of files that define the native language behavior of the program at run time The rules are usually based on the linguistic customs of the region or the territory The locale can be set through an environment variable that dic tates output formats for numbers currency symbols dates and time as well as collation order for character strings and regular expressions See also Global Language Support GLS A variable accessible in AppPages that contains a description of a Web driver error By querying the contents of this variable an error handling AppPage can determine the exact error that occurred and take appropriate action A Web DataBlade module environment variable that contains the full path name of the web cnf file This variable is used by the NSAPI ISAPI and Apache implementations of Webdriver to locate the file when they create connections to an Informix database server A code set that is made up of both single byte and multibyte characters Examples of multibyte code sets are EUC and Shift JIS See also code set A data type whose storage location varies depending on the size of the data The Web DataBlade module HTML data type is an example of a multirepre sentational data type The first 7500 byt
12. Important Arithmetic functions accept decimal or integer arguments and perform all calculations in decimal arithmetic Arithmetic functions that allow more than two arguments allow a maximum of 10 Tip Spaces are significant in the evaluation of variable expressions For example the variable expression EQ var1 var2 is not equivalent to EQ var1 var2 because the latter expression has a space before the string varl Using Variable Processing Functions in AppPages 8 9 Using Variable Expressions in AppPages Using Variable Expressions in AppPages A variable expression contains multiple variable processing functions The following sections show uses for variable processing functions to create simple and complex variable expressions It includes the following topics m Using Arithmetic Functions in Variable Expressions following m Using SEPARATE and REPLACE in Variable Expressions on page 8 11 m Using Variable Expressions to Format Output Conditionally on page 8 13 Using Arithmetic Functions in Variable Expressions The following varexp1 html AppPage uses the plus function and shows an example of variable processing within an MIVAR tag lt HTML gt lt HEAD gt lt TITLE gt Adding Two Variables lt TITLE gt lt HEAD gt lt BODY gt lt MIVAR NAME NUMA gt 10 lt MIVAR gt lt MIVAR NAME NUMB gt 20 lt MIVAR gt lt MIVAR gt lt B gt The sum of SNUMA and SNU
13. object_type varchar 40 object blob local_file varchar 100 put object in sbspacel Using Other Webdriver Features 13 9 Example The following example shows the upload_file AppPage lt HTML gt lt HEAD gt lt TITLE gt File Upload Form lt TITLE gt lt HEAD gt lt BODY gt lt HR gt lt FORM ENCTYPE multipart form data METHOD POST ACTION lt MIVAR gt S WEB_HOME lt MIVAR gt gt lt INPUT TYPE HIDDEN NAME MIval VALUE upload_file html gt lt INPUT TYPE HIDDEN NAME action VALUE on gt lt TABLE gt lt TR gt lt TD gt Name lt TD gt lt TD gt lt INPUT NAME name SIZE 40 TYPE TEXT gt lt TD gt lt TR gt lt TR gt lt TD gt File lt TD gt lt TD gt lt INPUT NAME upload SIZE 40 TYPE FILE gt lt TD gt lt TR gt lt TABLE gt lt HR gt lt INPUT TYPE SUBMIT VALUE Insert New Object gt lt FORM gt lt MIBLOCK COND XST action gt lt HR gt lt MIVAR NAME sql_statement gt INSERT into uploads VALUES Sname Supload_type FileToBlob Supload client uploads object Supload_name lt MIVAR gt lt MISQL SOL sql_statement gt Inserted MI_ROWCOUNT new objects lt P gt lt MISQL gt lt MIVAR gt The SQL executed was lt I gt sql_statement lt I gt lt P gt lt MIVAR gt lt MIBLOCK gt lt B gt Here are all of the uploaded objects lt B gt lt TABLE gt lt MISQL SQL Select name object object_type local_file from uploads gt lt TR gt l
14. sod a g e e a ouea eoi Ge oa oou pnk WebRmtShutdown 2 ee ee 12 2 IBM Informix Web DataBlade Module Application Developer s Guide In This Chapter This chapter describes the Web DataBlade module server functions that are provided with the Web DataBlade module These are the functions most commonly required by Web application designers They are described in the following sections WebExplode on page 12 4 WebLint on page 12 8 WebRelease on page 12 11 WebUnHTML on page 12 12 WebURLDecode on page 12 14 WebURLEncode on page 12 15 FileTOoHTML on page 12 17 WebRmtShutdown on page 12 19 You can write additional database server functions to simplify Web appli cation design For detailed information on writing your own database server functions refer to Creating User Defined Routines and User Defined Data Types Using DataBlade Module Functions in AppPages 12 3 WebExplode WebExplode The WebExplode function expands AppPage tags within an AppPage and retrieves SQL results dynamically If you use the WebExplode functioninan AppPage to execute the same AppPage there is no explicit limit to the number of recursive WebExplode function calls The number of recursive WebExplode function calls is determined by your platform operating system and system memory Tip Because the WebExplode function is a server function it executes all
15. IBM Informix Web DataBlade Module Application Developer s Guide Version 4 13 December 2001 Part No 000 8673 Note Before using this information and the product it supports read the information in the appendix entitled Notices This document contains proprietary information of IBM Itis provided under a license agreement and is protected by copyright law The information contained in this publication does not include any product warranties and any statements provided in this manual should not be interpreted as such When you send information to IBM you grant IBM a nonexclusive right to use or distribute the information in any way it believes appropriate without incurring any obligation to you Copyright International Business Machines Corporation 1996 2001 All rights reserved US Government User Restricted Rights Use duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp ii IBM Informix Web DataBlade Module Application Developer s Guide Chapter 1 Table of Contents Introduction In This Introduction About This Manual Organization of This Manual Types of Users 3 Software Dependencies Assumptions About Your Locale Documentation Conventions Typographical Conventions Icon Conventions oe a Screen Illustration Conventions Additional Documentation Printed Documentation Online Documentation IBM Welcomes Your Comments Overview In This
16. The following code makes up the SERVE pl program This is a SAMPLE perl program that fields requests generated within the Web DataBlade module using the MIEXEC tag To run on NT comment out the line SUNIX_OS 1 require 5 002 BEGIN SENV PATH usr ucb bin Specify modules use Socket use Carp use FileHandle use English Forward references sub REAPER sub executeCommand sub processRequest Comment out the next line to run correctly on NT SUNIX_OS 1 Setup exit handler SSIG CHLD amp REAPER set exit handler Declare and my Siaddr paddr proto line my port shift ARGV note Had one system where this value had to be hardwired to the node name my remote shift localhost if Sport D Sport getservbyname Sport tcp if Sport print NO PORT To use as service use n t tSERVE pl lt portNum gt n die No port Time to fork for the parent can return to database server and processing can continue if defined UNIX_OS my pid 7 16 IBM Informix Web DataBlade Module Application Developer s Guide Sample Perl Program SERVE pl if defined pid fork exit elsif Spid exit parent must leave this is the child SOE SR OS OSE ROSE OEE e e e e SE EE SEE HE Siaddr inet_aton remote Spaddr sockaddr_in port Siaddr Sproto getprotobyname n
17. This appendix provides the full list of Webdriver and WebEx plode variables The appendix is organized into the following sections m Webdriver Variables Stored in the web cnf File on page C 2 m Webdriver Variables Stored in the Database on page C 6 m WebExplode Variables on page C 27 Use the Web DataBlade Module Administration Tool to set the Webdriver and WebExplode variables that are stored in the database as part of your Webdriver configuration Many Webdriver variable names changed in Version 4 0 of the Web DataBlade module This appendix also provides where applicable the old name of the Webdriver variable For detailed information about using the Web DataBlade Module Administration Tool refer to the IBM Informix Web DataBlade Module Administrator s Guide Webdriver Variables Stored in the web cnf File Webdriver Variables Stored in the web cnf File This section describes the Webdriver variables that are stored in the Global Setvar and Map sections of the web cnf file The Global Section of the web cnf File The following table lists all the variables you can set in the Global section of the web cnf file Variable Mandatory Description dbconnmax No Specifies the maximum number of connections to the database The default value is 16 anchorvar Yes Specifies the name of the anchor variable used when an AppPage calls another AppPage This variable is mandatory For
18. hr_app refers to the URL prefix that maps to a Webdriver mapping IBM Informix Web DataBlade Module Application Developer s Guide Using RAW Mode with Webdriver The following illustrations show sample RAW mode output Web Browser Webdriver RAW Output URL http domain port hr_app Mlval testit amp RAW topsecret RAW Mode activated document fetched without exploding SQL lt HTML gt lt HEAD gt lt TITLE gt My First Web DataBlade Module Application lt TITLE gt lt HEAD gt lt BODY gt lt MIVAR gt Hello World lt MIVAR gt lt BODY gt lt HTML gt End of RAW document SQL To fetch Page SELECT WebUnHTML object FROM webPages WHERE ID testit Environment Figure A 1 Webdriver RAW Mode Output 1 M M Debugging Web DataBlade Module Applications A 3 Using RAW Mode with Webdriver Web Browser Webdriver RAW Output Figure A 2 Webdriver RAW URL http webserver hr map M lval testit RAW 17 Mode Output 2 MM Environment HTTP_URI rq gt reqpb ro no develop apb Mlval uri ro yes apb PATH rq gt vars ro no tmp apb QUERY_STRING rq gt reqpb ro no RAW 17 RAW query string ro yes 17 REQUEST_METHOD rq gt reqpb ro n0o GET WEB_HOME config table ro yes develop The following environment variable information is an example of what is shown in the preceding figure MIval query string rw yes
19. lt HTML gt The following figure shows sample Web browser output Web Browser WebRelease Example Figure 12 3 WebRelease URL http domain port hr_app Mlval webrelease htm The current version of the Web DataBlade module is Version web 4 13 UC1 a 31 Mar 1999 E v IN gt Using DataBlade Module Functions in AppPages 12 11 WebUnHTML WebUnHTML The WebUnHTMLO function replaces certain characters with their entity reference WebUnHTMLJ scans the AppPage and makes the following replacements Character Entity Reference lt amp lt gt amp gt amp quot amp amp amp These substitutions allow the HTML tag information to be displayed by a Web browser If this action is not taken the browser uses these characters in its attempt to render the HTML tags as formatting information Syntax WebUnHTML HTML returns HTML Arguments The argument is HTML 12 12 IBM Informix Web DataBlade Module Application Developer s Guide Example display HTML tags within the AppPage lt HR gt will be displayed lt BODY gt lt HTML gt Web Browser WebUnHTML Example URL http domain port hr_app Mlval unhtm htm To display the horizontal rule HTML tag lt HR gt you can use the WebUnHTML function Otherwise the tag will be interpreted and a horizontal rule will be displayed v you can use the lt B gt WebUnHTM
20. testit Each of the columns is described in the following subsections A 4 IBM Informix Web DataBlade Module Application Developers Guide Name of the Variable Using RAW Mode with Webdriver The first field in the environment variable list shows the name of the variable in this case MIval The second value identifies where the variable has been set with the following meanings Environment Setting Where Set config table query string path info cookie post uri environment rq gt vars rq gt headers rq gt reqpb sn gt client iis cblock iis filter session driver_err apache hdrs apache req webconfigs table QUERY_STRING environment variable PATH_INFO environment variable Web browser cookie METHOD POST in the calling HTML form NSAPI URL NSAPI only Web server environment CGI only Web server environment NSAPI only Web server environment NSAPI only Web server environment NSAPI only Web server environment NSAPI only Web server environment ISAPI only Web server environment ISAPI only Session variable MI_DRIVER_ERROR Web server environment APACHE only Web server environment APACHE only Debugging Web DataBlade Module Applications A 5 Using WebLint Variable Mode The third field shows the mode of the variable The mode can be either rw or ro The rw mode means that the value can be overridden and ro mode means that the value cannot be overridden Variable Passed T
21. tration of the Web DataBlade module in your database in order to enable ER support Repeat the registration procedure as follows blademgr myserver gt register web version mydatabase where version is the current version of the Web DataBlade module and mydatabase is the database in which you want to register it 1 8 IBM Informix Web DataBlade Module Application Developers Guide Reverting to a 9 2x Server Reverting to a 9 2x Server If you have registered the Web DataBlade module on a Version 9 30 server and you want to revert your server to Version 9 2x you must run the revert93to92 sql script to drop the Web DataBlade module ER support functions as follows cd SINFORMIXDIR extend web version dbaccess my_database revert93to92 sql Run the revert93to92 sql script on each database in which you have regis tered the Web DataBlade module Product Features The Web DataBlade module includes the following features m AppPage tags identify the elements of an HTML page and specify the structure and formatting for that page They enable you to a Embed SQL statements directly within AppPages a Handle errors within AppPages a Execute statements conditionally within AppPages a Manipulate variables within AppPages using variable processing functions a Use other advanced query processing and formatting techniques m Web DataBlade module dynamic tags allow you to reuse existing AppPage segments to simplify the co
22. For more information on the WebRmtShutdown function refer to Chapter 12 Using DataBlade Module Functions in AppPages Using the MIEXEC Tag in an AppPage This section describes the steps you must take to execute a Perl program in your AppPage with the MIEXEC tag To execute a Perl program in your AppPage with the MIEXEC tag 1 Create a Perl program that uses sockets to communicate with the Web DataBlade module Although you can write your own Perl program itis highly recom mended that you start with the sample Perl program called SERVE pl described in Sample Perl Program SERVE pl on page 7 15 and modify it to fit your needs 2 Move the Perl program to a directory that is accessible to the user who owns the Informix database server processes Set the permis sions on the Perl program so that the same user can read it Using Advanced AppPage Tags 7 11 Using the MIEXEC Tag in an AppPage 3 Locate the Perl binary that executes Perl programs The Perl binary is usually called perl On UNIX use the which command as shown in the following example which perl The command returns the name of a directory such as usr local bin perl 4 Be sure that you or your database administrator have previously started a WEB virtual processor You start a virtual processor by updating the ONCONFIG file with the appropriate VPCLASS entry and restarting the database server For detailed information about adding and star
23. In This Chapter Web DataBlade Module Variables User Defined Variables Vector Variables Creating and AE values to Vector Vanel Looping Through a Vector Variable Manipulating a Vector Variable Forms and Variable Vectors Web DataBlade Module System Variables Web Server and Web Browser Variables Session Variables E How Session Management frre an ID toa Pro sena Setting Session Variables Examples of Using Session enables Error Handling with the MI_DRIVER_ERROR Variable 5 3 5 3 5 4 5 4 5 5 5 6 5 7 5 8 5 11 5 12 5 13 5 14 5 17 5 2 IBM Informix Web DataBlade Module Application Developer s Guide In This Chapter This chapter describes how to use Web DataBlade module variables within AppPage tags to customize your Web application The following topics are covered in this chapter m Web DataBlade Module Variables following m Error Handling with the MI_DRIVER_ERROR Variable on page 5 17 Web DataBlade Module Variables The following list describes Web DataBlade module variables m Variables are case sensitive m A variable must be preceded by a when used in a variable expression m Variables preceded by MI_ are reserved for the portion of the Web DataBlade module that runs within the database The portion that does not run within the database is Webdriver m A variable starts with an alpha character a z or A Z Subsequent characters include alphanumeric ch
24. See Web DataBlade Module Variables on page 5 3 for more information Dynamic tags Dynamic tags are segments of AppPages that are stored in a database table and can be shared among multiple AppPages Dynamic tags allow you to standardize components of multiple AppPages such as the headers and footers that appear on multiple AppPages in your Web application Dynamic tags reduce maintenance costs and centralize the source of updates to Web appli cations See Using Dynamic Tags in AppPages on page 9 1 for more information AppPage tags AppPage tags are provided with the Web DataBlade module and are processed by the WebExplode function The AppPage tags identify elements of an HTML page and specify the structure and formatting for that page See AppPage Tags on page 6 3 for more information Variable processing functions Variable processing functions enable calculations to be performed using variables that are passed into an AppPage generated within the AppPage or returned from your database See Variable Processing Functions on page 8 3 for more information User defined routine UDR tag A user defined routine tag is a tag inan AppPage that directly executes an existing user defined routine and places the output of the execution of the routine within the AppPage See What Is a User Defined Routine UDR Tag on page 10 3 for more information on user defined routines IBM Informix Web DataBlade Module App
25. TABLE gt lt MIBLOCK gt lt BODY gt lt HIML gt Using Variable Processing Functions in AppPages 8 11 Using SEPARATE and REPLACE in Variable Expressions The columns of the employees table are displayed as a check box list You check one or more columns of the employees table to be retrieved then submit the form to post it to the same table_prog html AppPage On the second call to the AppPage the SQL statement that retrieves the checked columns of the employees table is built by the WebExplode function using the SEPARATE variable processing function to place commas between the selected columns in the SELECT statement The REPLACE variable is then used to replace the commas separating items in the vector variable with TH tags to create an HTML table row Finally the WebExplode function builds the output in an HTML table The following figure shows sample Web browser output Figure 8 2 Web Browser Select from Table Select f Tabl elect trom lable http domain port hr_app Mlval table_prog html Select Columns from Employees Table Mist name BB last_name Wiii _Jonsite L department Get Rows Beth Hume Product Manager Craig Wallace Line Worker Kermit French Event Co ordinator Simon Smith Senior Salesman 8 12 IBM Informix Web DataBlade Module Application Developer s Guide Using Variable Expre
26. UNSETVAR variable processing function 8 8 Upgrading from a 9 2x server 1 8 Uploading client files 13 7 UPPER variable processing function 8 8 URL prefix 4 6 URLDECODE variable processing function 8 9 See also WebURLDecode function URLENCODE variable processing function 8 9 See also WebURLEncode function user Webdriver variable C 4 Utilities webconfig C 3 V Variable expressions 6 29 6 31 8 3 Variable processing functions AND 8 4 arithmetic 8 3 8 10 CONCAT 8 4 conditional output 8 13 DEFER 8 5 EC 8 5 EQ 8 5 EVAL 8 5 EXIT 8 5 FIX 8 5 HTTPHEADER 8 5 13 3 IF 8 5 8 6 INDEX 8 6 ISINT 8 6 ISNOVALUE 8 6 ISNULL 8 6 ISNUM 8 6 LOWER 8 6 MOD 8 6 NC 8 6 NE 8 6 6 IBM Informix Web DataBlade Module Application Developer s Guide NOT 8 6 NTH 8 7 NXST 8 7 OR 8 7 PARSE HTML 8 7 POSITION 8 7 REPLACE 8 8 8 11 ROUND 8 8 SEPARATE 8 8 8 11 SETVAR 8 8 STRFILL 8 8 string 8 3 STRLEN 8 8 SUBSTR 8 8 TRACEMSG 6 43 8 8 A 6 TRIM 8 8 TRUNC 8 8 UNSETVAR 8 8 UPPER 8 8 URLDECODE 8 9 URLENCODE 8 9 VECAPPEND 8 9 VECSIZE 8 9 WEBUNHTML 8 9 XOR 8 9 XST 8 9 Variables case sensitivity 5 3 column 6 7 conditional expression 6 29 6 31 debug_file A 9 debug_level A 9 error_page 5 17 C 23 MI_DRIVER_ERROR 5 17 MI_LOOP_MAX C 29 MI_NOVALUE 6 13 MI_NULL 6 13 MI_WEBEXPLEVEL A 6 C 27 MI_WEBEXPLOG A 6 C 27 naming 5 3 processing 6 11 raw_password A 2 C 26 redirect_url 5 17 C 23 row 6 7 scope 5 3 12 4 show_exceptions
27. When you submit the form Webdriver invokes the display_table html AppPage and performs a SELECT statement from the specified table the browser then displays the output The following example shows the select_table html AppPage lt HTML gt lt HEAD gt lt TITLE gt Select from Table lt TITLE gt lt HEAD gt lt BODY gt lt FORM METHOD POST ACTION lt MIVAR gt SWEB_HOME lt MIVAR gt gt lt MIVAR NAME Stable_name gt lt MIVAR gt Select from table lt HR gt lt MIVAR gt lt INPUT TYPE INPUT SIZE 40 NAME table_name VALUE Stable_name gt lt MIVAR gt lt INPUT TYPE SUBMIT VALUE Select gt lt INPUT TYPE HIDDEN NAME MIval VALUE display_table html gt lt FORM gt lt BODY gt lt HTML gt For information on the MIVAR tag used in this example see MIVAR Tag on page 6 27 The following illustration shows sample Web browser output for the select_table html AppPage The value department s has been entered in the text box Web Browser Select from Table Figure 3 1 URL http domain port hr_app Mlval select_table htm Select from table m M A gt a Select from Table Basics of AppPage Development 3 13 Example of Using FORM Tag Links The following example is the display_table html AppPage lt HTML gt lt HEAD gt lt TITLE gt Display Table Data lt TITLE gt lt HEAD gt lt BODY gt lt TABLE BORDER gt lt TR gt lt MISOL SOL select a c
28. gt green lt MIVAR gt lt MIVAR NAME vec 3 gt expensive lt MIVAR gt lt MIBLOCK INDEX fred FOREACH vec gt lt MIVAR gt Characteristics of product fred lt MIVAR gt lt MIBLOCK gt The result of executing this AppPage is as follows Characteristics of product hard Characteristics of product green Characteristics of product expensive Using Tags in AppPages 6 35 Loop Processing 6 36 The following flowchart illustrates the program logic for the FOREACH loop Figure 6 7 FOREACH Loop Processing INDEX Raise attribute error valid FOREACH variable exist Unprocessed element in vector variable Move next element of vector variable to INDEX Processbody of loop IBM Informix Web DataBlade Module Application Developer s Guide Loop Processing WHILE Loop Processing The WHILE loop uses the following attribute of the MIBLOCK tag Attribute Description WHILE Variable expression that evaluates to a numeric value The WHILE variable expression evaluates to a numeric value If the variable expression is nonzero all statements are executed within the body of the MIBLOCK tag Control then returns to the WHILE attribute and the variable expression is checked again If the variable expression evaluates to nonzero the process is repeated If the variable is 0 processing resumes with the end tag The following example writes out 10 messages with the test variable descending tow
29. lt H3 gt lt FORM METHOD POST ACTION lt MIVAR gt SWEB_HOME lt MIVAR gt gt lt Hidden Fields gt lt INPUT TYPE hidden NAME action VALUE on gt lt INPUT TYPE hidden NAME MIval VALUE checkboxlist html gt lt SQL to generate check box list gt lt CHECKBOXLIST NAME names SQL select first_name from employees order by first_name CHECKED select first_name from employees where onsite t gt lt P gt Control click names to toggle on and off Then choose Submit lt P gt lt INPUT TYPE SUBMIT VALUE Submit gt lt INPUT TYPE RESET VALUE Reset gt lt FORM gt lt HR gt lt MIVAR COND XST action gt SQL executed lt I gt S sql_statement2 lt 1I gt lt MIVAR gt lt P gt lt MIVAR COND XST action gt SQL executed lt I gt sql_statement1 lt I gt lt MIVAR gt lt P gt lt BODY gt lt HTML gt IBM Informix Web DataBlade Module Application Developer s Guide RADIOLIST The following figure is sample Web browser output Web Browser CHECKBOXLIST Example Figure 9 1 CHECKBOXLIST URL http domain port hr_app Mlval checkboxlist html Browser Output Employees that work onsite L Beth Betty E Craig H Gonzo E Kermit LI Sarah L Simon LI Wilma Control click names to toggle on and off Then choose Submit Submit Reset SQL executed update employees set onsite f where first_name not in Betty
30. lt HEAD gt BODY gt H2 gt Current list of employees and job titles lt H2 gt B gt Gonzo Babbage lt B gt Product Manager lt BR gt B gt Betty Pen lt B gt Senior Line Worker lt BR gt B gt Craig Wallace lt B gt Line Worker lt BR gt B gt Sarah Dun lt B gt Event Co ordinator lt BR gt B gt Kermit French lt B gt Event Co ordinator lt BR gt B gt Wilma Jones lt B gt Salesman lt BR gt B gt Simon Smith lt B gt Senior Salesman lt BR gt lt B gt Beth Hume lt B gt Product Manager lt BR gt lt BODY gt lt HTML gt NAA AKA AAAAA A 12 6 IBM Informix Web DataBlade Module Application Developer s Guide WebExplode The following figure shows sample Web browser output Web Browser Employee List ds de ebExplode URL http domain port hr_app Mlval emp_list html Current list of employees and job titles Wilma Jones Salesperson Simon Smith Senior Salesperson Craig Wallace Line Worker Betty Pen Senior Line Worker Beth Hume Product Manager Gonzo Babbage Product Manager Sarah Dun Event Coordinator Kermit French Event Coordinator v O gt Using DataBlade Module Functions in AppPages 12 7 WebLint WebLint The WebLint function scans an AppPage and reports syntax errors within AppPage tags Important WebLint does not evaluate dynamic tags Syntax The WebLint0 function has the following signature WebLi
31. lt MIELSE gt You are multilingual lt MIBLOCK gt MIBLOCK tags can be embedded within one another The following example shows how the MIELSE tag with a COND attribute might be used within embedded MIBLOCK tags lt MISOL SQL select foreign_language from languages where name John Doe gt 1 lt MISQL gt lt MIBLOCK COND MI_ROWCOUNT gt american lt MIELSE gt lt MIBLOCK COND S MI_ROWCOUNT 1 gt bilingual lt MIELSE COND S MI_ROWCOUNT 2 gt multilingual lt MIELSE gt polyglot lt MIBLOCK gt lt MIBLOCK gt Using Tags in AppPages 6 39 MIERROR Tag MIERROR Tag Use the MIERROR tag to specify the processing that takes place when the WebExplode function encounters an error within other AppPage tags Errors can occur if the database server cannot successfully process an SQL statement if you try to access an unassigned variable or if you use an incorrect tag construct Important The placement of MIERROR tags is significant You must specify MIERROR tags within an AppPage prior to invoking them The following table lists the MIERROR tag attributes Attribute Mandatory Description TAG No Specifies the type of processing when an error occurs This attribute must be assigned to an MISQL MIVAR or dynamic tag If you make the TAG MISQL attribute assignment the SQL attribute must also be specified If you make the TAG MIVAR attribute as
32. program and then execute the program with the Perl binary For detailed instructions on using the SERVICE attribute of the MIEXEC tag refer to Using the MIEXEC Tag in an AppPage following 7 10 IBM Informix Web DataBlade Module Application Developer s Guide Using the MIEXEC Tag in an AppPage The first time you specify a Perl program with the SERVICE attribute the specified Perl program is started and it remains available for the life of the database server This means that subsequent uses of the MIEXEC tag in your AppPages do not need to include the SERVICE attribute the Web DataBlade module automatically uses the Perl program previously started This also means that by default your AppPages can only use one Perl program with each MIEXEC tag specifically the Perl program pointed to by the first use of the MIEXEC tag in an AppPage If you need different MIEXEC tags to specify different Perl programs you must shut down the currently running Perl program so that the new Perl program is allowed to start To shut down the currently running Perl program in an AppPage use the MISOL tag to execute the WebRmtShutdown function Add the MISQL tag to your AppPages before each MIEXEC tag that uses a different Perl program from the one that is currently running The following example shows how to execute the WebRmtShutdown function with the MISQL tag lt MISQL SOL EXECUTE FUNCTION WebRmt Shutdown gt 1 lt MISQL gt
33. you must include the variables to be imported and exported passed by reference as name value pairs Attribute Mandatory Description FUNCTION Yes Specifies the location of the Webdriver function in the Web server and names the routine requested OPTIONS No Specifies a user defined function that has to provide a usage description of inputs and outputs DLL No Specifies the dynamically linked library DLL that contains the function pointed to by the FUNCTION attribute INTERNAL No Specifies one of two internal Webdriver functions Can be set to session_admin or cache_admin FUNCTION Attribute Use the FUNCTION attribute to locate the Webdriver function on the Web server Assign the value of the FUNCTION attribute to the name of the Webdriver function When the MIFUNC tag is executed all AppPage processing stops until the Webdriver function has completed execution Everything between the MIFUNC tags is executed using the variables that have been modified by reference in the Webdriver function as well as all the variables originally supplied to the AppPage The following AppPage example invokes the example_onstat function lt MIBLOCK COND NXST opt gt lt MIVAR gt S SETVAR Sopt 1 tmp lt MIVAR gt lt MIBLOCK gt lt MIFUNC FUNCTION example_dir OPTIONS Sopt RESULTS gt lt MIVAR gt S HTTPHEADER Content type text plain SRESULTS lt MIVAR gt lt MIFUNC gt 7 4 IBM Informix Web DataBlade Mod
34. 12 JK L MN OP QRS TU VW X Y Z QUERY_STRING Web server variable 5 8 query_timeout Webdriver variable C 7 Quotes in variable expressions 8 17 in Web DataBlade module tags 6 51 R RADIOLIST system dynamic tag 9 11 RAW mode A 2 raw_password Webdriver variable A 2 Recursive calls C 29 redirect_url Webdriver variable 5 17 C 13 C 14 C 23 Release notes program item Intro 13 REMOTE_ADDR Web server variable 5 8 REMOTE_USER Web browser variable C 7 REMOTE_USER Web server variable 5 8 REPLACE variable processing function 8 8 8 11 Replication of data 1 8 REQUEST_METHOD Web server variable 5 8 RESULTS attribute of MISQL tag 6 5 RESULTS Attribute of MISQL tag 6 15 Retrieving large objects 3 15 revert93to92 sql script 1 9 Row variables 6 7 S schema_version Webdriver variable C 27 Scope of variables 5 3 12 4 Security of Web DataBlade Module Administration Tool C 3 SELECTLIST system dynamic tag 9 15 Sending initial SQL statements to the database server C 8 SEPARATE variable processing function 8 8 8 11 Server functions 12 3 server Webdriver variable C 5 SERVER_PROTOCOL Web server variable 5 8 Session Variables session 5 13 C 21 session_buckets 5 13 C 22 session_home 5 13 C 21 session_life 5 13 C 22 session_location 5 13 C 22 setting 5 13 session_admin function 7 6 SETVAR variable processing function 8 8 SGML tags 1 5 6 3 9 4 show_exceptions Webdriver variable 5 17 C 23 Software dependencie
35. 6 MI_WEBREDIRECT Webdriver variable C 13 C 14 C 23 MI_WEBSCHEMADEF Webdriver variable C 27 MI_WEBSESSION Webdriver variable C 21 MI_WEBSESSIONHOME Webdriver variable C 21 MI_WEBSESSIONLIFE Webdriver variable C 22 MI_WEBSESSIONLOC Webdriver variable C 22 MI_WEBSESSIONSUB Webdriver variable C 22 MI_WEBSHOWEXCEPTIONS variable 6 46 MI_WEBSHOWEXCEPTIONS Webdriver variable C 23 C 24 MI_WEBTAGSCACHE 9 8 C 28 MI_WEBTAGSTABLE 9 7 C 28 MI_WEBUPLOADDIR Webdriver variable C 25 MOD variable processing function 8 6 Multibyte character sets C 3 C 9 Multimedia object types 4 8 N NAME attribute of MISQL tag 6 5 of MIVAR tag 6 27 6 28 A BC DEFGH NC variable processing function 8 6 NE variable processing function 8 6 Non HTML pages retrieving 13 3 NOT variable processing function 8 6 NTH variable processing function 8 7 NXST variable processing function 8 7 O Object types 4 10 OR variable processing function 8 7 P parse_html_directory Webdriver variable C 10 password Webdriver variable C 4 password_key Webdriver variable C 4 PATH_INFO Web server environment variable 13 12 Performance caching 6 18 Perl programming 7 9 POSITION variable processing function 8 7 PREPARE attribute of MISQL tag 6 6 6 21 Processing variables 6 11 Program groups Documentation notes Intro 13 Release notes Intro 13 Projects adding 4 9 editing 4 9 Q QUERY_STRING Web server environment variable 13
36. BODY gt Welcome to my page This is the end lt BODY gt lt HTML gt Important As with any AppPage tag be sure to always specify an end tag If an end MICOMMENT tag is missing the WebExplode function removes all text from the beginning tag to the end of the AppPage For example the following AppPage does not contain an end MICOMMENT AppPage tag lt HTML gt lt TITLE gt Welcome Page lt TITLE gt lt BODY gt Hello lt MICOMMENT gt This is a comment This is supposed to be the body of the AppPage Unfortunately it is going to be removed by WebExplode lt BODY gt lt HTML gt After exploding the AppPage the WebExplode function returns the following HTML to Webdriver lt HTML gt lt TITLE gt Welcome Page lt TITLE gt lt BODY gt Hello Note that the WebExplode function removed all text after the beginning MICOMMENT AppPage tag 6 50 IBM Informix Web DataBlade Module Application Developer s Guide Special Characters in AppPage Tags Special Characters in AppPage Tags Replacement characters within your AppPages are described in the following sections m Special HTML Characters following m Special Formatting Characters on page 6 52 Special HTML Characters An entity reference is a way to instruct the browser to look up symbols as it renders an AppPage and replace them with equivalent characters You must replace the double quote character with its entity reference
37. BR gt You are a sweepstakes winner lt MIVAR gt lt BODY gt lt HTML gt 6 28 IBM Informix Web DataBlade Module Application Developer s Guide COND Attribute If the INPUT_TITLE variable is unassigned the preceding AppPage returns the following output to the client lt HTML gt lt HEAD gt lt TITLE gt Variable Assignment 2 lt TITLE gt lt HEAD gt lt BODY gt Dear Sir or Madam lt BR gt You are a sweepstakes winner lt BODY gt lt HTML gt If the INPUT_TITLE variable is assigned elsewhere for example in the calling URL or in an HTML form that value overrides the default value COND Attribute The COND attribute specifies a condition that is evaluated before the tag is processed If the condition is true the tag is processed Conditions are variables or variable expressions that are false if 0 and true if nonzero ERR Attribute The ERR attribute links an MISQL MIVAR MIBLOCK or dynamic tag with an MIERROR tag to be invoked if an error occurs in the processing of that tag Specify an ERR attribute in an MISOL MIVAR or MIBLOCK tag to invoke an MIERROR tag with a matching ERR attribute when an error occurs MIBLOCK Tag The MIBLOCK tag enables you to delimit logical blocks of HTML to be executed in a variety of conditions Extensions to the MIBLOCK tag for example determine how many times a statement between lt MIBLOCK gt and lt MIBLOCK gt can be iterated The
38. DataBlade module APB has built in support for common multimedia objects such as images audio clips video clips and documents APB uses the same database schema as IBM Informix Data Director for Web DDW DDW is a set of Windows tools also used for developing Web applications with the Web DataBlade module This appendix describes the following tables that make up APB database schema wbExtensions wbPages wbPageVersions wbBinaries wbBinary Versions wbTags wbTag Versions wbPreviews wbProjects wbResProjects wbInfo wbUsers wbObjectTypes B 2 The wbExtensions Table The wbExtensions Table The wbExtensions table contains a row for each type of file extension you can specify when invoking an object in an AppPage Examples of extensions are html gif and doc The row for each extension describes the table that stores objects of this type source_table the column in the storage table that identifies the object ID_column the column in the storage table that contains the object content_column and the object s MIME super type and subtype super_type and sub_type When you initially install AppPage Builder in your database the wbExten sions table contains a default set of extensions that include most types of objects you should ever need to invoke in an AppPage For a complete list of default extensions see The wbExtensions Table on page 3 5 You can however add a new extension to the wbExtensions
39. DataBlade module application You can pass coordinates with Webdriver by using m The ISMAP attribute of the IMG tag m An HTML form These methods are described in the following sections IMG Tag To pass x and y coordinates through Webdriver set the MImap variable to on in the URL that calls the AppPage to which the coordinates are passed This prevents the coordinates from being overridden in the URL when you use the ISMAP attribute of the IMG tag to create an image map When the MImap variable is set to on in PATH_INFO the portion of a URL consisting of name value pairs following the pathname and preceding the Webdriver parses QUERY_STRING the portion of a URL following the into two variables called x_value and y_value which hold the values from the image map An example image map URL is as follows http myhost port hr map webdriver MImap on amp MIval image_example 100 13 13 12 IBM Informix Web DataBlade Module Application Developer s Guide IMG Tag You can then access x_value and y_value in this example 100 and 13 respec tively in the same way that you access other variables The following image_ismap html AppPage illustrates the use of image maps with the IMG tag lt HTML gt lt HEAD gt lt TITLE gt Standard Image Map Example lt TITLE gt lt HEAD gt lt BODY gt lt H2 gt Click on the image lt H2 gt lt TABLE BORDER gt lt TR gt lt TD VALIGN top gt lt Display the image as an im
40. JKLUMNOPQRSTUVV X Y ze MI_RAWPASSWORD Webdriver variable C 26 MLROWCOUNT variable 6 11 6 16 ML SQL variable 6 11 6 16 ML USER_DBCONNMAX Webdriver variable C 7 MI_USER_REMOTE Webdriver variable C 7 MI_WEBACCEPTCKI Webdriver variable C 24 MI_WEBACCESSLEVEL Webdriver variable 5 8 C 14 MI_WEBAUTHCACHE Webdriver variable C 11 MI_WEBCACHEADMIN Webdriver variable C 17 MI_WEBCACHEDIR Webdriver variable C 16 C 20 MI_WEBCACHEMAXLO Webdriver variable C 20 MI_WEBCACHEPAGE Webdriver variable C 16 MI_WEBCACHEPASSWORD Webdriver variable C 18 MI_WEBCACHESUB Webdriver variable C 20 MI WEBDBCONNWAIT Webdriver variable C 6 MI_WEBDRVLEVEL Webdriver variable C 20 MI_WEBERRORPAGE Webdriver variable C 14 C 23 MI_WEBEXPLEVEL variable A 6 MI_WEBEXPLODE_DEPTH WebExplode variable C 29 MI_WEBEXPLOG variable A 6 MI_WEBEXTENSIONS Webdriver variable C 26 MI_WEBGROUPLEVEL Webdriver variable 5 8 MI_WEBINITIALSOL Webdriver variable C 8 MI_WEBKEEPALIVE Webdriver variable C 8 MI_WEBLOPARAMS Webdriver variable C 15 MI_WEBLOQUERY Webdriver variable C 15 4 BM Informix Web DataBlade Module Application Developer s Guide MI_WEBLOSQLERROR Webdriver variable C 15 MI_WEBLOZEROROWS Webdriver variable C 15 MI_WEBMAXHTMLSIZE Webdriver variable C 9 MI_WEBNTPASSWORD Webdriver variable C 13 MI_WEBNTUSER Webdriver variable C 12 MI_WEBPAGELIFE Webdriver variable C 17 MI_WEBQRYTIMEOUT Webdriver variable C 7 MI_WEBRECONNECT Webdriver variable C
41. MICOMMENT AppPage tag to add comments to an AppPage The WebExplode function removes all text between the beginning and end MICOMMENT AppPage tag before it returns the resulting HTML to Webdriver The MICOMMENT AppPage tag does not have any attributes The following example shows how to use the MICOMMENT AppPage tag in an AppPage lt HTML gt lt TITLE gt Welcome Page lt TITLE gt lt BODY gt Hello lt MICOMMENT gt This is a comment that won t appear in the browser lt MICOMMENT gt lt BODY gt lt HIML gt After exploding the AppPage the WebExplode function returns the following HTML to Webdriver lt HTML gt lt TITLE gt Welcome Page lt TITLE gt lt BODY gt Hello lt BODY gt lt HTML gt You can nest MICOMMENT AppPage tags the WebExplode function removes all the text between the outermost beginning and end AppPages tags For example the following AppPage uses nested MICOMMENT AppPage tags lt HTML gt lt TITLE gt Welcome Page lt TITLE gt lt BODY gt Welcome to my page lt MICOMMENT gt This is the first comment lt MICOMMENT gt This is the second comment lt MICOMMENT gt lt MICOMMENT gt This is the end lt BODY gt lt HTML gt Using Tags in AppPages 6 49 MICOMMENT Tag After exploding the AppPage the WebExplode function returns the following HTML to Webdriver lt HTML gt lt TITLE gt Welcome Page lt TITLE gt lt
42. MIVAR gt gt lt INPUT TYPE HIDDEN NAME MIval VALUE image_form html gt lt INPUT NAME imagemap TYPE image BORDER 0 SRC lt MIVAR gt S WEB_HOME lt MIVAR gt MIval sun gif gt lt FORM gt lt TD gt lt TR gt lt TABLE gt lt Output imagemap x and imagemap y if a form gt lt HR gt lt MIBLOCK COND XST Simagemap x gt Output from Form Variables lt BR gt lt MIVAR gt imagemap x Simagemap x lt MIVAR gt lt BR gt lt MIVAR gt imagemap y S imagemap y lt MIVAR gt lt MIBLOCK gt lt BODY gt lt HIML gt The following figure shows sample Web browser output Web Browser Form Image Map Example Figure 13 5 Form Image Map URL http domain port hr_app Mlval image_form html Click on the image ES Output from Form Variables imagemap x 32 imagemap y 24 13 14 IBM Informix Web DataBlade Module Application Developer s Guide Two Pass Query Processing Two Pass Query Processing Webdriver generates an SOL statement to retrieve an AppPage by building a call to the WebExplode function as described in IBM Informix Web DataBlade Module Administrator s Guide The SOL statement looks something like the following example SELECT WebExplode object name valuesname2 value2 FROM wbPages WHERE ID mypage and path and extension html The preceding query successfully retrieves the requested AppPage in all but the following two cases m Th
43. MIextension How to Link AppPages Linking AppPages with the ANCHOR Tag Linking AppPages with the FORM Tag Example of Using FORM Tag Links How to Retrieve Large Objects Retrieving Large Objects By Name Retrieving Large Objects By Large Object Handle 3 3 3 4 3 2 IBM Informix Web DataBlade Module Application Developer s Guide In This Chapter This chapter describes some basic elements of AppPages the HTML pages that make up your Web enabled database application In addition it describes how AppPages are extracted from the database and how they are connected to create a flow to your Web application It includes the following topics AppPage Elements on page 3 4 Where AppPage Objects Are Stored on page 3 5 How to Invoke AppPages on page 3 9 How to Link AppPages on page 3 11 How to Retrieve Large Objects on page 3 15 Basics of AppPage Development 3 3 AppPage Elements 3 4 AppPage Elements An AppPage is an HTML page that dynamically executes SQL statements that query the database and that formats the results You can retrieve traditional data types into an AppPage as well as HTML image audio and video data An AppPage can include the following elements in addition to standard HTML tags Variables Variables are named storage spaces that can be used within an AppPage Variables can also be configured using the Web DataBlade Module Administration Tool
44. Not Found NOACCESS No access permissions TRUNCATED Results exceeded max_html_size Using Variables in AppPages 5 17 Error Handling with the MI_DRIVER_ERROR Variable 5 18 Error Condition Error Message combinations to NOTFOUND m NOACCESS goes to myerror_page NOACCESS to TRUNCATED to QORYTIMEOUT IBM Informix Web DataBlade Module Application Developer s Guide The following table lists the errors provided for pre AppPage execution SESSION TIMEOUT Session exceeded session_life SESSION INVALID Bogus session ID passed to session manager SESSION MANAGER _ Session manager not running external process SESSION ERROR General failure in session code For error handling the variables show_exceptions redirect_url and error_page may be set or not set in various combinations This affects what is received by the browser and what is executed by the WebExplode function The following sections discuss the post AppPage errors when the variables show_exceptions redirect_url and error_page are set or not set in various If the Webdriver variable error_page is set to an AppPage that might be called myerror_page the following error handling occurs m NOTFOUND goes to myerror_page and MI_DRIVER_ERROR is set and MI_DRIVER_ERROR is set to m TRUNCATED goes to myerror_page and MI_DRIVER_ERROR is set m QRYTIMEOUT goes to myerror_page and MI_DRIVER_ERROR is set If show_exceptions redirect_url and error_page
45. Project TEXTAREA Width Versioning default doc 80 Off User Level Default Object TEXTAREA Height WebLint Checking AppPage 20 Level2 Using AppPage Builder 4 7 Multimedia Content The following table describes the APB options displayed in Figure 4 1 Option Action Add Object Add a new AppPage dynamic tag audio document image video or other Web application object Edit Object Edit delete or view a Web application object Admin Menu Edit or delete a user account project extension type or object type You can add or edit AppPages by typing or pasting into the text area or by uploading a client file You can add and edit multimedia objects by uploading a client file The Admin Menu option is described in more detail in Administration Features on page 4 9 Multimedia Content The following table lists the multimedia object types that you can use with APB The Table column indicates the table where the objects are stored in the database Object Type Supported Formats Table AppPage HTML wbPages Dynamic tag HTML wbTags Audio AU WAV and AIFF wbBinaries Document MS Word MS PowerPoint and Adobe PDF wbBinaries Image GIF and JPEG wbBinaries Video Quicktime MPEG and AVI wbBinaries Appendix B AppPage Builder Schema describes the complete APB schema and information on adding new object types and MIME types 4 8 IBM Informix Web DataBlade Module Applicatio
46. SQL Tutorial It provides a tutorial on SQL as it is implemented by IBM Informix products It also describes the fundamental ideas and terminology for planning and implementing a object relational database A companion volume to the Tutorial the IBM Informix Guide to SQL Reference includes details of the IBM Informix system catalog tables describes IBM Informix and common environment variables that you should set and describes the column data types that IBM Informix database servers support An additional companion volume to the Reference the IBM Informix Guide to SQL Syntax provides a detailed description of all the SQL statements supported by Informix products This guide also provides a detailed description of Stored Procedure Language SPL statements The DB Access User s Manual describes how to invoke the DB Access utility to access modify and retrieve information from IBM Informix database servers The performance guide for your database server provides infor mation on how to improve the performance of your SQL queries Introduction 11 Online Documentation UNIX m If you plan to develop your own DataBlade modules using the Web DataBlade module as a foundation read the DataBlade Developers Kit User s Guide This manual describes how to develop DataBlade modules using BladeSmith BladePack and BladeManager m When errors occur you can look them up by number and learn their cause and solution in the IBM Info
47. TABLE BORDER gt lt TR gt lt TD gt Jerry Lewis lt TD gt lt TD gt Frank Sinatra lt TD gt lt TR gt lt TR gt lt TD gt Dean Martin lt TD gt lt TD gt Cher lt TD gt lt TR gt lt TR gt lt TD gt Madonna lt TD gt lt TD gt lt TD gt lt TR gt lt TABLE gt lt BODY gt lt HTML gt Using Tags in AppPages 6 13 WINSTART Attribute The following illustration shows sample Web browser output Web Browser Simple Select 5 Figure 6 5 Simple Select 5 URL http domain port hr_app Mlval select5 html Ma Jerry Lewis Frank Sinatra Dean Martin Madonna O A i WwW A blank space replaces the null values of last_name for Cher and Madonna Because the query retrieves an odd number of rows a blank space also replaces the columns that have no value in the last table cell WINSTART Attribute The WINSTART attribute of the MISQL tag indicates the first row in the current result set to process WINSTART can be assigned a value or can be designated a value by a variable The value of WINSTART increments to begin with the next consecutive row number following the last row number that was retrieved If you have set the WINSIZE attribute to 20 the WINSTART value is 0 for the first iteration through the relevant portion of the AppPage The second iteration through the AppPage sets the WINSTART value to 20 The third iteration through the AppPage sets the WINSTART
48. To add a second AppPage to your getting_started project click AppPage The Add AppPage AppPage appears Your getting_started project should be selected as the default project 3 Type the name of your AppPage page2 in the Page ID text box Be sure Path is set to and Extension is set to html Web DataBlade Module Tutorial 2 11 Step 4 Create the Second AppPage of Your Application 2 12 4 5 Type the following HTML code in the AppPage text area lt my_header TITLE Web Applications Inc gt Here s a list of all your tables click on the table name to see its columns lt br gt lt br gt lt table border 1 cell_padding 0 gt lt tr gt lt td gt lt b gt Table Name lt b gt lt td gt lt td gt lt b gt Table Owner lt b gt lt td gt lt td gt lt b gt Table Type lt b gt lt td gt lt tr gt lt MISQL SQL select tabname owner tabtype from systables where tabname not like sys and tabtype IN T v P S order by tabname gt lt tr gt lt td gt lt a href WEB_HOME MIval page3 html table 1 gt 1 lt a gt lt td gt lt td gt 2 lt td gt lt td gt lt MIVAR COND lt MIVAR COND lt MIVAR COND lt MIVAR COND lt td gt lt tr gt lt MISQL gt lt table gt EQ 3 T gt Table lt MIVAR gt EQ 3 V gt View lt MIVAR gt EQ 3 S gt Synonym lt MIVAR gt EQ 3 P gt Private Synonym lt MIVAR gt lt my_footer gt Click Save
49. Webdriver variables have not been configured the following error messages are returned to the browser m NOTFOUND returns 404 Asset not found m NOACCESS returns 403 Access not allowed m TRUNCATED returns 500 Server Error m QRYTIMEOUT returns 500 Server Error Error Handling with the MI_DRIVER_ERROR Variable If the Webdriver variable show_exceptions is set to on and redirect_url and error_page are not the following error messages are returned to the browser NOTFOUND returns 404 Asset not found NOACCESS returns 403 Access not allowed TRUNCATED returns an HTML error message explaining that the output has exceeded the value specified by the max_html_size variable QRYTIMEOUT returns an HTML error message explaining that the query had exceeded the time limit specified by the query_timeout variable If the Webdriver variable show_exceptions is set to on redirect_url is set to http www yoursite com and error_page is not set the following error messages are returned to the browser NOTFOUND goes to http www yoursite com NOACCESS goes to http www yoursite com TRUNCATED returns an HTML error message explaining that the output has exceeded the value specified by the max_html_size variable QRYTIMEOUT returns an HTML error message explaining that the query has exceeded the time limit specified by the query_timeout variable If the Webdriver variable redirect_url is set to http www yoursite com and sh
50. a valid attribute for a dynamic tag The COND attribute specifies a condition that is evaluated before the tag is processed If the condition is true the WebExplode function processes the tag Where Dynamic Tags Are Stored When the WebExplode function processes an AppPage and encounters a dynamic tag the WebExplode function substitutes the body of the dynamic tag in place of the tag identifier in the AppPage The WebExplode function searches for the body of dynamic tags in one of the following two tables depending on the development tool you use to create your AppPages and user defined dynamic tags m webTags If you use the AppPage Builder application provided in Version 3 3 and earlier of the Web DataBlade module to develop your Web appli cations AppPage Builder stores your user defined dynamic tags in the webTags system table The webTags system table is created at the time you register the Web DataBlade module in your database The webTags system table is the default table for storing dynamic tags If you have not set any of the dynamic tag Webdriver variables described in Dynamic Tag WebExplode Variables on page 9 7 in your Webdriver configuration the WebExplode function always searches the webTags system table for dynamic tags Using Dynamic Tags in AppPages 9 5 Where Dynamic Tags Are Stored m wbTags If you use the AppPage Builder application provided in Version 4 0 and later of the Web DataBlade modu
51. about large objects see the IBM Informix Guide to SQL Reference IBM Informix Web DataBlade Module Application Developer s Guide Using AppPage Builder In This Chapter Overview of AppPage Builder Registering AppPage Builder in Your Database Invoking AppPage Builder Using the URL Prefix Specially Created to Invoke APB A Using Any URL Prefix Creating Web Applications in Entes Builder Multimedia Content A Administration Features Adding an Extension 4 3 4 3 4 4 4 5 4 6 4 6 4 7 4 8 4 9 4 10 4 2 IBM Informix Web DataBlade Module Application Developer s Guide In This Chapter This chapter includes the following topics about AppPage Builder Overview of AppPage Builder following Registering AppPage Builder in Your Database on page 4 4 Invoking AppPage Builder on page 4 5 Creating Web Applications in AppPage Builder on page 4 7 Overview of AppPage Builder AppPage Builder APB is a Web DataBlade module application that enables you to create and maintain the AppPages that make up your Web applica tions You can use APB to create AppPages with any Web browser that supports forms and tables as defined in the HTML 3 0 specification If you use a Web browser that supports client file upload you can also use APB to manage multimedia content in the database Using AppPage Builder 4 3 Registering AppPage Builder in Your Database Registering AppPage Builde
52. applications Chapter 6 Using Tags in AppPages describes how to use Web DataBlade module tags to create Web enabled applications Chapter 7 Using Advanced AppPage Tags describes the AppPage tags and attributes that are used for specialized processing and critical optimization features of your Web application Chapter 8 Using Variable Processing Functions in AppPages describes how to use variable processing functions to create variable expressions within AppPages Chapter 9 Using Dynamic Tags in AppPages describes how to use dynamic tags to share AppPage segments among multiple AppPages Chapter 10 Using UDR Tags in AppPages describes how to directly invoke a UDR in a AppPage without using the SQL statement EXECUTE FUNCTION Chapter 11 Using the HTML Data Type describes the HTML data type that you use to store the AppPages that make up your Web enabled database application IBM Informix Web DataBlade Module Application Developer s Guide Types of Users m Chapter 12 Using DataBlade Module Functions in AppPages describes the WebExplode function and additional server functions you can use to simplify AppPage design m Chapter 13 Using Other Webdriver Features describes Webdriver features including adding HTTP headers to your AppPages uploading client files and passing image map coordinates m Chapter 14 Using DataBlade Module API Functions in AppPages
53. as the corresponding URL prefixes defined for a Web server and the Web DataBlade module application stored in a database See URL prefix A variable that Webdriver uses to connect to a database and to obtain infor mation about a Web DataBlade module application There are two types of Webdriver variables those that reside in the web cnf file collectively known as Webdriver mappings and those that reside in the database collectively known as Webdriver configurations See also Webdriver mapping Webdriver configuration An Informix database server function that builds dynamic HTML pages based on data stored in a database The WebExplode function parses App Pages that contain AppPage tags and dynamically builds and executes the SOL statements embedded in the tags The WebExplode function returns the HTML page to the client application usually Webdriver 6 IBM Informix Web DataBlade Module Application Developers Guide ABCDEFGH I JyJKLMNOPQRSTUVWWXxY ze Index Numerics 9 2x server 1 8 A accept_cookie Webdriver variable 13 5 Anchor tag linking AppPages 3 12 Anchor variable WEB_HOME 2 10 3 11 C 2 anchorvar Webdriver variable C 2 AND variable processing function 8 4 API functions 14 3 AppPage Builder B 1 adding a project using 2 4 administration features of 4 9 creating an application using 2 4 creating AppPage using 2 8 creating user defined tag using 2 5 creating web applications with 4 7 d
54. describes the three classes of loop processing you can use with the MIBLOCK tag m FOR Loop over a sequence of numbers m FOREACH Loop over the values in a vector variable m WHILE Loop until the evaluation of COND results in a value of 0 6 32 IBM Informix Web DataBlade Module Application Developer s Guide Loop Processing FOR Loop Processing The FOR loop uses the following attributes of the MIBLOCK tag Attribute Description INDEX Variable used as a loop counter FROM Initial value of INDEX TO Final value of INDEX STEP optional Amount INDEX is changed each time through the loop If not specified STEP defaults to 1 This value can be either a positive or negative integer The value of the STEP attribute determines loop processing as follows Value Descriptions Positive or 0 INDEX is less than or equal to TO Negative INDEX is greater than or equal to TO Once the loop starts all statements within the body of the MIBLOCK tag are executed and the INDEX attribute value is added to the TO attribute Either the statements in the loop execute again based on the same test that caused the loop to execute initially or the loop is exited and processing continues at the end tag This is an example of a FOR loop that starts at 10 and counts down to 0 lt MIBLOCK INDEX idx TO 0 FROM 10 STEP 1 gt lt MIVAR gt Sidx iterations left lt MIVAR gt lt MIBLOCK gt Important Changing t
55. dynamic tags provided by the IBM Informix Web DataBlade module to simplify the creation of graphical objects in your AppPages such as check box lists radio button lists and selection lists The system dynamic tags are described in detail in Using System Dynamic Tags on page 9 8 User defined dynamic tags are dynamic tags that you create yourself using AppPage Builder The section Creating User Defined Dynamic Tags on page 9 17 describes in detail how to create a user defined dynamic tag Specifying Dynamic Tags in AppPages You specify a dynamic tag both system and user defined in an AppPage using the SGML like syntax lt tag_name gt Specify parameters to dynamic tags as tag attributes The following example contains the display_image user defined dynamic tag These are the employees in department 20 lt HR gt lt CENTER gt lt display_image NAME Semp_name DEPT 20 gt lt CENTER gt The display_image dynamic tag has two attributes NAME and DEPT IBM Informix Web DataBlade Module Application Developers Guide Where Dynamic Tags Are Stored You must have previously created a user defined dynamic tag before you specify it in an AppPage For detailed instructions refer to Creating User Defined Dynamic Tags on page 9 17 Dynamic tags accept variables variable expressions and constants as parameter values The COND attribute of AppPage tags described in COND Attribute on page 6 29 is also
56. environment variables file and pathnames and interface elements such as icons menu items and buttons appear in boldface monospace Information that the product displays and information that you monospace enter appear ina monospace typeface KEYSTROKE Keys that you are to press appear in uppercase letters in a sans serif font This symbol indicates the end of product or platform specific information gt This symbol indicates a menu item For example Choose Tools gt Options means choose the Options item from the Tools menu Tip When you are instructed to enter characters or to execute a command immediately press RETURN after the entry When you are instructed to type the text or to press other keys no RETURN is required Case Sensitive Text Variable names used in the IBM Informix Web DataBlade module are case sensitive are preceded by a dollar sign and consist of alphanumeric and underscore characters Variables that begin with an underscore are reserved for system use Introduction 7 Typographical Conventions 8 Case Insensitive Text Tags identify the elements of an HTML page and specify the structure and formatting for that page The IBM Informix Web DataBlade module includes a set of tags that are processed by the WebExplode function The Web DataBlade module tags use the SGML processing instruction tag format lt tag_info gt lt tag_info gt An SGML proc
57. greater than val2 returns 1 otherwise returns 0 If the numbers val1 and val2 are not equal returns 1 otherwise returns 0 If the number val1 is less than or equal to val2 returns 1 otherwise returns 0 If the number vall is greater than or equal to val2 returns 1 otherwise returns 0 Returns the logical AND of the integers vall through valn Processing halts when a false condition is reached Concatenates arg1 and arg2 1 of 6 Function DEFER udtname name val name val EC string1 string2 EQ string1 string2 EVAL varname EXIT depth FIX value HTTPHEADER name value Eexpr dotrue Variable Processing Functions Returns When using modified URLs a cached page must be modified before being transmitted by WebDriver This requires that the Web DataBlade module replace a key in the output stream The parameter udtname is mapped to the output stream When Webdriver finds an AppPage in the cache it scans and replaces keys on the AppPage and transmits the AppPage to the browser If string and string2 are identical regardless of lettercase returns 1 otherwise returns 0 If string and string2 are identical including lettercase returns 1 otherwise returns 0 Evaluates the variable passed as the first parameter On success outputs the resultant string On failure raises an exception The name of a previously defined variable is varname Exits a cont
58. gt 6 Click Save Notice that the passed user defined variable Stable is used in the MISOL tag to retrieve the columns of the passed table name lt MISQL SOL select c colname from syscolumns c systables t where c tabid t tabid and t tabname Stable gt Step 6 Invoke the Application There are two ways you can invoke your Web application once you have created all the pages and saved them in the database The first way is to use APB by following the steps provided next To invoke the application from APB 1 Click Edit Object 2 Click the welcome html AppPage 3 Click Run The welcome html AppPage appears in a browser You can now link to the rest of your application s AppPages IBM Informix Web DataBlade Module Application Developer s Guide Step 6 Invoke the Application The second way to invoke your Web application is to call it directly in a browser by entering a URL similar to this one http domain port mapping MIval welcome html For more information on URLs refer to Basics of AppPage Development on page 3 1 For more information on Webdriver mapping refer to the IBM Informix Web DataBlade Module Administrator s Guide Web DataBlade Module Tutorial 2 15 Basics of AppPage Development In This Chapter AppPage Elements Where AppPage Objects Are Stored The wbExtensions Table Adding a New Extension to the wbBinaries Table How to Invoke AppPages e Using MIpath and
59. gt lt TITLE gt Variable Assignment 1 lt TITLE gt lt HEAD gt lt BODY gt lt MIVAR NAME TITLE gt Entrepreneur lt MIVAR gt lt MIVAR NAME SALUTATION gt Dear TITLE lt MIVAR gt lt MIVAR gt SALUTATION lt BR gt You are a sweepstakes winner lt MIVAR gt lt BODY gt lt HTML gt When you do not specify the NAME attribute the text between the tags is output Variables between the tags are expanded Asa result of the preceding AppPage the WebExplode function returns the following output to the client lt HTML gt lt HEAD gt lt TITLE gt Variable Assignment 1 lt TITLE gt lt HEAD gt lt BODY gt Dear Entrepreneur lt BR gt You are a sweepstakes winner lt BODY gt lt HTML gt Important Within the NAME attribute assignment NAME varname the in front of the variable name is optional In all other occurrences you must precede the variable name with a DEFAULT Attribute Use the DEFAULT attribute to specify a default value for any unassigned variables between the start and end MIVAR tags In the following var2 html AppPage the DEFAULT attribute is used to replace any unassigned variables between the start and end MIVAR tags with the value specified in the DEFAULT attribute lt HTML gt lt HEAD gt lt TITLE gt Variable Assignment 2 lt TITLE gt lt HEAD gt lt BODY gt lt MIVAR NAME TITLE DEFAULT Sir or Madam gt SINPUT_TITLE lt MIVAR gt lt MIVAR gt Dear STITLE lt
60. if the character occurs within AppPage tags between angle brackets Character Entity Reference amp quot For example the double quotes in the following SQL statement must be replaced by their entity reference when they are included in a Web DataBlade module tag insert into staff values Walt Speedy Wait Engineer The syntax of the MISQL tag includes the quot entity reference lt MISOL SOL insert into staff values Walt amp quot Speedy amp quot Wait Engineer gt 1 row inserted lt MISOL gt Using Tags in AppPages 6 51 Special Formatting Characters 6 52 Special Formatting Characters You must replace characters that normally specify formatting information with the following replacements when they occur within formatting specifi cations between the start and end tags Character Replacement i y For example in the following MIVAR tag the character has been replaced lt MIVAR gt You may have won 1 000 000 00 lt MIVAR gt This returns the following output to the client You may have won 1 000 000 00 IBM Informix Web DataBlade Module Application Developer s Guide Using Advanced AppPage Tags In This Chapter MIFUNC Tag FUNCTION Attribute DLL Attribute INTERNAL Attribute The cache_admin Variable The session_admin Function MIDEFERRED Tag The defer Prefix The MIEXEC Tag SERVICE Attribute Using the MIEXEC Tag in
61. is performed when the MIERROR tag is invoked This error handler retrieves an error message from the my_weberr_catalog table The error handler assumes that the table already exists lt MIERROR TAG MISQL SQL select error_msg from my_weberr_catalog where error_id MI_ERRORCODE gt 1 lt MIERROR gt This is equivalent to executing the following MISQL tag lt MISQL SQL select error_msg from my_weberr_catalog where error_id SMI_ERRORCODE gt 1 lt MISQL gt Important When an error occurs during the processing of an AppPage the entire transaction is rolled back Therefore an INSERT UPDATE or any other update performed by the SQL statement in the MIERROR tag is also rolled back Using Tags in AppPages 6 41 ERR Attribute An MIERROR tag with the TAG MIVAR attribute assignment behaves like an MIVAR tag with no NAME attribute Use the TAG MIVAR attribute assignment to output an error message For example when the following MIERROR tag is invoked the text between the start and end tags is output lt MIERROR TAG MIVAR gt lt B gt Please contact your Web Administrator lt B gt lt BR gt lt MIERROR gt This is equivalent to executing the following MIVAR tag lt MIVAR gt lt B gt Please contact your Web Administrator lt B gt lt BR gt lt MIVAR gt ERR Attribute The ERR attribute links an MISQL MIVAR MIBLOCK or dynamic tag with an MIERROR tag to be invoked if an error occurs in the processing of that
62. locale supports U S English format conventions for date time and currency In addition this locale supports the ISO 8859 1 code set which includes the ASCII code set plus many 8 bit characters such as and If you plan to use nondefault characters in your data or your SQL identifiers or if you want to conform to the nondefault collation rules of character data you need to specify the appropriate nondefault locale Documentation Conventions This section describes the conventions that this manual uses These conven tions make it easier to gather information from this and other volumes in the documentation set The following conventions are discussed m Typographical conventions m Icon conventions m Screen illustration conventions IBM Informix Web DataBlade Module Application Developer s Guide Typographical Conventions Typographical Conventions This manual uses the following standard set of conventions to introduce new terms illustrate screen displays describe command syntax and so forth Convention Meaning KEYWORD All primary elements in a programming language statement keywords appear in uppercase letters in a serif font italics Within text new terms and emphasized words appear in italics italics Within syntax and code examples variable values that you are italics to specify appear in italics boldface Names of program entities such as classes events and tables boldface
63. loop lt MIBLOCK gt Although logically the previous MIBLOCK statement results in an infinite loop processing stops as soon as 100 loops have been executed and you receive an error in your AppPage Variable Mandatory Content MI_LOOP_MAX No Limits the number of loops executed when you use the FOR FOREACH and WHILE attributes of the MIBLOCK AppPage tag Limiting The Number Of Times an AppPage Can Call Itself Recursively Use the MI WEBEXPLODE_DEPTH variable to set the maximum number of times an AppPage can call itself recursively You recursively call an AppPage by explicitly executing the WebExplode function on the AppPage with the MISQL tag Use the Web DataBlade Module Administration Tool to set the MI_WEBEXPLODE_DEPTH variable for your Webdriver configuration Web DataBlade Module Variables C 29 Limiting The Number Of Times an AppPage Can Call Itself Recursively For example assume you invoke the following AppPage called recurse html passing it the name value pair DEPTH 10 lt MIVAR NAME DEPTH gt S SDEPTH 1 lt MIVAR gt lt MIVAR gt DEPTH SDEPTH lt MIVAR gt lt MISQL SOL select WebExplode object DEPTH SDEPTH from wbpages where id recurse and path and extension html gt 1 lt MISQL gt This AppPage calls itself recursively If the MI_WEBEXPLODE_DEPTH variable has not been set then the AppPage calls itself recursively until all database server resources have been u
64. lowercase letters Returns the remainder of valuel divided by value2 and thus returns 0 when value2 divides valuel exactly If string and string2 are not identical regardless of lettercase returns 1 otherwise returns 0 If string and string2 are not identical including lettercase returns 1 otherwise returns 0 Returns the logical negation of value 3 of 6 Function NTH which arg0 arg1 argN NXST varname OR val1 val2 valn PARSE HTML string POSITION string1 string2 valn Variable Processing Functions Returns Evaluates and returns the argument selected by which If which is 0 returns arg0 and so on Note the difference between NTH and INDEX NTH returns one of a series of arguments to the function while INDEX extracts a value from a comma delimited string passed as a single argument Does not evaluate arguments not selected by which If variable varname does not exist has not been assigned a numeric or string value returns 1 otherwise returns 0 Returns the logical OR of the integers val1 through valn Processing halts when a true condition is reached Used with server side includes The parameter string may be either DYNAMIC or SHARED For DYNAMI C use the Web DataBlade Module Adminis tration Tool to set the parse_html_directory variable to a path Tf string is SHARED the AppPage is used from cache For more information on server side inclu
65. project for easier management of the application The wbProjects table stores information about all existing projects The following CREATE TABLE statement describes the schema of the wbPre views table CREATE TABLE wbProjects name VARCHAR 30 description VARCHAR 254 owner VARCHAR 30 last_locked datetime year to second last_locked_by VARCHAR 30 last_deployed datetime year to second last_deployed_by VARCHAR 30 deployed_db VARCHAR 18 deployed_server VARCHAR 18 deployed_project VARCHAR 30 preview VARCHAR 30 PRIMARY KEY name CONSTRAINT wbProjectName FOREIGN KEY preview REFERENCES wbPreviews ID di B 10 IBM Informix Web DataBlade Module Application Developers Guide The wbResProjects Table The wbResProjects Table The wbResProjects table describes the many to many relationship between the projects stored in the wbProjects table and the objects in a Web appli cation AppPages stored in the wbPages table and binary objects stored in the wbBinaries table A project can include many AppPages and binary objects and a particular AppPage or binary object can be associated with many projects However each row in the wbResProjects table describes a single relationship For example assume the pages welcome html AppPage is used in two projects hr_project and sales_project Further assume that the hr_project project also contains a binary object images logo gif The wbResProjects
66. see a degra dation in performance if Webdriver is forced to URL encode every character before sending it to the WebExplode function You can specify the maxcharsize variable in the Global section of the web cnf file if you want to specify globally that characters should be URL encoded By adding the variable to a Webdriver configuration however you can control this behavior for a single Webdriver configuration and not for the whole database server 4 of 4 Web DataBlade Module Variables C 9 Using Server Side Includes in AppPages with the Apache or NSAPI Webdriver Using Server Side Includes in AppPages with the Apache or NSAPI Webdriver To use server side includes in your AppPages with the DYNAMIC option to the PARSE HTML variable processing function you must use the Web DataBlade Module Administration Tool to set the Webdriver variable described in the following table Webdriver Variable Mandatory Description parse_html_directory Yes Specifies the full pathname of the directory on the Web server computer where Webdriver temporarily stores the AppPage to be subsequently read by the Web server Webdriver does not create this directory so be sure the directory exists before you use server side includes in an AppPage C 10 IBM Informix Web DataBlade Module Application Developers Guide Variable auth_cache Resetting User Name Password Combinations Resetting User Name Password Combinations To reset u
67. the browser via Webdriver Using Advanced AppPage Tags 7 13 Examples of Using the MIEXEC Tag The following example shows how to send Perl code embedded in the MIEXEC tags to the SERVE pl Perl program lt MIVAR NAME SRVC gt cd local perlscripts usr local bin perl SERVE p1 lt MIVAR gt lt MIEXEC SERVICE SRVC REQUEST RAWPERL gt print This is Perl output In lt MIEXEC gt The above sample AppPage returns the following text to the browser This is Perl output In this example the REQUEST attribute of the MIEXEC tag specifies RAWPERL This tells the SERVE pl program to take the text between the MIEXEC tags and execute it as if it were a Perl program The following example also shows how to pass Perl code to the SERVE pl program along with two user defined attributes The example also shows how the Perl program can pass variables back to the AppPage lt MIVAR NAME SRVC gt cd local perlscripts usr local bin perl SERVE p1 lt MIVAR gt lt MIVAR NAME INVAR gt This was set via MIVAR lt MIVAR gt lt MIEXEC SERVICE SRVC REQUEST RAWPERL STRONE Hello STRIWO INVAR gt print uc Sattributes STRONE Sresults OUTVALUE length S attributes STRIWO lt MIEXEC gt lt MIVAR gt The length of SINVAR is SOUTVALUE lt MIVAR gt This sample AppPage returns the following text to the browser HELLO The length of SINVAR is 22 In the example the two user defined attribut
68. the possible trace settings for the debug_level Information Displayed Logs all pblocks NSAPI only pblocks contain the name value pairs passed from the Web browser to the Netscape Web server Logs callbacks including errors Logs Webdriver query requests to the database server such as calls to the WebExplode function or authorization requests Logs large object requests Logs AppPage headers Logs large object headers Logs client file upload information Logs information as AppPages are added and retrieved from the disk cache Logs request variables Logs information similar to the information logged by the NSAPI driver CGI only Logs connection pool information Logs session management information such as persistent variables being updated and new sessions being created Logs parameters sent to the WebExplode function in a decoded format Logs parameters sent to the WebExplode function in an encoded format Time stamps each request of Webdriver Logs callback messages IBM Informix Web DataBlade Module Application Developer s Guide The debug file Variable The trace value is additive therefore you can turn on multiple settings simultaneously The debug_file Variable When you enable tracing Webdriver writes the information to the trace file specified by the debug_file variable in the Global section of the web cnf file Tf the trace file does not exist Webdriver creates it If the trace file ex
69. value to 40 This continues until the WebExplode function retrieves all rows For an example of how to use WINSTART and WINSIZE to create a walking window see Example of a Walking Window on page 8 15 6 14 IBM Informix Web DataBlade Module Application Developer s Guide WINSIZE Attribute WINSIZE Attribute The WINSIZE attribute limits the maximum number of rows that are displayed in the output of the MISQL tag Use WINSIZE to limit the size of the result set being returned across the network if the queries you are executing might return a very large number of rows Setting this attribute limits the system resources required to execute the query and return the results to the client The following example limits the result set to 20 formatted rows lt MISQL WINSIZE 20 SQL select from staff gt lt BR gt lt MISQL gt Important If WINSIZE prevents all of the rows in the result set from being retrieved MI_ROWCOUNT is not updated For an example of how to use the WINSTART and WINSIZE attributes in an AppPage refer to Example of a Walking Window on page 8 15 RESULTS Attribute MISQL statements can be nested within one another when the RESULTS attribute is included in an MISQL statement The RESULTS attribute defines a location where the SQL result set for a variable is bound This location is also known as a namespace To access the results value use the column number wi
70. your Web server A dynamic tag you create to reuse existing HTML to simplify the construction and maintenance of Web applications See also dynamic tag system dynamic tag A routine written in one of the languages that IBM Informix Dynamic Server supports that provides added functionality for data types or encapsulates application logic Tag in an AppPage that directly executes an existing user defined routine and places the output of the execution of the routine within the AppPage An expression in an AppPage that starts with a character followed by a variable processing function and two or more variables within parentheses For example the variable expression 5NUMA NUMB adds the two vari ables NUMA and NUMB See also variable processing function An AppPage function used in a variable expression to evaluate or manipu late variables For example the variable processing function in the vari able expression 5NUMA SNUMB adds the two variables NUMA and NUMB See also variable expression A set of variables with the same name that are passed into the AppPage using check boxes or the MULTIPLE attribute of selection lists One of the multithreaded processes that make up the Informix database server and are similar to the hardware processors in the computer For exam ple in the Web DataBlade module you must add a WEB virtual processor to use the MIEXEC tag in an AppPage Two or more linked AppPages i
71. 2 A 12 uploading files in an HTML form 13 7 URL encoding characters C 3 C 9 use of term in guide 1 5 using RAW mode A 2 Webdriver variables accept_cookie 13 5 anchorvar C 2 auth_cache C 11 auth_crypt_udr C 13 cache_admin C 17 cache_admin_password C 18 cache_buckets C 20 cache_directory C 16 C 20 cache_maxsize C 20 cache_page C 16 cache_page_buckets C 16 cache_page_debug C 19 cache_page_life C 17 cache_page_timestamp C 18 config_name C 5 config_password C 3 config_security C 5 config_user C 3 connection life C 6 connection_wait C 6 connect_as_user C 7 connect_user_max C 7 database C 4 dbconnmax C 2 dbconntimeout C 3 debug_file C 2 C 20 debug_level C 2 C 20 driverdir C 2 error_page 5 17 C 14 C 23 extensions C 26 iis_nt_password C 13 iis_nt_user C 12 init_sql C 8 keepalive C 8 lo_error_sql C 15 lo_error_zerorows C 15 lo_query_params C 15 lo_query_string C 15 maxcharsize C 3 C 9 max_html_size C 9 Mlextension 3 11 MIpagelevel C 12 C 14 MIpath 3 11 MlIqry2pass 13 15 MItypeObj 3 16 Mlusergroup C 12 Mluserlevel C 12 Mlusername C 12 MIuserpasswd C 12 Mlusertable C 12 MI_RAWPASSWORD C 26 MI_USER_DBCONNMAX C 7 MI_USER_REMOTE C 7 MI_WEBACCEPTCKI C 24 MI_WEBACCESSLEVEL 5 8 C 14 MI_WEBAUTHCACHE C 11 MI_WEBCACHEADMIN C 17 MI_WEBCACHEDIR C 16 C 20 MI_WEBCACHEMAXLO C 20 MI_WEBCACHEPAGE C 16 MI_WEBCACHEPASSWORD C 18 MI_WEBCACHESUB C 20 MI_WEBDBCONNWAIT C 6 MI_WEBDRVLEVEL C 20 MI_WEBERRORPAGE C 14 C 2
72. 2 and earlier of the DataBlade module stores dynamic tags in the webTags table This guide is written with the assumption that you are using the latest version of AppPage Builder and that you are storing your dynamic tags in the wbTags table Important You cannot use AppPage Builder to edit or delete system dynamic tags Using Dynamic Tags in AppPages 9 17 Adding User Defined Dynamic Tags with AppPage Builder Adding User Defined Dynamic Tags with AppPage Builder Figure 9 4 shows the Add Dynamic Tag AppPage from AppPage Builder that you use to add user defined dynamic tags Web Browser APB Add Dynamic Tag Figure 9 4 APB Add Dynamic URL http domain port hr_app Mlval APB20 apb html Tag AppPage Builder 2 0 Add Dynamic Tag You can base this new tag on an existing tag to copy from the list below Base Tag OLD_DYNTAG y C CONTINUE Tag ID Class Project getting_started w Parameters Description Dynamic Tag User Name Default Project TEXTAREA Width Versioning default getting_started 80 Off User Level Default Object TEXTAREA Height WebLint Checking 0 AppPage 20 Off 9 18 IBM Informix Web DataBlade Module Application Developer s Guide Example of Creating a User Defined Dynamic Tag When you enter parameters in the Parameters text box separate multiple parameters by specifying an ampersand amp
73. 3 MI_WEBEXTENSIONS C 26 MI_WEBGROUPLEVEL 5 8 MI_WEBINITIALSQL C 8 Index 7 ABCODEFGAHA MI_WEBKEEPALIVE C 8 MI_WEBLOPARAMS C 15 MI_WEBLOQUERY C 15 MI_WEBLOSQLERROR C 15 MI_WEBLOZEROROWS C 15 MI_WEBMAXHTMLSIZE C 9 MI_WEBNTPASSWORD C 13 MI_WEBNTUSER C 12 MI_WEBPAGELIFE C 17 MI_WEBORYTIMEOUT C 7 MI_WEBRECONNECT C 6 MI_WEBREDIRECT C 13 C 14 C 23 MI_WEBSCHEMADEF C 27 MI_WEBSESSION C 21 MI_WEBSESSIONHOME C 21 MI_WEBSESSIONLIFE C 22 MI_WEBSESSIONLOC C 22 MI_WEBSESSIONSUB C 22 MI_WEBSHOWEXCEPTIONS C 23 C 24 MI_WEBUPLOADDIR C 25 parse_html_directory C 10 password C 4 query_timeout C 7 redirect_url 5 17 C 13 C 14 C 23 schema_version C 27 server C 5 show_exceptions 5 17 C 23 user C 4 WebExplode function 6 44 12 4 description of 1 4 1 5 server function 12 4 URL encoding characters C 3 C 9 Web server variables available to 5 8 WebExplode tracing A 6 WebExplode variables MI_LOOP_MAX C 29 MI_WEBEXPLODE_DEPTH C 29 WebHtmlToBuf function 14 5 WebLint function 4 9 12 8 WebRelease function 12 11 WebResultsCacheSize value 6 20 WebUnHTML function 12 12 See also WEBUNHTML variable processing function JK L MN OP QRS TU VW X Y Z WEBUNHTML variable processing function 8 9 See also WebUnHTML function WebURLDecode function 12 14 See also URLDECODE variable processing function WebURLEncode function 12 15 See also URLENCODE variable processing function WEB_HOME anchor variable C 2 WHILE att
74. 5 17 6 47 C 23 C 24 system 6 7 to 6 14 Web DataBlade module 5 3 A BC DEFGH where interpreted 5 3 where set 5 3 See also Webdriver variables W Walking window 8 15 Warning icons Intro 9 wbBinaries table 3 8 3 9 3 15 wbExtensions table 3 5 3 6 3 8 6 23 C 26 wbInfo table 6 20 wbPages table 3 5 Web browser variables REMOTE_USER C 7 Web DataBlade module architecture of 1 4 1 6 components of 1 4 description of 1 3 dynamic tags 1 9 features of 1 9 tags 1 5 Web DataBlade Module Administration Tool description of 1 10 securing C 3 setting Web server variables with 5 10 user allowed to use C 3 Web server environment variable 5 9 Web server variables accessing in an AppPage 5 9 AUTH_TYPE 5 8 HTTP_HOST 5 8 HTTP_REFERER 5 8 HTTP_URI 5 8 HTTP_USER_AGENT 5 8 QUERY_STRING 5 8 REMOTE_ADDR 5 8 REMOTE_USER 5 8 REQUEST_METHOD 5 8 SERVER_PROTOCOL 5 8 setting with Web DataBlade Module Administration Tool 5 10 WebBufToHtml function 14 8 JK L MN OP QRS TU VW X Y ze WebClearResultsCache routine 6 19 webconfig utility adding config_user Webdriver variable with C 3 WebConfigs system table C 5 Webdriver adding HTTP headers 13 3 coordinating interaction with Web server C 2 database connected to C 4 debugging A 2 A 12 C 2 C 20 description of 1 4 1 10 error handling 6 46 implementations of 1 4 interactively running A 2 A 12 passing image map coordinates 13 12 tracing errors with C 2 troubleshooting A
75. 7 in Web DataBlade module tags 6 51 Downgrading to a 9 2x server 1 9 driverdir Webdriver variable C 2 Dynamic tags 9 3 definition of 9 3 system 9 8 user defined 9 17 where stored 9 5 E EC variable processing function 8 5 Encrypting passwords C 13 ENCTYPE attribute of FORM tag 13 7 Enterprise replication ER 1 8 Entity reference for 6 51 for 9 21 Environment variables Intro 7 INFORMIXSERVER C 5 en_us 8859 1 locale Intro 6 EQ variable processing function 8 5 ERR attribute of MIBLOCK tag 6 30 of MIERROR tag 6 42 of MISQL tag 6 5 of MIVAR tag 6 27 Error handling MI_DRIVER_ERROR 5 17 MI_ERRORCODE variable 6 11 6 41 MI_ERRORMSG variable 6 11 6 41 MI_ERRORSTATE variable 6 11 6 41 using ERR attribute 6 42 using generic error handler 6 43 using Webdriver 6 46 error_page Webdriver variable 5 17 C 14 C 23 Extension adding with APB 3 8 4 10 A BC DEFGH extensions Webdriver variable C 26 F File upload 13 7 Client file upload 4 3 FileToHTML function 12 17 FIX variable processing function 8 5 FOREACH attribute of MIBLOCK tag 6 30 FORM tag linking AppPages 3 12 uploading files in an HTML form 13 7 Formatting characters in Web DataBlade module tags 6 52 FROM attribute of MIBLOCK tag 6 30 FUNCTION attribute of MIFUNC tag 7 4 Functions API 14 3 arithmetic 8 3 8 10 FileToHTML 12 17 server 12 3 string 8 3 variable processing 8 3 WebExplode 1 4 5 8 C 3 C 9 WebLint 12 8 WebReleas
76. 8 6 lo_error_sql Webdriver variable C 15 lo_error_zerorows Webdriver variable C 15 lo_query_params Webdriver variable C 15 lo_query_string Webdriver variable C 15 M maxcharsize Webdriver variable C 3 C 9 max_html_size Webdriver variable C 9 MIBLOCK tag 6 29 limiting looping C 29 loop processing 6 32 MICOMMENT tag 6 49 MIDEFERRED AppPage tag C 19 MIDEFERRED tag defer prefix 7 7 enable page caching with 5 9 partial page caching 7 7 Index 3 ABCODEFGAHA MIELSE tag 6 38 MIERROR tag 6 40 to 6 48 MIEXEC tag ERR attribute 7 10 NAME attribute 7 9 Perl program 7 9 SERVICE attribute 7 9 7 10 user defined attribute 7 10 Mlextension Webdriver variable 3 11 MIFUNC tag 7 3 MImap variable 13 12 C 25 MIME types 13 3 MIpagelevel Webdriver variable C 12 C 14 MIpath Webdriver variable 3 11 MIqry2pass Webdriver variable 13 15 MISOL tag 1 5 6 5 to 6 15 formatting the SQL results 6 7 to 6 14 MItypeObj Webdriver variable 3 16 Mlusergroup Webdriver variable C 12 Mluserlevel Webdriver variable C 12 Mlusername Webdriver variable C 12 Mluserpasswd Webdriver variable C 12 Mlusertable Webdriver variable C 12 MIVAR tag 6 27 to 6 28 MIWEBTAGSSQL 9 7 C 28 MI_COLUMNCOUNT variable 6 11 6 16 MI_CURRENTROW variable 6 11 6 16 MI_ERRORCODE variable 6 11 6 41 ML ERRORMSG variable 6 11 6 41 MI_ERRORSTATE variable 6 11 6 41 MI_LOOP_MAX WebExplode variable C 29 MI_NOVALUE variable 6 13 MI_NULL variable 6 13
77. Application Developer s Guide DATASET Attribute The nested MISQL statement might look like this lt MISOL SOL select item cost from TABLE2 RESULTS tab2 gt lt MISOL SOL select name money from TABLE1 RESULTS tabl1 gt Stab2 1 tab2 2 tabl 1 tab1 2 lt MISQL gt next iteration lt MISQL gt The results of this MISOL statement are as follows Food 4 Joe 10 Food 4 Mary 11 eee Next ateration Art 5 Joe 10 Art 5 Mary 11 e next iteration DATASET Attribute The DATASET attribute indicates how many rows can be retrieved per iteration through the body of an MISQL tag The following example shows the DATASET attribute indicating that two rows are fetched lt HTML gt lt HEAD gt lt TITLE gt Simple Select 2 lt TITLE gt lt HEAD gt lt BODY gt lt TABLE BORDER gt lt MISQL SQL Select first_name last_name from staff DATASET 2 gt lt TR gt lt TD gt 1 2 lt TD gt lt TD gt 1 2 2 2 lt TD gt lt TR gt lt MISQL gt lt TABLE gt lt BODY gt lt HTML gt Using Tags in AppPages 6 17 CACHERESULTS Attribute CACHERESULTS Attribute You use the CACHERESULTS attribute to cache the results of a call to an SOL statement within an MISOL AppPage tag For example assume that your Web DataBlade module application executes a query against a small static database table many times The results from this query never change thus caching by using the CACHERESULTS
78. Architecture Diagram 3 Webdriver refers to the web cnf file on the operating system for information on how to connect to an Informix database server the database to which to connect the user to connect to the database as and the Webdriver configuration to use once a connection has been made to the database Webdriver establishes a connection to the appropriate database with this information 4 Once Webdriver has established a connection to a database it looks up the Webdriver configuration in the WebConfigs system table The Webdriver configuration describes among other things the AppPage table that contains the AppPage the user requested in the URL originally entered in the browser 5 Using this schema related information Webdriver builds a SELECT statement to retrieve the requested AppPage from the Web appli cation table The SELECT statement executes the WebExplode function on the AppPage at the same time that it retrieves the AppPage The WebExplode function expands the AppPage tags within the AppPage and formats the results resulting in a standard HTML page 6 Finally Webdriver returns this HTML page to the Web server which in turn returns the HTML page to be rendered by the Web browser Webdriver also enables you to retrieve large objects such as images directly from the database when you specify a path that identifies a large object stored in the database Overview 1 7 Enterprise Replication Enterprise Re
79. BM for the purposes of developing using marketing or distributing application programs conforming to IBM s application programming interfaces Notices D 3 Trademarks Each copy or any portion of these sample programs or any derivative work must include a copyright notice as follows O your company name year Portions of this code are derived from IBM Corp Sample Programs O Copyright IBM Corp enter the year or years All rights reserved If you are viewing this information softcopy the photographs and color illus trations may not appear Trademarks AIX DB2 DB2 Universal Database Distributed Relational Database Architecture NUMA Q OS 2 OS 390 and OS 400 IBM Informix C ISAM Foundation 2000 IBM Informix 4GL IBM Informix DataBlade Module Client SDK Cloudscape Cloudsync IBM Informix Connect IBM Informix Driver for JDBC Dynamic Connect IBM Informix Dynamic Scalable Architecture DSA IBM Informix Dynamic Server IBM Informix Enterprise Gateway Manager Enterprise Gateway Manager IBM Informix Extended Parallel Server i Financial Services J Foundation MaxConnect Object Translator Red Brick Decision Server IBM Informix SE IBM Informix SOL InformiXML RedBack SystemBuilder U2 UniData UniVerse9 wintegrate are trademarks or registered trademarks of International Business Machines Corporation Java and all Java bas
80. CGI program For example if you configured your Web server to have a CGI direc tory cgi and the Webdriver CGI program resides in that directory then set SCRIPT_NAME to cgi webdriver setenv SCRIPT_NAME cgi webdriver QUERY_STRING should include the setting for the MIval Webdriver variable and any other variables you would normally set in the URL when you invoke the AppPage setenv QUERY_STRING MIval mypage A 12 IBM Informix Web DataBlade Module Application Developer s Guide Running CGI Webdriver Interactively Invoke Webdriver webdriver The output is similar to the following example Content type text html Content length 3703 lt HTML gt Webdriver generates an appropriate error message if the AppPage cannot be retrieved The following example specifies the name of an AppPage that does not exist setenv MIval wrong Webdriver prints an error within the following output webdriver Content type text html Content length 225 lt HTML gt lt HEAD gt lt TITLE gt Error Message lt TITLE gt lt HEAD gt lt BODY gt lt H2 gt HTTP 1 0 404 Not Found lt H2 gt lt B gt Error from Informix lt B gt lt HR gt The resource you requested was not found lt P gt Zero rows were returned from the server lt BODY gt lt HTML gt Debugging Web DataBlade Module Applications A 13 AppPage Builder Schema AppPage Builder APB provides a flexible and extensible base for developing Web applications with the Web
81. Chapter What Is the Web DataBlade Module Product Architecture Webdriver The WebExplode Funetion Tags and Attributes Architecture Diagram Enterprise Replication Converting from a 9 2x Server Reverting to a 9 2x Server Product Features Before You Begin OND DUTT KRW Q a e WN OO o 1 3 1 3 1 4 1 4 1 5 1 5 1 6 1 8 1 8 1 9 1 11 Chapter 2 Web DataBlade Module Tutorial This Chapter ata E A Gi ae a 2 3 Overview of the Process aot ss ATA cede oh ee A 2 3 Creating an Application with APB pa rs a ote A od 2 4 Step 1 Add a Project Mg Goch A 2 4 Step 2 Create User Defined Dynamic Tass 4 nd bee Rnd 2 5 Step 3 Create the First AppPage of Your App atao eA tee sie ee 2 8 Step 4 Create the Second AppPage of Your Application 2 11 Step 5 Create the Third AppPage of Your pe x a 2213 Step 6 Invoke the Application oo ks ae Bee 2l Chapter 3 Basics of AppPage Development In This Chapt tes aa Ge an eae Gow Seat A e 3 3 AppPage Elements a LL o A Ge 3 4 Where AppPage Objects Are Stored Ge fade a aiy ae Ss 3 5 The wbExtensions Table ee git ay Ts 3 5 Adding a New Extension to the WUBiHadies Table a a o 3 8 How to Invoke AppPages wo we et a he Bo os 3 9 Using MIpath and MIextension m TA GN o ie OL How to Link AppPages dg Hog Gow ap COIL Linking AppPages with the ANCHOR Tag ey ad te te wt 212 Linking AppPages with the FORM Tag 3 12 Exampl
82. Craig Wallace Gonzo Babbage marketing arah Dun Kermit French Beth Hume sales Wilma Jones Simon Smith Simon Smith _ MN gt 8 14 IBM Informix Web DataBlade Module Application Developer s Guide Figure 8 3 Conditional Output Using Variable Expressions to Format Output Conditionally Example of a Walking Window A walking window shows only a portion of total responses For example a query might return 100 rows but you want only 20 at a time to appear in your Web browser In this case you would have five windows and can walk forward and backwards through these five windows The following winstart html AppPage uses variable processing functions to format output conditionally lt HTML gt lt HEAD gt lt TITLE gt WINSTART lt TITLE gt lt HEAD gt lt BODY gt lt Initialization gt lt MIVAR NAME WINSIZE DEFAULT 4 gt SWINSIZE lt MIVAR gt lt MIVAR NAME BEGIN DEFAULT 1 gt START lt MIVAR gt lt Definition of Ranges gt lt MIVAR NAME BEGIN gt S IF lt SBEGIN 1 1 SBEGIN lt MIVAR gt lt MIVAR NAME END gt SBEGIN SWINSIZE lt MIVAR gt lt Execution gt lt TABLE BORDER gt lt MISOL WINSTART SBEGIN WINSIZE SWINSIZE SQL select tabname from systables where tabname like wb order by tabname gt lt TR gt lt TD gt 1 lt TD gt lt TR gt lt MISQL gt lt TABLE gt lt BR g
83. D gt lt TITLE gt Count Rows lt TITLE gt lt HEAD gt lt BODY gt lt count the number of rows in the table gt lt specified call the error_handler page gt lt if an error occurs on this page gt lt MIERROR TAG MISQL SQL select WebExplode object from wbPages where ID error_handler and path and extension html gt 1 lt MIERROR gt lt MISQL SOL select count from STABLE gt lt BR gt lt B gt Number of rows in table STABLE lt B gt S FIX 1 lt BR gt lt MISQL gt lt BODY gt lt HTML gt If an error occurs in the count_rows html AppPage the WebExplode function invokes the preceding MIERROR tag and the error_handler AppPage is executed The error_handler html AppPage evaluates the error code lt HTML gt lt HEAD gt lt TITLE gt Error Processing Page lt TITLE gt lt HEAD gt lt BODY gt lt MIVAR NAME done gt NO lt MIVAR gt lt MIBLOCK COND EQ MI_ERRORCODE 206 gt We regret to inform you that table lt MIVAR gt STABLE lt MIVAR gt does not exist lt MIVAR NAME done gt YES lt MIVAR gt lt MIBLOCK gt lt MIBLOCK COND EQ MI_ERRORCODE 201 gt You entered one or more blank spaces as a table name Please go back and enter a table name lt MIVAR NAME done gt YES lt MIVAR gt lt MIBLOCK gt lt MIBLOCK COND AND EQ MI_ERRORCODE 937 EQ MI_ERRORSTATE UWEB1 gt You have not specified a table Pl
84. For more information see Enabling WebExplode Tracing on page A 6 Removes leading and trailing blank spaces from string Returns the numeric value truncated to no more than digit number of digits Unsets the variable varname No error is generated if varname is not set Returns string converted to uppercase letters 5 of 6 Variable Processing Functions Function Returns URLDECODE string Returns string with all hexadecimal values replaced with their nonalphanu meric ASCII characters For a description of this functionality implemented as a server function see WebURLDecode on page 12 14 URLENCODE string Returns string with all nonalphabetic ASCII characters replaced with their hexadecimal values For a description of this functionality implemented as a server function see WebURLEncode on page 12 15 VECSIZE vec Returns the number of elements in a vector VECAPPEND vec value Appends a value to the end of the vector WEBUNHTML string Returns string with special HTML characters replaced with their entity reference for display by a Web browser For a description of this functionality implemented as a server function see WebUnHTML on page 12 12 XOR val1 val2 valn Returns the logical XOR of the integers vall through valn XST varname If variable varname exists has been assigned a numeric or string value returns 1 otherwise returns 0 6 of 6
85. HTML data type and its uses and how to generate XML formatted data It includes the following topics m The HTML Data Type following m Functions That Use or Return the HTML Data Type on page 11 4 m Example of Using an HTML Data Type on page 11 5 The HTML Data Type Use the HTML data type to store AppPages in an Informix database HTML is a multirepresentational data type This means that the way the data is internally stored varies depending on the size of the data If the HTML object is smaller than 7500 bytes the data type is internally stored in the row similar to how a VARCHAR data type is stored If the HTML object is larger than 7500 bytes the database server creates a smart large object to store the portion of the HTML object that is greater than 7500 bytes Because at least a portion of an HTML data type data is stored in a row you cannot use smart large object functions of the DataBlade API against the HTML object See The Web DataBlade Module API Functions on page 14 3 for detailed information on how to manipulate an HTML object Important The implementation of this feature is transparent to the user The Web DataBlade module determines internally whether a particular HTML object is stored entirely in the row or extended into a smart large object and it only retrieves the contents of the smart large object when necessary Using the HTML DataType 11 3 Functions That Use or Return the HTML Data Ty
86. I and Apache implementations of Webdriver init_sql MI_WEBINITIALSOL No C 8 IBM Informix Web DataBlade Module Application Developers Guide Specifies that Webdriver send initial SQL statements to the database server when Webdriver makes a connection to the database Set this Webdriver variable to one or more SQL statements separated by semicolons and terminated by a carriage return Do not include quotes For example if you want to set the isolation level of the connection to the database to Dirty Read set the init_sql Webdriver variable to the value SET ISOLATION TO DIRTY READ 3 of 4 Webdriver Variable Managing Webdriver Connections to the Database Name of Variable in Versions 3 3 and Previous Mandatory Description max_html_size MI_WEBMAXHTMLSIZE No Specifies the largest AppPage in bytes that Webdriver sends to the browser AppPages larger than this size are not sent to the browser The default value for this Webdriver variable is 128 KB The maximum value is 222 KB maxcharsize New in Version 4 0 No When set to a value greater than 1 each character sent to the WebExplode function is URL encoded If this variable is not set Webdriver URL encodes only special characters such as amp before sending it to the WebExplode function Informix recommends you set this variable to a value greater than 1 only if you are using a multibyte character set This is because you might
87. L lt B gt function lt BR gt lt BR gt Otherwise the tag will be interpreted and a horizontal rule The following figure shows sample Web browser output WebUnHTML The following unhtml html AppPage uses the WebUnHTMLO function to lt HTML gt lt HEAD gt lt TITLE gt WebUnHTML Example lt TITLE gt lt HEAD gt lt BODY gt To display the horizontal rule HTML tag lt BR gt lt MISOL SOL execute function WebUnHTML lt HR gt gt 1 lt MISQL gt lt BR gt Figure 12 4 WebUnHTML Using DataBlade Module Functions in AppPages 12 13 WebURLDecode WebURLDecode The WebURLDecode function replaces hexadecimal values with nonalpha numeric ASCII characters and replaces plus signs with spaces Syntax WebURLDecode HTML returns HTML Arguments The argument is HTML Example Since the WebExplode function decodes information passed in URLs you do not normally need to decode the URL yourself 12 14 IBM Informix Web DataBlade Module Application Developer s Guide WebURLEncode WebURLEncode The WebURLEncode function replaces nonalphabetic ASCII characters with hexadecimal values and replaces spaces with plus signs Syntax WebURLEncode HTML returns HTML Arguments The argument is HTML Example The following encode AppPage uses the WebURLEncode function to encode job titles which may contain spaces for use in URLs
88. MB is lt B gt SNUMA SNUMB lt MIVAR gt lt BODY gt lt HTML gt The WebExplode function returns the following output to the client lt B gt The sum of 10 and 20 is lt B gt 30 The following figure shows sample Web browser output Web Browser Adding Two Variables Figure 8 1 lt A gt 8 10 IBM Informix Web DataBlade Module Application Developer s Guide Adding Two URL http domain port hr_app Mlval varexp1 html Variables a The sum of 10 and 20 is 30 Vv Using SEPARATE and REPLACE in Variable Expressions Using SEPARATE and REPLACE in Variable Expressions Use the SEPARATE variable processing function to separate elements in a vector variable A vector variable consists of multiple variables with the same name passed into the AppPage using check boxes or the MULTIPLE attribute of selection lists Use the REPLACE variable processing function to specify a string to be replaced within text For example you must replace single quotes with two single quotes so that single quotes can be inserted into the database If this replacement is not made and the text being inserted into the database contains single quotes the INSERT statement is not built correctly Example of SEPARATE and REPLACE The following table_prog html AppPage uses both the SEPARATE and REPLACE variable processing functions lt HTML gt lt HEAD gt lt TITLE gt Select from Table lt TITLE g
89. MIBLOCK tag can also be used for loop processing Later sections within this MIBLOCK explanation describe how to use loop processing with the MIBLOCK tag Important You can nest MIBLOCK tags within MIBLOCK tags and MISQL tags within MISQL tags Variables are interpreted only within MISQL MIVAR MIELSE and MIERROR tags and within the COND attribute of the MIELSE or MIBLOCK tag Using Tags in AppPages 6 29 MIBLOCK Tag 6 30 Attribute COND ERR INDEX FROM TO STEP FOREACH WHILE Dependency None None FROM and FOREACH FOR FOR None None None The following table lists the MIBLOCK tag attributes Description The MIBLOCK tag is enabled only if this condition is true nonzero Specifies how an error should be processed Because multiple errors can occur on an AppPage use the ERR attribute to link the error processing to a particular MIERROR tag Used as a loop counter Required if either the FROM or the FOREACH attribute is specified Specifies the initial value of the INDEX attribute in a FOR loop Specifies the maximum value of the INDEX attribute value Specifies the increment or decrement of the INDEX attribute The default is 1 Used in the FOREACH loop to specify that a variable that can be but is not necessarily a vector variable A vector variable consists of multiple variables with the same name passed into the AppPage using check boxes or the MULTIPLE attri
90. ML gt lt MIVAR NAME in gt Hello World lt MIVAR gt lt MISOL SQL execute function webupper Sin gt 1 lt MISQL gt lt HTML gt A more efficient way of executing the webupper UDR in an AppPage however is to invoke it directly with a UDR tag as shown in the following example lt HTML gt lt MIVAR NAME in gt Hello World lt MIVAR gt lt webupper NAME out text in gt lt MIVAR gt Sout lt MIVAR gt lt HTML gt In the example lt webupper NAME out text in gt is the UDR tag The NAME out attribute of the UDR tag specifies that the WebExplode function should place the output of the UDR tag ina variable called out The text in attribute specifies the single parameter to the webupper UDR This guide does not explain how to create UDRs For a complete discussion of creating a UDR and registering a UDR in the database refer to Creating User Defined Routines and User Defined Data Types Where Are UDR Tags Stored UDR tags are stored in the WebUdrs system table You create UDR tags with AppPage Builder as described in Creating a UDR Tag on page 10 8 The WebUdrs system table does not store the UDR itself Instead it stores a reference to an existing UDR in the sysprocedures table This means that before you create a UDR tag you must be sure that the corresponding UDR referenced by the UDR tag already exists 10 4 IBM Informix Web DataBlade Module Application Developer s Guid
91. Mlusername Same Yes Name of the VARCHAR column in the user access table MIusertable that contains the name of the database user Mluserpasswd Same Yes Name of the VARCHAR column of the user access table MIusertable that contains the password of the database user Mluserlevel Same Yes Name of the INTEGER column of the user access table MIusertable that contains the access level of the database user MIpagelevel Same Yes Name of the INTEGER column of the table that stores your AppPage that contains the access level of the AppPage Mlusergroup Same Name of the INTEGER column of the user access table MIusertable that contains the group access level of the user iis_nt_user C 12 IBM Informix Web DataBlade Module Application Developers Guide MI_WEBNTUSER Yes ISAPI Webdriver only Name of a valid Windows NT user 1 of 2 Enabling NSAPI ISAPI and Apache Security Name of Variable in Variable Name Versions 3 3 and Previous Mandatory Content iis_nt_password MI_WEBNTPASSWORD Yes ISAPI Webdriver only Password of a valid Windows NT user redirect_url MI_WEBREDIRECT No URL to redirect users to if they do not have access to the AppPage they attempt to retrieve auth_crypt_udr New in Version 4 0 No Enables password encryption when set to ON If password encryption is enabled Webdriver encrypts the password entered by the user and compares it to t
92. Module Application Developer s Guide Using Cookies accept_cookie Webdriver Variable Use the accept_cookie Webdriver variable if you use AppPage caching and other applications in the same domain that are not used by your Web DataBlade module application Variable Mandatory Description accept_cookie No Use the Web DataBlade Module Administration Tool to set the accept_cookie Webdriver variable to the name of cookies that your Web DataBlade module application uses All other cookies are ignored by Webdriver Multiple cookie names are separated by commas If you do not use this variable Webdriver assumes all cookies in the browser are part of the Web application Converting Cookies into Web DataBlade Module Variables When a cookie is set for a Web browser the cookie is passed back to the Web server for each request made by that same Web browser The Web DataBlade module automatically takes any cookies it receives and converts them into Web DataBlade module variables The Web server environment variable HTTP_COOKIE is detected by Webdriver and parsed into variables so that the HTTP_COOKIE variable is never seen in an AppPage Using Other Webdriver Features 13 5 Using Cookies The following cookie AppPage determines whether or not the Web browser has retrieved this AppPage previously The first time the Web browser retrieves the cookie AppPage the AppPage sends a cookie to the Web browser which the Web browser keeps even if it
93. Notice the following features in the page2 html AppPage m The MISOL tag inside a table For every table returned by the SOL statement an anchor tag is created lt MISOL SOL select tabname owner tabtype from systables where tabname not like sys and tabtype IN T v P S order by tabname gt For more information on using the MISQL tag refer to MISQL Tag on page 6 5 IBM Informix Web DataBlade Module Application Developer s Guide Step 5 Create the Third AppPage of Your Application The MIVAR tag with a variable processing function to convert a returned T into Table lt MIVAR COND EQ 3 T gt Table lt MIVAR gt lt MIVAR COND EQ 3 V gt View lt MIVAR gt lt MIVAR COND EQ 3 S gt Synonym lt MIVAR gt lt MIVAR COND EQ 3 P gt Private Synonym lt MIVAR gt For more information on using the MIVAR tag refer to MIVAR Tag on page 6 27 For more information on using variable processing functions refer to Using Variable Processing Functions in AppPages on page 8 1 When you call the page3 html AppPage you are passing the table user defined variable lt td gt lt a href SWEB_HOME MIval page3 html table 1 gt 1 lt a gt lt td gt lt td gt 2 lt td gt lt td gt Step 5 Create the Third AppPage of Your Application The third AppPage of your application is linked to the first page by the FORM tag and to the second page by th
94. PUT TYPE RESET VALUE Reset gt lt FORM gt lt HR gt lt MIVAR COND XST action gt SQL executed lt I gt S sql_statement2 lt 1I gt lt MIVAR gt lt P gt lt MIVAR COND XST action gt SQL executed lt I gt S sql_statement1 lt 1I gt lt MIVAR gt lt P gt lt BODY gt lt HTML gt 9 16 IBM Informix Web DataBlade Module Application Developer s Guide Creating User Defined Dynamic Tags The following figure is sample Web browser output Web Browser SELECTLIST Example Figure 9 3 URL http domain port hr_app M lval selectlist html SELECTLIST Browser Output Employees that work onsite Control click names to toggle on and off Then choose Submit Submit Reset SQL executed update employees set onsite f where first_name not in Betty SQL executed update employees set onsite t where first_name in Betty Y A gt Creating User Defined Dynamic Tags Use AppPage Builder to add edit and delete user defined dynamic tags Once you have created a user defined dynamic tag you can specify it in any AppPage as described in Specifying Dynamic Tags in AppPages on page 9 4 The AppPage Builder application provided in Version 4 0 and later of the Web DataBlade module stores dynamic tags in the wbTags table The AppPage Builder application provided in Version 3 3
95. Page a generic error handler returns a message to the user if the TEST_VAR variable is unassigned lt HTML gt lt HEAD gt lt TITLE gt Error Processing Page lt TITLE gt lt HEAD gt lt BODY gt lt MIERROR TAG MIVAR gt lt HTML gt lt HEAD gt lt TITLE gt Process Errors lt TITLE gt lt HEAD gt lt BODY gt lt B gt Unable to proceed lt B gt lt HR gt lt BODY gt lt HIML gt lt MIERROR gt The value of SSTEST_VAR is lt MIVAR gt S TEST_VAR lt MIVAR gt lt BODY gt lt HTML gt Tip Only HTML within the MIERROR tag is returned to the client IBM Informix Web DataBlade Module Application Developer s Guide Processing Errors with Webdriver The following illustration shows sample Web browser output Web Browser Process Errors Figure 6 11 http domain port hr_app Mlval catch_error html MIERROR Tag Output Unable to proceed Variable Mandatory If no MIERROR tag exists to handle the error that occurs Webdriver output depends on the setting of the show_exceptions variable Content show_exceptions No lt HTML gt lt BODY gt The value of STEST_VAR is lt BODY gt lt HTML gt Use the Web DataBlade Module Administration Tool to set the show_exceptions variable to on or off When on Webdriver displays the database exception returned by WebExplode When off Webdriver displays the HTTP 1 0 500 Server error message Default is off If you set the show_
96. QL statement executed in the MISQL tag 6 6 IBM Informix Web DataBlade Module Application Developers Guide Using System Variables to Format the SQL Results Using System Variables to Format the SQL Results For each row the SOL statement returns the output is formatted according to the specifications between the start and end MISQL tags The following sections describe the system variables you can use to format SOL output m Specifying Column and Row Formatting Information following m Displaying Processing Information on page 6 11 m Specifying Replacement Values for NULL or No Value Columns on page 6 13 Specifying Column and Row Formatting Information To specify a column variable use the format where is a column number from 1 up to the maximum number of columns in the row column variables are 1 for the first column 2 for the second column and so on To specify all the columns use an asterisk as described later in this section Important Ifyou execute the XST and NXST variable processing functions on column variables the functions return 0 and 1 respectively Although these values seem to indicate that the column variables do not exist they do in fact exist This behavior of the XST and NXST variable processing functions is only true for column variables when used on all other types of Web DataBlade module variables the functions behave as expected The following s
97. R gt lt TABLE gt lt BODY gt lt HTML gt The following illustration shows sample Web browser output Figure 6 3 Web Browser Simple Select 3 Simple Select 3 imple Selec http domain port hr_app M lval select3 html Somebody Senior Consultant Average Consultant Markup Software Development Engineer 6 10 IBM Informix Web DataBlade Module Application Developer s Guide Variable Using System Variables to Format the SQL Results Displaying Processing Information The following table lists additional system variables set by the database server when The WebExplode function executes an SQL statement within the MISQL tag You can use these processing variables to display more infor mation about the results of the SOL statement When Set MI_COLUMNCOUNT On execution MI_CURRENTROW MI_ERRORCODE MI_ERRORSTATE MI_ERRORMSG MI_ROWCOUNT MILSOL On current row On error On error On error After execution On execution Description Number of columns retrieved in the SOL statement Current formatted row being displayed during execution of the SOL statement Set to the number of formatted rows displayed after the MISQL tag has been executed Error code returned from the SQL statement All WebExplode errors return an error code of 937 For explanations of error codes see IBM Informix Error Messages For more information on han
98. RAW mode to get more information about your Webdriver environment o Use the WebLint function to find syntax errors within AppPage tags m To obtain more information when an error occurs a Enable Web DataBlade module tracing a Check the appropriate log files m To determine which component of your installation is failing retrieve your AppPage directly by running CGI Webdriver interactively bypassing your Web browser and Web server The following sections describe these techniques Using RAW Mode with Webdriver A 2 Using RAW Mode with Webdriver Webdriver allows you to enable RAW mode to help develop and debug Web applications When you enable RAW mode you can m Display the AppPage as stored in the database without expanding the AppPage tags m Display variables and identify where variable assignments are made To enable RAW mode set the following Webdriver configuration file variable using the Web DataBlade Module Administration Tool Variable Mandatory Content raw_password Yes Password to enable RAW mode You can retrieve the unexpanded AppPage by specifying RAW value_of_raw_passwordin a URL Webdriver returns the unexpanded AppPage as stored in the database including the AppPage tags RAW mode also displays all variables and where they were assigned The following URL retrieves the testit html AppPage in RAW mode http myhost port hr_app MIval testit htmlsRAW topsecret In the example
99. SQL statements within an AppPage as a single transaction block Syntax The WebExplode function has the following signature WebExplode HTML HTML returns HTML The following table describes the arguments to the WebExplode function Argument Data Type Description HTML HTML The first HTML argument is an AppPage HTML HTML The second HTML argument specifies any variables passed to the WebExplode function by calling application as name value pairs for example namel valuel amp name2 value2 Important When you call the WebExplode function all variable assignments are inherited from the parent process usually Webdriver Variables are global in scope Therefore if you override the assignment of a variable in the second argument of your call to the WebExplode function or within the AppPage you execute that variable assignment is retained until you reassign it elsewhere 12 4 IBM Informix Web DataBlade Module Application Developer s Guide WebExplode Example The following procedure illustrates the use of the WebExplode function To create an AppPage table and retrieve data dynamically using the WebExplode function 1 Create the web_apps table to store AppPages create table web_apps app_id varchar 40 NOT NULL app_desc varchar 64 app_frm html primary key app_id i 2 Create the employees table to store employee data create table employees
100. SQL variable This means that if you have both variables set in your Webdriver configuration the WebExplode function searches for the dynamic tag in the table specified by the MI_WEBTAGSTABLE variable MI_WEBTAGSCACHE No Specifies whether the WebExplode function should cache dynamic tags or not This variable should be set to on to turn on caching or off to turn off caching The default value is on Turn off dynamic tag caching when you are developing your AppPages to ensure that you always see the latest version of the dynamic tag and not the cached version When you deploy your application to a production environment however you should turn on dynamic tag caching to increase the performance of your Web application R C 28 IBM Informix Web DataBlade Module Application Developer s Guide Limiting Loop Processing With the MIBLOCK Tag Limiting Loop Processing With the MIBLOCK Tag Use the Web DataBlade Module Administration Tool to set the MI_LOOP_MAX variable for your Webdriver configuration to limit the number of loops executed when you use the FOR FOREACH and WHILE attributes of the MIBLOCK AppPage tag During loop processing if the maximum number of loops is reached the WebExplode function raises an exception and stops loop processing For example assume you have set MI_LOOP_MAX to 100 in your Webdriver configuration and you execute the following AppPage lt MIBLOCK WHILE 1 gt We are in an infinite
101. Smyindex rows inserted into session array lt MIVAR gt lt PRE gt lt MIVAR gt lt BR gt lt A HREF SWEB_HOME MIval example_menu html gt Return to example_menu lt A gt lt MIVAR gt The following example shows the browser output lt 4 rows inserted into session array The output shows that the table contained four rows Using Variables in AppPages 5 15 Examples of Using Session Variables 5 16 The following AppPage example shows how to print the value of the session variables lt MIBLOCK COND S NXST session item_code 1 gt Don t detect expected variable need to run read_table first lt MIELSE gt lt MIVAR gt S SETVAR myindex 1 lt MIVAR gt lt PRE gt lt MIBLOCK INDEX item_code FOREACH Ssession item_code gt lt MIVAR gt S session item_code Smyindex Ssession description Smyindex session count myindex SETVAR myindex Smyindex 1 lt MIVAR gt lt MIBLOCK gt lt MIBLOCK gt lt PRE gt lt MIVAR gt lt BR gt lt A HREF SWEB_HOME MIval example_menu html gt Return to example_menu lt A gt lt MIVAR gt The following example shows the browser output 100025 Linux Getting Started 4 100039 History of the World part I 1 100042 100 ways to avoid paying tax amp duty 3 100099 Informix Universal Server Guide 10 The output is the contents of the sestesttab table For detailed information on how to configure variables or how to change the configu
102. Tags on page 9 17 What Are Dynamic Tags Dynamic tags are segments of AppPages that are stored in a database table and can be shared among multiple AppPages Dynamic tags allow you to standardize components of multiple AppPages such as the headers and footers that appear on multiple AppPages in your Web application Since the WebExplode function expands dynamic tags changes made to a dynamic tag are automatically applied to all AppPages that include the dynamic tag Dynamic tags reduce maintenance costs and centralize the source of updates to Web applications Using Dynamic Tags in AppPages 9 3 Specifying Dynamic Tags in AppPages 9 4 For example assume your Web application contains many AppPages Each AppPage has similar footer information such as a company logo infor mation about the application and an email address Instead of copying the common HTML into the footer of each AppPage you can create a dynamic tag that stores the common HTML in a table and then invoke the tag in the footer of each AppPage Then if you need to change any information in the footer you need only update the dynamic tag instead of updating every AppPage in your application The next time you invoke an AppPage in your application Webdriver automatically invokes the new dynamic tag in the AppPage with the updated information There are two types of dynamic tags system dynamic tags and user defined dynamic tags System dynamic tags are
103. WebUdrs system table on page 10 5 7 Enter the list of parameters to the UDR tag For information on specifying parameters see the table describing the WebUdrs system table on page 10 5 8 Enter a description of the UDR in the Description text box 9 Click Save APB inserts the reference to the UDR into the WebUdrs table APB manages only the contents of the WebUdrs table not the contents of the sysprocedures table When you delete a reference to a UDR from the WebUdsrs table you do not also delete the corresponding UDR in the syspro cedures table If you drop and re create a UDR with the DROP ROUTINE CREATE FUNCTION and CREATE PROCEDURE SOL statements the new UDR in the sysprocedures table has a new procid different from the procid of the reference to the UDR in the WebUdrs system table APB shows this inconsis tency by placing an asterisk before the UDR To bring the WebUdrs table up to date use APB to delete the reference to the UDR from the WebUdrs table and then use APB to re insert the reference with the new procid 10 10 IBM Informix Web DataBlade Module Application Developer s Guide Using the HTML Data Type In This Chapter The HTML Data Type Functions That Use or Return the HTML Data Type Example of Using an HTML Data Type 11 3 11 3 11 4 11 5 11 2 IBM Informix Web DataBlade Module Application Developer s Guide In This Chapter This chapter discusses the
104. a few extra columns used to store versioning information The following CREATE TABLE statement describes the schema of the wbTag version_ID SERIAL ID VARCHAR 30 description VARCHAR 254 parameters VARCHAR 254 class VARCHAR 64 current_version INTEGER last_changed datetime year to second last_changed_by VARCHAR 30 last_locked datetime year to second last_locked_by VARCHAR 30 delete_status INTEGER DEFAULT 0 version_label VARCHAR 80 version_comment VARCHAR 254 object HTML wizData BLOB PRIMARY KEY version_ID CONSTRAINT wbTagVersionID The wbPreviews Table The wbPreviews Table The wbPreviews table stores configuration variables that IBM Informix Data Director for Web uses during development The wbPreviews table is used by Data Director for Web only AppPage Builder does not use this table For more information about Data Director for Web refer to the IBM Informix Data Director for Web User s Guide The following CREATE TABLE statement describes the schema of the wbPre views table CREATE TABLE wbPreviews 1D VARCHAR 30 object HTML PRIMARY KEY ID CONSTRAINT wbPreviewName PUT object in 2 AppPage Builder Schema B 9 The wbProjects Table The wbProjects Table The wbProjects table stores AppPage Builder projects When you use AppPage Builder to create a Web application you can logically group the AppPages and binary objects that make up the appli cation into a
105. able for the specified routine Number of arguments of the routine The value in the numargs column of the WebUdrs system table must exactly match the corresponding value in the numargs column in the sysprocedures system table for the specified routine 1 of 2 Using UDR Tags in AppPages 10 5 Specifying a UDR Tag in an AppPage Column Name paramtypes description class Data Type Description LVARCHAR Comma delimited string specifying the data type of each argument The number of delimited data types must match the number of arguments specified by the numargs column An example is html html integer VARCHAR 250 Description of the routine VARCHAR 40 Class of the routine For example you can specify beginning expert or any other class name If you specify the class name system you cannot use AppPage Builder to delete the routine from the WebUdrs system table 2 of 2 Specifying a UDR Tag in an AppPage Specifying UDR tags in an AppPage is very similar to specifying dynamic tags in an AppPage Use the following syntax to invoke a UDR tag that takes arguments lt udrname NAME out COND condition paraml valuel param2 value2 gt You must specify the parameters of the UDR tag in the same order as the parameters of the corresponding UDR are listed in the sysprocedures table You can specify a maximum of 20 parameters If a UDR has no parameters or you want to use the default value of the paramet
106. ag on page 6 27 For more information on setting user defined variables with the Web DataBlade Module Administration Tool refer to the IBM Informix Web DataBlade Module Administrator s Guide Vector Variables A vector variable is a list of values with the same variable name Vector variables are similar to arrays You reference each element in the vector variable by specifying the name of the vector variable and an index number within brackets The first element in the vector variable has an index of 1 You create and display vector variables with the MIVAR tag just as you create and display simple user defined variables A simple user defined variable is a vector variable with a single value rather than a list of values This means that the following two variable specifications are equivalent lt MIVAR gt Smyvar lt MIVAR gt and lt MIVAR gt myvar 1 lt MIVAR gt 5 4 IBM Informix Web DataBlade Module Application Developers Guide Vector Variables The following sections describe how to create and manipulate vector variables Creating and Assigning Values to Vector Variables Use the MIVAR AppPage tag to create a vector variable Use the SETVAR variable processing function to assign values to the vector variable Finally use the MIVAR AppPage tag to display an element of the vector variable The following example creates a vector variable called flowers assigns it four values and displays the second value
107. age 6 5 MIVAR Tag on page 6 27 MIBLOCK Tag on page 6 29 MIELSE Tag on page 6 38 MIERROR Tag on page 6 40 MICOMMENT Tag on page 6 49 AppPage Tags AppPage tags identify the elements of an HTML page and specify the structure and formatting for that page The Web DataBlade module includes a set of tags that are processed by the WebExplode function Use the tags and tag attributes described in this chapter to create AppPages stored in the database Tip The AppPage tags use the SGML processing instruction tag format lt tag_info gt lt tag_info gt An SGML processor ignores tags that it does not recognize including AppPage tags Using Tags in AppPages 6 3 AppPage Tags The following table lists the AppPage tags Tag lt MISQL gt lt MISQL gt lt MIVAR gt lt MIVAR gt lt MIBLOCK gt lt MIBLOCK gt lt MIELSE gt lt MIERROR gt lt MIERROR gt lt MIFUNC gt lt MIFUNC gt lt MIDEFERRED gt lt MIDEFERRED gt lt MIEXEC gt lt MIEXEC gt Description Contains SQL statements and formatting specifications for the data retrieved Creates assigns and displays variables Delimits logical blocks of HTML Works in conjunction with an MIBLOCK tag that has a COND attribute Manages error processing Allows the execution of user written HTTP server modules invoked by the NSAPI or ISAPI Webdriver from an AppPage Enables
108. age map gt lt A HREF lt MIVAR gt SWEB_HOME lt MIVAR gt MImap on amp MIval image_ismap html gt lt IMG BORDER 0 SRC lt MIVAR gt SWEB_HOME lt MIVAR gt MIval sun gif ISMAP gt lt A gt lt TD gt lt TR gt lt TABLE gt lt HR gt lt Show resulting coordinates from the image gt lt Output values x_value and y_value gt lt if the standard image is clicked gt lt MIBLOCK COND XST x_value gt Output from Standard Image Map lt BR gt lt MIVAR gt x_value x_value lt MIVAR gt lt BR gt lt MIVAR gt y_value y_value lt MIVAR gt lt MIBLOCK gt lt BODY gt lt HTML gt The following figure shows sample Web browser output Web Browser Standard Image Map Example Figure 13 4 Standard Image http domain port hr_app webdriver MImap on amp Mlval image_ismap 31 31 Map Click on the image ES Output from Standard Image Map x_value 31 y_value 31 Using Other Webdriver Features 13 13 FORM Tag FORM Tag The following image_form html AppPage illustrates the use of image maps with an HTML form lt HTML gt lt HEAD gt lt TITLE gt Form Image Map Example lt TITLE gt lt HEAD gt lt BODY gt lt H2 gt Click on the image lt H2 gt lt TABLE BORDER gt lt TR gt lt TD VALIGN top gt lt Display the image as an input for a form gt lt FORM METHOD POST ACTION lt MIVAR gt SWEB_HOME lt
109. ags are not evaluated until the error condition is encountered Since the condition is evaluated only the first time the WebEx plode function encounters the MIERROR tag you must call the WebExplode function recursively to handle specific error conditions that must be evaluated after an error occurs The enter_table html AppPage allows you to type a table name into the TABLE text entry field in the following HTML form lt HTML gt lt HEAD gt lt TITLE gt Enter Table Name lt TITLE gt lt HEAD gt lt BODY gt lt H2 gt Enter table name lt H2 gt lt MIVAR NAME STABLE gt lt MIVAR gt lt MIVAR gt lt FORM METHOD POST ACTION SWEB_HOME gt lt INPUT TYPE TEXT NAME TABLE VALUE STABLE gt lt INPUT TYPE HIDDEN NAME MIval VALUE count_rows html gt lt INPUT TYPE SUBMIT VALUE Count Rows gt lt HR gt lt MIVAR gt lt BODY gt lt HTML gt The following illustration shows sample Web browser output Web Browser Enter Table Name Figure 6 9 Enter Table Name URL http webserver hr map M lval enter_table html Enter table name 4 i 6 44 IBM Informix Web DataBlade Module Application Developer s Guide Handling Error Conditions The following count_rows html AppPage processes the preceding form This processing AppPage contains a generic error handler that uses the WebExplode function to call the error_handler html AppPage if an error occurs lt HTML gt lt HEA
110. ainMenu AddObject Edit Object AdminMenu Add Dynamic Tag You can base this new tag on an existing tag to copy from the list below Base Tag OLD_DYNTAG M CONTINUE SAVE Tag 1D TMG Project geting_ started 7 Parameters Description Dynamic Tag D default_image amp path 8 extension gif My own image tag lt MISQL SQL select height width description extension from wbBinaries where ID ID and path path and extension extension gt lt IMG BORDER 0 IF 1 0 HEIGHT 1 IF 2 0 WIDTH 2 ALT 3 SRC WEB_HOME Mlval path O IFR NE path OIDO extension gt lt MISQL gt User Name Default Project TEXTAREA Width Versioning default getting started 80 Off User Level Default Object TEXTAREA Height WebLint Checking 0 AppPage 20 Off 9 20 IBM Informix Web DataBlade Module Application Developer s Guide Special Characters in Dynamic Tags If in your AppPage you specify the dynamic tag lt IMG ID my_image gt sample output to the client is lt IMG BORDER 0 HEIGHT 40 WIDTH 332 ALT My Image SRC hr map MIval my_image gif gt Because the IMG dynamic tag in the AppPage did not specify a value for the path and extension parameters the WebExplode function substituted the default values for the parameters in the body of the dynamic tag the forward slash and gif respectively
111. alues are passed as x and y coordinates Default is off Two Pass Query Processing Use the Web DataBlade Module Administration Tool to set the following Webdriver variable to specify that Webdriver execute a query in two parts Variable Mandatory Description MIqry2pass No Specifies a query to be executed in two parts MIqry2pass selects an object and then executes a function Used only in a URL Default is set to OFF Web DataBlade Module Variables C 25 Using RAW Mode with Webdriver Using RAW Mode with Webdriver To enable RAW mode use the Web DataBlade Module Administration Tool to set the following Webdriver variable in your Webdriver configuration Name of Variable in Variable Versions 3 3 and Previous Mandatory Content raw_password MI_RAWPASSWORD Yes Password to enable RAW mode Caching Information in the wbExtensions Table Use the Web DataBlade Module Administration Tool to set the extensions Webdriver variable to control whether Webdriver caches the information contained in the wbExtensions table When you are developing AppPages and possibly adding new extension types to the wbExtensions table you do not want Webdriver to cache this information but instead to retrieve it each time it is needed in case the infor mation has changed After you deploy your application to a production environment you should improve performance by caching the information in the wbExtensions table To enable extension i
112. ame socket SOCK PF_INET SOCK_STREAM proto or die socket connect SOCK paddr or die connect SOCK gt autoflush print SOCK This is the first message from the child client n SOCK gt autoflush Scontinue 1 Main processing loop Fetch Request get length of request attributes get request attributes get length of body get body Process Request do someing based upon Sattributes REQUEST Put value we want to appear as variables into results a hash type Put the value that we want in appear in the body in the variable bodyResult Generate Response convert the result hash to string gt stagedResults The hash is converted to name value pairs send length stageResults stagedResults send length bodyResult SbodyResult while continue undef results undef Sresults SattrHead lt SOCK gt get length of input defined attrHead die Connection to server dropped SattrHead 0 9 print Could not derive length from header SattrHeadin SattrLen 1 put length in a reasonible place my Sattr while lt SOCK gt Sattr if length S attr gt SattrLen last Sattributes Sattr SbodyHead lt SOCK gt defined bodyHead die Connection to server dropped Using Advanced AppPage Tags 7 17 Sample Perl Program SERVE pl bodyHead 0 9 die Could not derive length from header b
113. an AppPage Examples of Using the MIEXEC Tag Sample Perl Program SERVE pl 7 3 7 3 7 4 7 5 7 5 7 6 7 7 7 8 7 10 7 11 7 13 7 15 7 2 IBM Informix Web DataBlade Module Application Developer s Guide In This Chapter This chapter discusses AppPage tags and attributes that are used for specialized processing features of your Web application The following tags are covered in this chapter m MIFUNC Tag following MIDEFERRED Tag on page 7 7 The MIEXEC Tag on page 7 9 MIFUNC Tag The MIFUNC tag allows you to execute user written HTTP server modules invoked by the NSAPI or ISAPI Webdriver from an AppPage Before you use the MIFUNC tag in an AppPage you must create a shared object or DLL for a specific Webdriver implementation and register it with the Web server You can also invoke two functions that are internal to Webdriver These functions are used for administering session management and AppPage caching For details on using the MIFUNC tag within the NSAPI or ISAPI Webdriver see the NSAPI or ISAPI chapters in the IBM Informix Web DataBlade Module Admin istrator s Guide Using Advanced AppPage Tags 7 3 FUNCTION Attribute When the WebExplode function encounters an MIFUNC tag in an AppPage the WebExplode function passes the function name to Webdriver Webdriver then executes the user written function and returns the results back to the WebExplode function Within the MIFUNC tag
114. and extension html Then Webdriver executes the WebExplode function on the retrieved AppPage that has been cached in Webdriver s memory execute function WebExplode lt MISQL gt name value amp name2 value2 To enable two pass query processing set the MIqry2pass Webdriver variable to on By default MIqry2pass is set to OFF You cannot set the MIqry2pass Webdriver variable with the Web DataBlade Module Administration Tool because this variable is never stored as part of a Webdriver configuration You must set the MIqry2pass Webdriver variable as part of the URL used to retrieve the AppPage The following URL invokes the special_page html AppPage and sets the MIqry2pass Webdriver variable to ON so that the AppPage is retrieved using the two pass method hr_app MIval special_page html MIqry2pass on AppPage Builder APB uses this technique to allow you to insert rows into the same table from which it selects AppPages Important Since the two pass method has a performance penalty set the MIqry2pass Webdriver variable to ON only when necessary 13 16 IBM Informix Web DataBlade Module Application Developer s Guide Using DataBlade Module API Functions in AppPages In This ChaPter o vi a we la as ew A 14 3 The Web DataBlade Module API Functions 14 3 WebHtmlToBuf 2 2 2 ee ee a 14 5 WebBufTfoHtml 2 2 2 ee a 14 8 14 2 IBM Informix Web DataB
115. and SERIALS8 Attributes PREPARE Attribute Generating XML Formatted Data MIVAR Tag NAME Attribute DEFAULT Attribute COND Attribute ERR Attribute MIBLOCK Tag ERR Attribute COND Attribute Loop Processing MIELSE Tag 5 3 5 3 5 4 5 4 5 8 5 11 5 12 5 13 5 14 5 17 6 3 6 3 6 5 6 7 6 14 6 15 6 15 6 17 6 18 6 20 6 21 6 23 6 27 6 28 6 28 6 29 6 29 6 29 6 31 6 31 6 32 6 38 Table of Contents v MIERROR Tag ee ee ee ee 6 40 TAG Attribute we eee 6 41 ERR Attribute de Re gen Bote tae Bec tes OAD Creating a Generic Error Handler bo tks oh ude He ba bo e Sk 3 Creating aSpecificErrorHandler 2 643 Handling Error Conditions 6 44 Processing Errors with Webdriver 6 46 MICOMMENT Tag Sea Re rd od Tah ae era 649 Special Characters in AppPage Tags coh amp Y aoa 2 a adh ty 2 6 5 Special HTML Characters 2 1 1 we 6 51 Special Formatting Characters 1 6 52 Chapter 7 Using Advanced AppPage Tags In This Chapter 2 4 see a a doe ob eee og dae 7 3 MIFUNC Tag a e ee Se eee AA 7 3 FUNCTION Attribute Be es Wee fh Ae ee oe th Od oe ee a 7 4 DLE Attributes or ea Oe o teed G ra 7 5 INTERNAL Attribute o 7 5 MIDEFERRED Tag iio a e Be KS eck oS 7 7 The defer Prefix 2 ee o o 7 8 The MIEXEC Tags giai ao te pooh dy
116. aracters a z A Z or 0 9 dots and underscores _ Variables are global in scope within an AppPage and can be called recur sively from an AppPage using the WebExplode function To pass variable values between AppPages that are not called recursively with the WebEx plode function you must explicitly pass the variables in a URL or an HTML form For information on calling the WebExplode function see WebEx plode on page 12 4 Using Variables in AppPages 5 3 User Defined Variables Important Variables are only interpreted within MISQL MIVAR and MIERROR gt tags as well as within the COND attribute of the MIBLOCK tag There are five different kinds of variables in AppPages described in the following subsections User Defined Variables following Vector Variables on page 5 4 Web DataBlade Module System Variables on page 5 8 Web Server and Web Browser Variables on page 5 8 Session Variables on page 5 11 User Defined Variables You can create user defined variables and assign default values to them by using the Web DataBlade Module Administration Tool or by setting them using the NAME attribute of the MIVAR tag within an AppPage You can override default values for existing user defined variables in an MIVAR tag an HTML form or a URL that invokes an AppPage For more information on how to assign and display variables using the MIVAR tag see MIVAR T
117. ard 0 lt MIVAR NAME test gt 10 lt MIVAR gt lt MIBLOCK WHILE test gt This will iterate lt MIVAR gt Stest lt MIVAR gt more times lt MIVAR NAME test gt test 1 lt MIVAR gt lt MIBLOCK gt Using Tags in AppPages 6 37 MIELSE Tag The following flowchart illustrates the program logic for the WHILE loop Figure 6 8 WHILE Loop Processing WHILE attribute exist WHILE attribute 0 Processbody of loop MIELSE Tag The MIELSE tag works in conjunction with the MIBLOCK tag MIELSE has the following optional attribute Attribute Description COND If the value of COND is true the body of the MIELSE is processed to the next MIBLOCK or MIELSE The MIELSE tag is used within the body of an MIBLOCK tag Statements within an MIBLOCK body that contain an MIELSE tag are executed if the most recently unmatched COND attribute of MIBLOCK is 0 The body of the MIBLOCK is skipped to the MIELSE The contents of the MIELSE is processed to the close of the most recent unclosed MIBLOCK or the next MIELSE This is similar to Visual Basic if then else processing 6 38 IBM Informix Web DataBlade Module Application Developer s Guide MIELSE Tag The following example shows a simple application of an MIELSE tag used within an MIBLOCK tag lt MISOL SQL select foreign_language from languages where name John Doe gt 1 lt MISQOL gt lt MIBLOCK COND MI_ROWCOUNT gt You are an american
118. ation Conventions Typographical Conventions Case Sensitive Text Case Insensitive Text Icon Conventions Comment Icons Platform Icons e Screen Illustration Conventions Additional Documentation Printed Documentation Online Documentation Qa 4 2 Release Notes and Documentation Notes IBM Welcomes Your Comments OO OON ND HD 01 or Ww oO 2 IBM Informix Web DataBlade Module Application Developer s Guide In This Introduction This chapter introduces the IBM Informix Web DataBlade Module Application Developer s Guide Read this chapter for an overview of the information provided in this manual and for an understanding of the conventions used throughout About This Manual The IBM Informix Web DataBlade Module Application Developer s Guide explains how to use the IBM Informix Web DataBlade module to create Web applica tions that dynamically retrieve data from a database managed by IBM Informix Dynamic Server The manual provides information about the features provided by the Web DataBlade module to assist you in developing Web enabled database appli cations These features include tags specific to the Web DataBlade module variable processing functions a special HTML data type to store application pages DataBlade module functions and so on To use this manual you or the database administrator must have previously performed certain administrative tasks such as installing the Web DataBlade module on
119. attribute would improve the perfor mance of your application The following example shows how to use the CACHERESULTS attribute lt MISOL SQL SELECT catptionText FROM mc_Caption WHERE captionID 42 AND locale fr_fr CACHERESULTS gt 1 lt MISQL gt Whenever the WebExplode function encounters an MISQL AppPage tag with a CACHERESULTS attribute the function searches the results cache for an entry with the same SQL statement and if itis a prepared statement it also searches for the same statement input parameters If the WebExplode function finds a matching entry then the function returns the contents of the cache to the AppPage Otherwise the function executes the SQL statement as usual and saves the results in the cache The WebExplode function replaces all variables and parameters in an SQL statement before it searches the results cache for a match For example the following MISQL call contains both a parameter and a variable lt MISOL SQL SELECT catptionText FROM mc_Caption WHERE captionID ID AND locale SLOCALE CACHERESULTS gt 1 lt MISQL gt The WebExplode function replaces both the parameter ID and the variable LOCALE before searching or creating a cache The DataBlade module maintains a separate cache for each combination of OIDO and LOCALE The CACHERESULTS attribute is designed to work with queries that return a small number of small rows As the result sets get larger the caching
120. b DataBlade Module Application Developer s Guide In This Chapter This chapter describes user defined routine UDR tags It includes the following topics What Is a User Defined Routine UDR Tag following Where Are UDR Tags Stored on page 10 4 Specifying a UDR Tag in an AppPage on page 10 6 Creating a UDR Tag on page 10 8 What Is a User Defined Routine UDR Tag A user defined routine UDR tag is a tag in an AppPage that directly executes an existing UDR in the database Directly executing UDRs in your AppPages can increase the performance of your Web application By specifying the UDR in a UDR tag the WebExplode function bypasses the database server parser facility when it executes the UDR If your Web application executes many UDRs you can noticeably increase the performance of your application by executing them in UDR tags A UDR is a routine that you create and register in the database UDRs can be written in C SPL or Java You typically execute UDRs with an SQL statement as shown in the following example EXECUTE FUNCTION webupper Hello World The UDR in the example is called webupper and it takes one parameter The UDR returns the value of the parameter in uppercase HELLO WORLD Using UDR Tags in AppPages 10 3 Where Are UDR Tags Stored If you want to execute the webupper UDR in an AppPage you could use the MISOL AppPage tag as shown in the following example lt HT
121. bject 2 path 1 of 2 IBM Informix Web DataBlade Module Application Developers Guide 3 6 The wbExtensions Table Ss 2 2 2 gt c 5 E e g E 8 E 5 2 e E a 3 amp aa 2 E 5 2 a S d g 2 a a 3 S 2 2 gif GIF image wbBinaries image gif ID object 3 path jpg JPEG image wbBinaries image jpeg ID object 3 path jpeg JPEG image wbBinaries image jpeg ID object 3 path bmp Bitmap image wbBinaries image bmp ID object 3 path doc Microsoft wbBinaries application ms word ID object 3 path Word document ppt Microsoft wbBinaries application ms ppt ID object 3 path PowerPoint presentation xls Microsoft wbBinaries application ms excel ID object 3 path Excel worksheet pdf Adobe wbBinaries application pdf ID object 3 path Acrobat document wav WAV sound wbBinaries audio x wav ID object 3 path qt QuickTime wbBinaries video quicktime ID object 3 path movie mov QuickTime wbBinaries video quicktime ID object 3 path movie avi Microsoft wbBinaries video x msvideo ID object 3 path video vrml VRML model wbPages x world vrml ID object 2 path 2 of 2 For example this table shows that an object with the extension doc is stored in wbBinaries the ID of the document is stored in the id column and the path of the document is stored in the path column Basics of AppPage Development 3 7 Adding a New Extension to the wbBinaries Table Adding a New Extension to the wbBinaries Table If you have other resources that your AppPage uses su
122. ble Expressions to Format Output Conditionally Example of Conditional Output Example of a Walking Window Special Characters in Variable Expressions 8 3 8 3 8 10 8 10 8 11 8 11 8 13 8 13 8 15 8 17 8 2 IBM Informix Web DataBlade Module Application Developer s Guide In This Chapter This chapter describes how variable processing functions enable you to perform calculations using variables that are passed into an AppPage generated within the AppPage or returned from the database It includes the following topics m Variable Processing Functions following m Using Variable Expressions in AppPages on page 8 10 m Special Characters in Variable Expressions on page 8 17 Variable Processing Functions Variables are identified by a dollar sign followed by alphanumeric and underscore characters Variable expressions start with a character followed by the expression within parentheses expression Variable processing functions allow you to evaluate and manipulate variables within variable expressions Variable expressions can contain other variable expressions You should always enclose variable processing functions used in any attribute of an AppPage tag in double quotes For example the following MISOL AppPage tag includes a variable processing function enclosed in double quotes in its COND attribute lt MISQL COND S gt vall val2 SQL select from staff gt The fo
123. bute of selection lists If the variable is not a vector variable the loop is processed one time if it is a vector variable the body is processed the vector variable length number of times Used in the WHILE loop to determine if the body is processed If this attribute is not equal to 0 the body is processed IBM Informix Web DataBlade Module Application Developer s Guide ERR Attribute ERR Attribute A vector variable consists of multiple variables with the same name passed into the AppPage using check boxes or the MULTIPLE attribute of selection lists The ERR attribute of the MIBLOCK tag is invoked only if an error occurs when the WebExplode function evaluates the condition specified by the COND attribute For more information on the ERR attribute see MIERROR Tag on page 6 40 COND Attribute The COND attribute specifies a condition that is evaluated before the tag is processed If the condition is true the tag is processed Conditions are variables or variable expressions that are false if 0 and true if nonzero The following cond_display html AppPage uses the COND attribute within an MIBLOCK tag to conditionally display text according to the value of a variable lt HTML gt lt HEAD gt lt TITLE gt Conditional Display lt TITLE gt lt HEAD gt lt BODY gt lt MIVAR COND NXST VAR1 NAME VAR1 gt 0 lt MIVAR gt This is always displayed lt BR gt lt MIBLOCK COND SVAR1 gt This is conditiona
124. by VARCHAR 30 read_level INTEGER last_locked datetime year to second last_locked_by VARCHAR 30 object HTML PRIMARY KEY ID path extension CONSTRAINT wbPageld FOREIGN KEY extension REFERENCES wbExtensions extension PUT object in 2 AppPage Builder Schema B 3 The wbPageVersions Table Versions table version_ID ID path extension description author keywords current_version last_changed last_changed_by read_level last_locked last_locked_by delete_status version_label version_comment object PUT object in 2 CREATE TABLE wbPageVersions PRIMARY KEY version_ID FOREIGN KEY extension SER VAR VAR VAR VAR VAR VAR INT dat VAR INT dat The wbPageVersions Table The wbPageVersions table stores previous versions of AppPages The wbPageVersions table has a schema similar to the wbPages table but with a few extra columns used to store versioning information The following CREATE TABLE statement describes the schema of the wbPage IAL CHAR 30 CHAR 178 CHAR 12 CHAR CHAR 30 CHAR 254 EGER etime year to second CHAR 30 EGER etime year to second VARCHAR 30 INT VAR EGER DEFAULT 0 CHAR 80 VARCHAR 254 HTM CONST REFERENCES wbExtensions B 4 IBM Informix Web DataBlade Module Application Developers Guide L RAINT wbPageVersionld The wbBinaries Table The wbBinaries Table The wbBinaries table sto
125. ch as plug ins or appli cations that are not stored in your database you can create a table and map to these resources using the ID path and extension associated with the resource Use DB Access or any client tool to create the table Use APB to add a new extension that maps to your new table The extension links to the wbExtensions table where you find the corresponding object and MIME type If you do create a new extension for a new resource the extension must be unique For more information on how to add a new extension using APB see Creating Web Applications in AppPage Builder on page 4 7 As described in the previous section the wbExtensions table contains default extensions that correspond to standard objects that can be included in an AppPage HTML GIFs Microsoft Word documents and so on These default extensions probably cover most of the types of objects you might want to include in an AppPage If however you want to include an object in your AppPage that is not described by a row in the wbExtensions table you can add a new extension to the table that describes the object For example you might have a new video object that is stored in a format not described by any row in the wbExtensions table Use APB to add a new extension to the wbExtensions table For the procedure on adding an extension see Adding an Extension on page 4 10 When you create a new extension you specify the source table that stores the obj
126. chema 9 6 IBM Informix Web DataBlade Module Application Developers Guide Variable Dynamic Tag WebExplode Variables Dynamic Tag WebExplode Variables The following table describes the dynamic tag WebExplode variables that you can set in your Webdriver configuration Use the Web DataBlade Module Administration Tool to set these variables Mandatory MI_WEBTAGSTABLE No MI_WEBTAGSSOL No Description Specifies the database table that the WebExplode function searches for the body of a dynamic tag This variable can be set to the following two values webTags or wbTags The default value if this variable is not set is webTags You must set the MI_WEBTAGSTABLE variable to woTags in your Webdriver configuration if you developed your Web appli cation using the APB application included in Version 4 0 or later of the Web DataBlade module or Version 2 0 of Data Director for Web Specifies a user defined SELECT statement that the WebEx plode function runs to retrieve the body of a dynamic tag Never set the MI_WEBTAGSSQL variable in your Webdriver configuration The variable should only be set for Web applica tions that were developed with Version 1 1 or earlier of Data Director for Web The MI_WEBTAGSTABLE variable takes precedence over the MI_WEBTAGSSQL variable This means that if you have both variables set in your Webdriver configuration the WebExplode function searches for the dynamic tag in th
127. ctions typically to retrieve or update data from database tables and to format the results Product Architecture The Web DataBlade module consists of three main components m Webdriver m The WebExplode function m Tags and attributes These components are described in the following sections The section Architecture Diagram on page 1 6 provides an illustration of the archi tecture of the Web DataBlade module and how the main components work together Webdriver Webdriver is a database client application that builds the SQL queries that execute the WebExplode function to retrieve AppPages from your database Webdriver returns the HTML that results from calls to the WebEx plode function to the Web server The Web DataBlade module includes four implementations of Webdriver m NSAPI Webdriver This implementation of Webdriver is written with the Netscape Server API and is used only with Netscape Web servers m Apache Webdriver This implementation of Webdriver is written with the Apache API and is used only with Apache Web servers m ISAPI Webdriver This implementation of Webdriver is written with the Microsoft Internet Information Server API and is used only with Microsoft Internet Information Web servers m CGI Webdriver This implementation of Webdriver is a standard CGI program that can be executed by all Web servers 1 4 IBM Informix Web DataBlade Module Application Developers Guide The WebExplod
128. d Extension Edit Extension Text Box Extension Name Source Table Super Type Sub Type ID Column Path Column Action Add a new multimedia object type to APB Modify the page suffix for an object type Add a new extension Edit an existing extension 2 of 2 Adding an Extension When you initially install AppPage Builder in your database the wbExten sions table contains a default set of extensions for most object types you need to invoke in an AppPage Use the following procedure to add a new extension to the wbExtensions table To add a new extension to the wbExtensions table using APB 1 Click Admin Menu 2 Click Add Extension 3 On the Add Extension AppPage fill in the following text boxes with the appropriate information for your new extension Description The file extension The name of the extension The name of the table that stores objects of this type The MIME supertype of the extension The MIME subtype of the extension The column in the storage table that identifies the object Content Column The column in the storage table that contains the object The column that contains the object s path information 4 10 IBM Informix Web DataBlade Module Application Developer s Guide Adding an Extension 4 Click the WebExplode Text or Blob button to indicate the retrieval method you prefer for your new object 5 Click Save Using AppPage Builder 4 11 Using Variables in AppPages
129. d that you set this variable to a value greater than 1 only if you are using a multibyte character set This is because you might see a degradation in performance if Webdriver is forced to URL encode every character before sending it to the WebExplode function You can override the value of this variable for your Webdriver mapping by adding it as a Webdriver variable to the appropriate Webdriver configuration config_user The name of the user who is allowed to use the Web DataBlade Module Administration Tool Add this variable to the web cnf file only with the webconfig utility config_password No The password of the config_user user Add this variable to the web cnf file only with the webconfig utility dbconntimeout Sets the maximum time in seconds that a Webdriver connection to the database is allowed to be idle Webdriver automatically closes any database connections that have been idle for longer than the value of dbconntimeout The following sample shows how to set dbconntimeout to 120 seconds lt GLOBAL gt debug_file tmp driver log debug_level dbconntimeout 120 dbconnmax 128 anchorvar WEB_HOME lt GLOBAL gt If no database request is made on a connection for 2 minutes then Webdriver closes the connection 2 of 2 Web DataBlade Module Variables C 3 The Setvar Section of the web cnf File The Setvar Section of the web cnf File You set Informix en
130. ders and footers In this step you create a header and footer for your application For more information on how to use dynamic tags refer to Using Dynamic Tags in AppPages on page 9 1 Create a Header Use the following procedure to create a header tag To create a header tag 1 Click Add Object Web DataBlade Module Tutorial 2 5 Steo 2 Create User Defined Dynamic Tags 2 Click Dynamic Tag The Add Dynamic Tag AppPage appears Web Browser APB Add Dynamic Tag APB Ph at 2 2 ynamic URL http domain port hr_app Mlval APB20 apb html Tag AppPage Bullder 2 0 MainMenu AddObject Edit Object AdminMenu Add Dynamic Tag You can base this new tag on an existing tag to copy from the list below Base Tag OLD_DYNTAG M CONTINUE Tag ID Class Project getting_started v Parameters Description Dynamic Tag User Name Default Project TEXTAREA Width Versioning default getting_started 80 Off User Level Default Object TEXTAREA Height WebLint Checking 0 AppPage 20 Off Y A gt 2 6 IBM Informix Web DataBlade Module Application Developer s Guide Type amp TITL O oa F WwW lt html gt lt head gt Steo 2 Create User Defined Dynamic Tags Type my_header in the Tag ID text box E in the Parameters text box Type a description of the dyna
131. des see the IBM Informix Web DataBlade Module Administrator s Guide Returns the starting position of string2 within string1 Tf string2 is not found returns 0 The parameter valn is a numeric offset and gives the start location within the first input string If valn is less than or equal to 0 returns 0 4 of 6 Using Variable Processing Functions in AppPages 8 7 Variable Processing Functions 8 8 Function REPLACE string1 string2 string3 ROUND value digit SEPARATE varvector string SETVAR varname value STRFILL string ncopies STRLEN string SUBSTR string start length TRACEMSG string TRIM string TRUNC value digit UNSETVAR varname UPPER string IBM Informix Web DataBlade Module Application Developers Guide Returns Replaces all instances of string2 with string3 within string1 Returns the numeric value rounded to no more than digit number of digits Separates items in the vector variable varvector with the string value string Sets the variable varname to the numeric or string value Returns the result of concatenating ncopies number of copies of string Returns the length of string Returns the substring of string starting at character start and extending for length characters Characters in the string are numbered from 1 If length is omitted returns the entire remaining length of the string Writes the message string to a trace file
132. describes the IBM Informix Web DataBlade module API routines m Appendix A Debugging Web DataBlade Module Applications describes debugging techniques for the Web DataBlade module m Appendix B AppPage Builder Schema describes the schema for AppPage Builder m Appendix C Web DataBlade Module Variables lists all Webdriver and WebExplode function variables A Notices appendix describes IBM products features and services A glossary of relevant terms follows the chapters and an index directs you to areas of particular interest Types of Users This guide is written for Web application designers who are familiar with HTML including tables and forms SOL and database installation and system administration Software Dependencies To use the IBM Informix Web DataBlade module you must use IBM Informix Dynamic Server as your database server Check the release notes for specific version compatibility The release notes also list the Web servers that have been certified for this release of the Web DataBlade module Introduction 5 Assumptions About Your Locale 6 Assumptions About Your Locale IBM Informix products can support many languages cultures and code sets All culture specific information is brought together in a single environment called a GLS Global Language Support locale The examples in this manual are written with the assumption that you are using the default locale en_us 8859 1 This
133. dling errors see MIERROR Tag on page 6 40 SOLSTATE returned from the SOL statement when an error occurs For more information on handling errors see MIERROR Tag on page 6 40 Error message returned from the SQL statement For more information on handling errors see MIERROR Tag on page 6 40 Number of rows retrieved in the SOL statement Updated after processing is complete SOL statement executed Using Tags in AppPages 6 11 Using System Variables to Format the SQL Results The following select4 html AppPage displays the number of rows returned by the last query executed lt HTML gt lt HEAD gt lt TITLE gt Simple Select 4 lt TITLE gt lt HEAD gt lt BODY gt lt TABLE BORDER gt lt MISQL SQL select from staff gt lt TR gt lt TD gt lt TD gt lt TR gt lt MISQL gt lt TABLE gt lt HR gt lt B gt This query retrieved lt B gt lt MIVAR gt SMI_ROWCOUNT lt MIVAR gt lt B gt rows lt B gt lt BODY gt lt HIML gt The following illustration shows sample Web browser output Web Browser Simple Select 4 5 esas D imple Selec URL http domain port hr_app Mlval select4 html John Somebody Senior Consultant Joe Average Consultant Mark Software Development Engineer This query retrieved 3 rows 4 Tip System variables maintain their values and can be redis
134. driver AppPage caching Use the MIDEFERRED tag to mark the dynamic content of an AppPage deferring its execution for each request The MIDEFERRED tag has no attributes To use the MIDEFERRED tag in an AppPage you must have enabled AppPage caching for the AppPage See the IBM Informix Web DataBlade Module Adminis trator s Guide for more information on partial AppPage caching When Webdriver calls the WebExplode function in the database and the AppPage that is being parsed contains a deferred section Webdriver caches the AppPage adding a def extension to the file A second call to the WebEx plode function is required to complete the request the first time the AppPage is called lt MIVAR gt Non deferred section lt MIVAR gt lt MIDEFERRED gt lt MIVAR gt Deferred section lt MIVAR gt lt MIDEFERRED gt The first time the WebExplode function calls this AppPage it writes the results to the cache directory and assigns a def extension local0 pagecache mydb mypage CP232 647484 848493 def The WebExplode function parsing results are as follows Non deferred section lt MIVAR gt Deferred section lt MIVAR gt When the page is subsequently called with a matching value list the cached page is called and passed to the WebExplode function using the EXECUTE FUNCTION syntax The parsing results are as follows Non deferred section Deferred section Subsequent matching requests require processing of only the de
135. e Where Are UDR Tags Stored The following table describes the columns of the WebUdrs system table Column Name Data Type Description id parameters procid procname numargs VARCHAR 40 LVARCHAR INTEGER VARCHAR 128 INTEGER Unique identifier of the routine Specify this identifier when you invoke the routine in an AppPage with the tag lt udrname gt The value in this column does not have to match the corre sponding value in the sysprocedures system table The parameters passed to the routine Parameters in the parameters column are separated by an ampersand amp You can assign a default value to a parameter by specifying the parameter and its value as a name value pair for example paraml valuel A parameter that does not need a default value is specified by the parameter followed by an equal sign with no value following for example param Unique identifier of the routine as specified in the procid column of the sysprocedures system table The value in the procid column of the WebUdrs system table must exactly match the corresponding value in the procid column in the sysprocedures system table for the specified routine Unique name of the routine as specified in the procname column of the sysprocedures system table The value in the procname column of the WebUdrs system table must exactly match the corresponding value in the procname column in the sysprocedures system t
136. e 12 11 WebRmtShutdown 12 19 WebUnHTML 12 12 WebURLDecode 12 14 WebURLEncode 12 15 G Global Language Support GLS Intro 6 H HTML data type 11 3 HTTP headers 13 3 JKLMNOPQRSTUVV VxXtvY ze HTTPHEADER variable processing function 8 5 13 3 HTTP_HOST Web server variable 5 8 HTTP_REFERER Web server variable 5 8 HTTP_URI Web server variable 5 8 HTTP_USER_AGENT Web server variable 5 8 Icons Important Intro 9 Tip Intro 9 Warning Intro 9 IF variable processing function 8 5 ifx_allow_newline t procedure 11 4 iis_nt_password Webdriver variable C 13 iis_nt_user Webdriver variable C 12 Image maps 13 12 IMG tag 13 12 Important paragraphs icon for Intro 9 INDEX attribute of MIBLOCK tag 6 30 INDEX variable processing function 8 6 Informix Data Director for Web 1 10 INFORMIXSERVER environment variable C 5 init_sql Webdriver variable C 8 Interrupting a query C 7 Invoking AppPages using Apache 3 9 using CGI 3 9 using ISAPI 3 9 using NSAPI 3 9 ISINT variable processing function 8 6 ISNUM variable processing function 8 6 ISO 8859 1 code set Intro 6 ISTAR and caching 6 19 K keepalive Webdriver variable C 8 L Large object handles 3 15 Large objects retrieving 3 15 uploading with Webdriver 13 9 Linking AppPages 3 11 ANCHOR tag 2 10 3 12 FORM tag 2 10 3 12 Locale Intro 6 Loop Processing FOR loop 6 33 FOREACH loop 6 35 WHILE loop 6 37 LOWER variable processing function
137. e Function For optimal performance you should use the implementation of Webdriver written for your specific Web server You should only use the CGI Webdriver for Web servers that do not have their own implementation of Webdriver Tip This guide uses the term Webdriver without a preceding qualifier to refer to Webdriver functionality that is present in all implementations of Webdriver The guide uses a qualified term such as NSAPI Webdriver to refer to a specific imple mentation of Webdriver The WebExplode Function The WebExplode function is an SQL function that builds dynamic HTML pages based on data stored in your database The WebExplode function parses AppPages that contain AppPage tags within HTML and dynamically builds and executes the SQL statements and processing instructions embedded in the AppPage tags The WebExplode function formats the results of these SQL statements and processing instructions and returns the resulting HTML page to the client application Webdriver The SQL statements and processing instructions are specified using SGML compliant processing tags Tags and Attributes The Web DataBlade module includes a built in set of SGML compliant tags and attributes that enable SQL statements to be executed dynamically within AppPages These tags are referred to as AppPage tags For example the MISQL tag allows you to execute an SOL statement such as SELECT and format the results of the state
138. e HO 3 Passing Image Map Coordinates IMG Tag FORM Tag Two Pass Query Processing 13 3 13 3 13 3 13 4 13 4 13 5 13 5 13 7 13 8 13 8 13 9 13 12 13 12 13 14 13 15 13 2 IBM Informix Web DataBlade Module Application Developer s Guide In This Chapter This chapter explains Webdriver features that enable you to add HTTP headers to AppPages to retrieve non HTML pages and use cookies to upload client files for Web browsers that support the ENCTYPE attribute of the FORM tag and to pass image map coordinates It includes the following topics m Adding HTTP Headers to AppPages following m Uploading Client Files on page 13 7 m Passing Image Map Coordinates on page 13 12 Adding HTTP Headers to AppPages Webdriver enables you to use HTTP headers in your AppPages to retrieve non HTML pages and to use cookies Retrieving Non HTML Pages You can retrieve non HTML pages by changing the content type of an AppPage and adding an HTTP header to the AppPage To change the content type of an AppPage add an HTTP header to the AppPage to replace the default text html content type header Use the following syntax within a variable expression to set the content type S HTTPHEADER content type mimetype subtype Webdriver adds a content length header to the page because only Webdriver can determine the size of the page Using Other Webdriver Features 13 3 Using Cookies The fol
139. e WebBufToHtml function by its signature and to fetch its function descriptor Then use the mi_routine_exec DataBlade API routine to execute the WebBufToHtml function Pass the pointer to the MI_LVARCHAR object to the mi_routine_exec function which returns the data converted into an HTML object Remember to use the mi_routine_end DataBlade API function to release the resources associated with the mi_routine_get function See the sample C program at the end of this section for an example of using these API functions For detailed information on the functions and data types of the DataBlade API refer to the DataBlade API Programmer s Manual 14 8 IBM Informix Web DataBlade Module Application Developer s Guide WebBurToHtml Return Values A pointer to the HTML object that contains the contents of the converted ML LVARCHAR object Example The following example C program shows how to use the WebBufToHtml API routine to convert the contents of the MI_LVARCHAR object buf into an HTML object The example uses the DataBlade API routines mi_routine_get mi_routine_exec and mi_routine_end include lt stdio h gt include lt ctype h gt include lt string h gt include lt stdlib h gt include lt mi h gt include lt alloca h gt include lt assert h gt BR RR IK KK RK KK IR IR RK KR I IR OR IOI IO OR KK k k lVarcharToHtm conn buf Takes in an LVARCHAR and converts it to an HTML da
140. e first example reduces errors and the second enhances security Your web site may use HTML lt FORM gt tags to receive user input Typically the page takes the lt INPUT gt of the form assembles an SQL statement string and executes it to select or update data If a text entry in a form contains any single quotes the resulting SQL query can result in a syntax error For example Original form lt INPUT TYPE text NAME name gt Receiving target page lt MISQL SQL INSERT into person name VALUES Sname gt Person inserted lt MISQL gt The user types the following text into the name field 0 Brien Using Tags in AppPages 6 21 PREPARE Attribute This results in an incorrect SQL VALUES clause that raises error 16306 Found a quote for which there is no matching quote VALUES O Brien Consider another situation a hacker who knows that lt INPUT gt fields become part of a SQL string could enter data into any field text or otherwise to change the syntax and function of an SQL statement For example Original form lt INPUT TYPE text NAME custid gt Receiving target page lt MISQL SQL SELECT date amount payee FROM transactions WHERE custid custid ORDER BY 1 gt 1 2 3 gt lt MISQL gt The hacker enters into custid field 12345 OR 1 1 The resulting SOL WHERE clause is WHERE custid 12345 OR 1 1 which allows the hacker to see all customer transactions
141. e or view cache entries in the cache_directory directory The default value is cacheadmin 2 of 4 Web DataBlade Module Variables C 17 Enabling AppPage Caching Name of Variable in Versions 3 3 Webdriver Variable and Previous Mandatory Description cache_admin_password MI_WEBCACHEPASSWORD No Specifies that cache adminis tration requests are processed only if the password entered in the Cache Administration AppPage matches this value cache_page_timestamp New in Version 4 0 No Specifies that Webdriver when invoking an AppPage for which AppPage caching has been enabled adds time stamp information at the bottom of the page The time stamp is enclosed in an HTML comment and thus is only seen if a user views the HTML source of the AppPage in their browser The default value is oF F To enable this feature set this Webdriver variable to on 3 of 4 C 18 IBM Informix Web DataBlade Module Application Developers Guide Webdriver Variable Name of Variable in Versions 3 3 and Previous Mandatory Enabling AppPage Caching Description cache_page_debug New in Version 4 0 No Specifies that Webdriver invokes AppPages that contain deferred sections delimited with the MIDEFERRED tag without returning an error even if AppPage caching has not been enabled This Webdriver variable is used to debug problems with partial AppPage caching The cache_page_debug Webdriver variable can be set to
142. e AppPage contains an MISQL tag that attempts to update the table in which the AppPage is stored In the preceding example this table is wbPages In this case the following error is returned Exception from Informix XIX000 7435 This statement references a table that is used in the parent queries m The AppPage contains an MISQL tag that issues a data definition language DDL statement And example of a DDL statement is the DROP TABLE statement You cannot issue a DDL statement inside a user defined routine in this case the WebExplode function because the user defined routine is executed as part of a data manip ulation language DML statement In this case the following error is generated Exception from Informix XIX000 7502 Illegal SQL statement in user defined routine drop table mytable The workaround for the preceding situations is to inform Webdriver via the MIqry2pass Webdriver variable that it must use a two pass method to execute the query This means the query is broken up into two parts executed one after the other Variable Mandatory Description MIqry2pass No Specifies a query to be executed in two parts MIqry2pass selects an object and then executes a function Used only in a URL Default is set to OFF Using Other Webdriver Features 13 15 Two Pass Query Processing First Webdriver retrieves the AppPage with the following SQL statement select object from wbpages where ID mypage and path
143. e in uppercase characters The following example demonstrates how the webupper UDR tag can be invoked in an AppPage lt HTML gt lt MIVAR NAME in gt Hello World lt MIVAR gt lt webupper NAME out text Sin gt lt MIVAR gt Sout lt MIVAR gt lt HTML gt Using UDR Tags in AppPages 10 7 Creating a UDR Tag When you invoke this AppPage in a browser the browser displays the following text HELLO WORLD Creating a UDR Tag Once you have created the UDR and registered it in the database you create a UDR tag that executes the UDR by inserting a reference to the UDR into the WebUdsrs table You use AppPage Builder to insert the reference to the UDR into the WebUdrs table gt Important A routine must exist in the sysprocedures table before you use AppPage Builder to add a UDR tag the WebUdrs table AppPage Builder ensures that the values of the procid procname param types and numargs columns for the UDR in the sysprocedures table match the corresponding columns in the WebUdrs table To create a UDR tag with APB 1 Invoke APB For detailed information on this step refer to Using AppPage Builder on page 4 1 2 Click Add Object from Main Menu 3 Click User Defined Routine Tag The Add Dynamic Routine AppPage appears as shown in Figure 10 1 Select a UDR from the Routine Signature list box AppPage Builder uses the sysprocedures table to create this list box The ite
144. e of Using FORM Tag Links 3 13 How to Retrieve Large Objects 2 1 ee ee 39 15 Retrieving Large Objects By Name Iisi ei gee B15 Retrieving Large Objects By Large Object Enandles tas Bald Chapter 4 Using AppPage Builder In This Chapter fo ig a A Oras Se 4 3 Overview of AppPage Builder de AS A aie ates SS 4 3 Registering AppPage Builder in Your DDRS ua a Sieun Gy 4 4 Invoking AppPage Builder A OS 4 5 Using the URL Prefix Specially Created to invoke APB Loe g 4 6 Using Any URL Prefix Out Geis Bk aes 4 6 Creating Web Applications in AppPage Builder an ta 4 7 Multimedia Content E A A a 4 8 Administration Features eee 4 9 Adding an Extension 2 ee ee 410 iv IBM Informix Web DataBlade Module Application Developer s Guide Chapter 5 Chapter 6 Using Variables in AppPages In This Chapter Web DataBlade Module Variables User Defined Variables Vector Variables Web DataBlade Module Syston Variables Web Server and Web Browser Variables Session Variables R How Session Management ASE an Dt toa Brote a Setting Session Variables Examples of Using Session Variables Error Handling with the MI_DRIVER_ERROR Variable Using Tags in AppPages In This Chapter AppPage Tags MISQL Tag Using System Variables lo Format the SQL Results WINSTART Attribute WINSIZE Attribute RESULTS Attribute DATASET Attribute CACHERESULTS Attribute SERIAL
145. e of the extension for example Application Page or GIF Image source_table VARCHAR 18 The name of the table in which the resource is stored 1 of 2 Basics of AppPage Development 3 5 The wbExtensions Table extension html htm txt Column Name super_type sub_type ID_column content_column retrieval_method path_column o 2 o o a Al o S a 5 2 Oo Ss i N n Application wbPages text page Application wbPages text page Text wbPages text document Data Type Length VARCHAR 18 VARCHAR 18 VARCHAR 18 VARCHAR 18 INTEGER VARCHAR 18 sub_type html html plain Description The MIME supertype of the extension for example text or image The MIME subtype of the extension for example HTML or GIF The name of the column containing the resource identifier for example ID The name of the column containing the resource content for example object The retrieval method used by Webdriver when retrieving the type 1 Retrieve with WebExplode 2 Retrieve as text 3 Retrieve as large object The name of the column containing the resource path information 2 of 2 The following table shows the default extensions and the columns used by the wbExtensions table These extensions are added to the wbExtensions table when you install APB into your database xo E 2 En lt E 8 i 5 E E s 8 o o o E 2 8 ge E ID object 1 path ID object 1 path ID o
146. e of the following two values in the Value text box depending on how you are going to use the variable m If you are not going to use AppPage caching enter m If you are going to use AppPage caching enter defer 6 Finish adding the user variable as described in the IBM Informix Web DataBlade Module Administrator s Guide Session Variables A typical Web application needs a location to place search results user preferences shopping cart and other data generated by users in the course of their interactions with the application The maintenance of user private spaces for the duration of a user s interaction with a Web based system is often called session management Typically each user s session is distinguished by a unique session ID generated at the beginning of the session and embedded into the forms or URLs in all of the subsequent HTML pages returned to the client Whenever the user submits a form or clicks a button the session ID is passed in as part of the request so users can continue where they previously stopped Webdriver uses information returned by the WebExplode function to record the current values of session variables and reload them on each subse quent request from the same browser Session management allows a Web DataBlade application to assign a unique ID to a browser instance This allows Webdriver to identify that particular browser instance on subsequent requests Currently session management gives yo
147. e products and cannot confirm the accuracy of performance compatibility or any other claims related to non IBM products Questions on the capabilities of non IBM products should be addressed to the suppliers of those products All statements regarding IBM s future direction or intent are subject to change or withdrawal without notice and represent goals and objectives only This information contains examples of data and reports used in daily business operations To illustrate them as completely as possible the examples include the names of individuals companies brands and products All of these names are fictitious and any similarity to the names and addresses used by an actual business enterprise is entirely coincidental COPYRIGHT LICENSE This information contains sample application programs in source language which illustrate programming techniques on various operating platforms You may copy modify and distribute these sample programs in any form without payment to IBM for the purposes of developing using marketing or distributing application programs conforming to the application programming interface for the operating platform for which the sample programs are written These examples have not been thoroughly tested under all conditions IBM therefore cannot guarantee or imply reliability serviceability or function of these programs You may copy modify and distribute these sample programs in any form without payment to I
148. e table specified by the MI_WEBTAGSTABLE variable 1 of 2 Using Dynamic Tags in AppPages 9 7 Using System Dynamic Tags Variable Mandatory MI_WEBTAGSCACHE No attributes Attribute NAME SQL Description Specifies whether the WebExplode function should cache dynamic tags or not This variable should be set to on to turn on caching or off to turn off caching The default value is on Turn off dynamic tag caching when you are developing your AppPages to ensure that you always see the latest version of the dynamic tag and not the cached version When you deploy your application to a production environment however you should turn on dynamic tag caching to increase the performance of your Web application 2 of 2 Using System Dynamic Tags The CHECKBOXLIST RADIOLIST and SELECTLIST system dynamic tags simplify the creation of check box lists radio button lists and selection lists You can also create your own user defined dynamic tags as described in Creating User Defined Dynamic Tags on page 9 17 CHECKBOXLIST The CHECKBOXLIST system dynamic tag creates an HTML list check box based on the attributes you specify CHECKBOXLIST has the following Mandatory Description Yes Specifies the value of the NAME attribute of the check boxes in the check box list Yes Specifies the SQL statement that returns a list of items to compose the check box list 1 of 2 9 8 IBM Informix Web DataBlade M
149. e table variable It shows the column names of the requested table If you click a specific table in the page2 html AppPage you link to a third AppPage that shows the column names of the requested table If you type a specific table name in the text box and click See columns on the welcome AppPage you use the FORM tag to link directly to your third AppPage This section describes how to create that third AppPage To create the third AppPage of the application 1 Click Add Object The Add Object AppPage appears with getting started as your default project Click AppPage The Add AppPage AppPage is displayed Your getting_started project should be selected as the default project Type the name of your AppPage page3 in the Page ID text box Web DataBlade Module Tutorial 2 13 Step 6 Invoke the Application 2 14 4 Be sure Path is set to and Extension to html 5 Type the following HTML code in the AppPage text area lt my_header TITLE Web Applications Inc gt Here are the columns of the table lt b gt lt MIVAR gt Stable lt MIVAR gt lt b gt lt br gt lt br gt lt table border 1 cell_padding 0 gt lt tr gt lt td gt lt b gt Column Name lt b gt lt td gt lt tr gt lt MISQL SQL Select c colname from syscolumns c systables t where c tabid t tabid and t tabname Stable gt lt tr gt lt td gt 1 lt td gt lt tr gt lt MISQL gt lt table gt lt br gt lt my_footer
150. e_get returned NULL n return NULL data mi_routine_exec conn routineFunctDesc amp error if error MI_ERROR 14 6 IBM Informix Web DataBlade Module Application Developer s Guide Takes in an HTML data type and converts it to an LVARCHAR Input MI_CONNECTION an open connection e html the HTML data to be converted into an LVARCHAR Returns either ES NULL error during conversion E mi_lvarchar the HTML data converted into an LVARCHAR Notes Ei This example uses the WebHtmlToBuf function that is registered with the database server at the same time that the Web DataBlade x Module is registered xy html WebHtmiToBut printf execution encountered an error n return NULL mi_routine_end conn routineFunctDesc release resources return mi_lvarchar data Using DataBlade Module API Functions in AppPages 14 7 WebBurToHtml WebBufToHtml The WebBufToHtml0 API function copies the contents of an MI_LVARCHAR object into an HTML object Syntax HTML WebBufToHtml MI_LVARCHAR lvarchar_object Ivarchar_object A pointer to the MI_ LVARCHAR object to be converted into an HTML data type Usage In your C program do not call the WebBufToHtml API function directly rather use the mi_routine_get mi_routine_exec and mi_routine_end DataBlade API functions instead First use the mi_routine_get DataBlade API function to look up th
151. ease go back and enter a table name lt MIVAR NAME done gt YES lt MIVAR gt lt MIBLOCK gt lt MIBLOCK COND S EQ done NO gt You received an unexpected error lt MIVAR gt S MI_ERRORMSG lt MIVAR gt lt BR gt Please contact your administrator lt MIBLOCK gt lt HR gt lt BODY gt lt HIML gt Using Tags in AppPages 6 45 Processing Errors with Webdriver We regret to inform you that table oops does not exist 6 46 The following sample Web browser output shows what happens when the user specifies a nonexistent table Web Browser Error Processing Page E O 6 10 rror Processing http domain port hr_app webdriver Page Processing Errors with Webdriver The database server executes each AppPage within a single transaction When the WebExplode function encounters an exception during execution of an AppPage all of the SQL statements on that AppPage are rolled back The WebExplode function raises an exception when you execute a tag with an unassigned variable or incorrect tag construct The database server raises an exception when an SQL error is generated If an MIERROR tag is invoked for the exception that occurs the WebExplode function returns a XUWEA1 error code along with the text of the MIERROR message Webdriver displays the message text of the MIERROR tag returned by the WebExplode function up to an 8 KB buffer limit In the following catch_error html App
152. ects the MIME supertype and subtype and so on When you specify the source table you can specify one of the existing APB tables such as wbPages or wbBinaries Store text type objects like HTML in the wbPages table and binary objects such as video in the wbBinaries table You can also specify that the source table be a completely new table that you have previously created with DB Access or SQL editor Be sure that your table has the following two columns to identify your object m ID the name of the object m Path the path of the object 3 8 IBM Informix Web DataBlade Module Application Developers Guide How to Invoke AppPages If you store objects in a new table only objects of the associated extension can be stored in the new table In other words you cannot store more than one extension type in a new table You can however store more than one extension type in the wbPages and wbBinaries table Refer to the wbBinaries table definition in AppPage Builder Schema on page B 1 for a sample schema of a table that stores AppPage objects How to Invoke AppPages When you invoke an AppPage you retrieve it from a table in the database into your browser You can invoke an AppPage by typing a URL in a browser or specifying a URL in an AppPage to show a subsequent AppPage in your browser A URL provides a general purpose naming scheme for specifying Internet resources using a string of printable ASCII characters The follow
153. ed fileName my SoldHandle select TMPFIL 1 eval Scmd n executes command use quotes execute select SoldHandle seek TMPFIL 0 0 die seek failed TMPFIL sub REAPER Swaitedpid wait SSIG CHLD amp REAPER processRequest INPUT Sattributes variables attributes passed in Sbody the body of the tag OUTPUT sresults variables to return Sbody bodyResutl NOTE input and output are going through global name space sub processRequest _ Sattributes REQUEST undef SbodyResult SWITCH UPPER amp amp do SbodyResult uc execute last SWITCH y RAWPERL amp amp do SfileName temp Sport tmp Sexecute in undef results execute string may create results SfileHandle amp executeCommand fileName Sattributes Sexecute while lt fileHandle gt send back results SbodyResult _ close fileHandle Using Advanced AppPage Tags 7 19 Sample Perl Program SERVE pl last SWITCH y SbodyResult REQUEST _ is unknown 7 20 IBM Informix Web DataBlade Module Application Developer s Guide Using Variable Processing Functions in AppPages In This Chapter Variable Processing Functions Using Variable Expressions in AppPages s Using Arithmetic Functions in Variable Expressions Using SEPARATE and REPLACE in Variable Expressions Example of SEPARATE and REPLACE oe Using Varia
154. ed in all other databases that reference the changed table or the returned data might be out of date Due to the probability of error in such maintenance it is recommended that you do not use the CACHERESULTS attribute with ISTAR queries Maximum Size of a Results Cache Each results cache has a maximum size If the total size of all entries in a cache has reached the maximum then the least recently used entry is thrown out until there is room for a new entry The default maximum size of a cache is 32 KB Using Tags in AppPages 6 19 SERIAL and SERIAL8 Attributes To change the maximum size insert a new row in the wbInfo table setting the name column to WebResultsCacheSize and the value column to the desired maximum size If the database does not have a wbInfo table or the wbInfo table does not have a WebResultsCacheSize row then the WebExplode function uses the default 32 KB maximum size Disabling the Cache While Updating Tables It is not possible to implement all the standard isolation levels with the results cache For this reason it is recommended that you disable the results cache feature while a table is being updated Do this by changing the maximum cache size to 0 in the wbInfo table then setting it back after the update is finished SERIAL and SERIAL8 Attributes You use the SERIAL and SERIAL attributes to return the value that the database server automatically inserts into a SERIAL or SERIAL8 column after you exec
155. ed trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States and other countries Windows Windows NT and Excel are either registered trademarks or trade marks of Microsoft Corporation in the United States and or other countries UNIX is a registered trademark in the United States and other countries licensed exclusively through X Open Company Limited Other company product and service names used in this publication may be trademarks or service marks of others D 4 IBM Informix Web DataBlade Module Application Developers Guide anchor variable Apache Webdriver AppPage AppPage Builder APB AppPage tags CGI Webdriver Glossary Variable in an AppPage whose value is based on the URL prefix used to invoke the AppPage You do not set the anchor variable in your AppPage rather Webdriver automatically generates the value You can use anchor variables to link one or more App Pages in the same Web application WEB_HOME is the Web DataBlade module anchor variable The implementation of Webdriver that uses the Apache API to connect to databases and execute AppPages See also Webdriver CGI Webdriver ISAPI Webdriver NSAPI Web driver An HTML page that includes AppPage tags and functions that dynamically execute SQL statements to query the database and format the results A development tool packaged with the Web DataBlade module that allows you to create and u
156. efer to Using the MIEXEC Tag in an AppPage on page 7 11 NAME No Specifies the name of the variable to which the formatted results of the MIEXEC tag are assigned If NAME is not specified the results are output 1 of 2 Using Advanced AppPage Tags 7 9 SERVICE Attribute Attribute Mandatory Description COND No Tag is enabled only if this condition evaluates to true nonzero ERR No Specifies how an error should be processed Because multiple errors can occur on an AppPage use the ERR attribute to link the error processing to a particular MIERROR tag user_attributel No Specifies the name of a user defined attribute that is passed to the Perl program specified by the SERVICE attribute You can specify more than one user defined attribute 2 of 2 For more information on the NAME attribute see NAME Attribute on page 6 28 For more information on the COND attribute see MIBLOCK Tag on page 6 29 For more information on the ERR attribute see MIERROR Tag on page 6 40 gt Important All the examples in the description ofthe MIEXEC tag use Perl However any program that can communicate via sockets can be used including Python and Rexx SERVICE Attribute The SERVICE attribute of the MIEXEC tag specifies the Perl program you want to execute from your AppPage In particular the attribute specifies the commands needed to first change to the directory that contains the Perl
157. elect1 html AppPage illustrates the use of column variables lt HTML gt lt HEAD gt lt TITLE gt Simple Select 1 lt TITLE gt lt HEAD gt lt BODY gt lt MISQL SOL select first_name last_name title from staff gt lt B gt 1 2 lt B gt 3 lt BR gt lt MISQL gt lt BODY gt lt HTML gt Using Tags in AppPages 6 7 Using System Variables to Format the SQL Results client lt HTML gt lt HEAD gt lt TITLE gt Simple Select 1 lt TITLE gt lt HEAD gt lt BODY gt lt B gt John Somebody lt B gt Senior Consultant lt BR gt lt B gt Joe Average lt B gt Consultant lt BR gt lt BODY gt lt HTML gt Web Browser Simple Select 1 URL http domain port hr_app Mlval select1 html John Somebody Senior Consultant Joe Average Consultant Mark Markup Software Development Engineer A 4 Specifying a Row Index lt HTML gt lt HEAD gt lt TITLE gt Simple Select 2 lt TITLE gt lt HEAD gt lt BODY gt lt TABLE BORDER gt lt MISQL gt lt TABLE gt lt BODY gt lt HTML gt 6 8 IBM Informix Web DataBlade Module Application Developer s Guide lt B gt Mark Markup lt B gt Software Development Engineer lt BR gt The following illustration shows sample Web browser output The WebExplode function returns the following sample output to the Figure 6 1 Simple Select 1 To specify a row index use the format where is a number
158. er AppPage caching is enabled or disabled Set to ON to enable AppPage caching and OFF to disable AppPage caching The default value is OFF cache_directory MI_WEBCACHEDIR Yes Specifies the full pathname of the directory on the Web server computer in which cached AppPages and large objects are placed Tf this variable is not set neither AppPages nor large objects are cached cache_page_buckets New in Version 4 0 No Specifies the number of subdi rectories per AppPage created under the directory specified by cache_directory The default is one subdirectory per AppPage Set this variable only if you intend on caching AppPages that might have over 1000 different versions 1 of 4 C 16 IBM Informix Web DataBlade Module Application Developers Guide Webdriver Variable Name of Variable in Versions 3 3 and Previous Enabling AppPage Caching Description cache_page_life MI_WEBPAGELIFE Specifies the length of time after which an AppPage is refreshed from the database Set cache_page_life in units of seconds s or s hours h or H or days d or D For example the value 5d indicates five days cache_admin MI_WEBCACHEADMIN Specifies the name of the Cache Administration AppPage The Cache Administration AppPage is not stored in the database but is an internal AppPage managed by Webdriver When Mlval is set to this value Webdriver invokes this AppPage so you can add delete purg
159. er in this section When you add a Web browser or Web server variable to your Webdriver configuration you can set the variable to one of the following two possible values Indicates that you are not going to enable AppPage caching for the AppPages that access the Web browser or Web server variable defer Indicates that you are going to enable AppPage caching for the AppPages that access the Web browser or Web server variable and you must always access the variable as a deferred variable If you set the Web browser or Web server variable for your Webdriver config uration to defer you must refer to the variable in your AppPage by prepending it with the defer keyword and enclosing it in the lt MIDEFERRED gt lt MIDEFERRED gt tags For example to refer to the HTTP_USER_AGENT Web browser variable in your AppPage you must use the following syntax lt MIDEFERRED gt lt MIVAR gt The value of HTTP_USER_AGENT is defer HTTP_USER_AGENT lt MIVAR gt lt MIDEFERRED gt For more information about the MIDEFERRED tag using the defer keyword refer to MIDEFERRED Tag on page 7 7 The following env_var AppPage displays the value for the HTTP_USER_AGENT Web browser variable lt HTML gt lt HEAD gt lt TITLE gt Display a Variable lt TITLE gt lt HEAD gt lt BODY gt lt HR gt The value of the HTTP_USER_AGENT environment variable is lt MIVAR gt HTTP_USER_AGENT lt MIVAR gt lt HR gt
160. ers stored in the WebUdrs table use the following syntax lt udrname NAME out COND condition gt 10 6 IBM Informix Web DataBlade Module Application Developer s Guide Specifying a UDR Tag in an AppPage The following table describes the elements of the two previous syntax specifications Element udrname NAME COND paramN valueN Description Specifies the name of the UDR tag being invoked This must match the name in the id column of the WebUdrs table Specifies that the results of the UDR tag invocation should be stored in the out variable The results are stored as a string If you do not specify an out variable then the UDR tag writes the results directly to the AppPage Specifies that the UDR tag is invoked only if condition evaluates to true nonzero The name of the Nth parameter of the UDR Parameters are passed to the UDR in the same order in which they appear in the UDR tag invocation The value of the parameter paramN The element valueN is either a variable containing the value to be sent to the UDR or the value itself with no embedded spaces Indicates more name value pairs of the form param value where param is the name of the parameter of the UDR and value is the value of the parameter For example assume you have added a webupper UDR tag to the WebUdrs system table that executes the webupper UDR The webupper routine takes one argument of data type HTML and returns an HTML data typ
161. es are STRONE and STRTWO The Perl program interprets these attributes with the attributes hash variable The results of calculating the length of the STRTWO attribute which is the value of the INVAR variable are returned to the AppPage as the OUTVALUE variable via the results hash variable The contents of the OUTVALUE variable are accessible with the MIVAR tag 7 14 IBM Informix Web DataBlade Module Application Developer s Guide Sample Perl Program SERVE pl Sample Perl Program SERVE pl This section provides the sample Perl program called SERVE pl that is used in all the examples of this section Although you can write your own Perl program to use with the MIEXEC tag it is recommended that you start with the SERVE pl program in this section and modify it to fit your needs The SERVE pl program uses sockets to communicate with the Web DataBlade module as must all programs called by the MIEXEC tag The following example shows how to specify the SERVE pl program in an MIEXEC tag and pass it Perl code lt MIVAR NAME SRVC gt cd local perlscripts usr local bin perl SERVE p1 lt MIVAR gt lt MIEXEC SERVICE SRVC REQUEST RAWPERL gt print This is Perl output An lt MIEXEC gt In the example the SERVE pl Perl program is located in the directory Nocal perlscripts and the Perl executable is located in the directory user local bin Using Advanced AppPage Tags 7 15 Sample Perl Program SERVE pl
162. es of the HTML object are stored in the row any portion of the HTML object that exceeds 7500 bytes is stored as a smart large object The implementation of Webdriver that uses the Netscape API to connect to databases and execute AppPages See also Webdriver Apache Webdriver CGI Webdriver ISAPI Webdriver The file that contains parameters for configuring the Informix database server An example of a parameter in the ONCONFIG file is SBSPACENAME Glossary 3 processing variable RAW Mode sbspace server side includes smart large object sqlhosts file system dynamic tag UDR tag A variable in an AppPage that contains processing information about the execution of an SOL statement such as the number of rows or columns returned from a SELECT statement An AppPage accesses processing vari ables after an MISQL tag executes its SOL statement A way to display an AppPage stored in the database without expanding the AppPage tags You can also display the variables in an AppPage and identify where variable assignments are made RAW mode is useful for debugging A logical storage area that contains one or more chunks that store only smart large object data A mechanism for including dynamic text in AppPages Server side includes are special command codes that are recognized and interpreted by the Web server their output is placed in the AppPage before the AppPage is sent to the browser Server side includes can be used
163. es to share AppPage segments For example a TITLE dynamic tag might contain a standard title AppPage segment common to all the AppPages that make up a particular Web appli cation Each AppPage then uses the same TITLE dynamic tag for its title See also system dynamic tag user defined dynamic tag An application environment that allows Informix application programming interfaces APIs and database servers to handle different languages cultural conventions and code sets Developers use the GLS libraries to manage all string currency date and time data types in their code Using GLS you can add support for a new language character set and encoding by editing resource files without access to the original source code and without rebuilding the DataBlade module or client software The Informix environment variable that specifies the directory in which Informix products are installed The Informix environment variable that specifies the name of the Informix database server to which you want to connect The implementation of Webdriver that uses the Microsoft Windows NT Inter net Information Server API to connect to databases and execute AppPages See also Webdriver Apache Webdriver CGI Webdriver NSAPI Webdriver 2 IBM Informix Web DataBlade Module Application Developers Guide large object locale MI_DRIVER _ERROR MI_WEBCONFIG multibyte code set multirepresenta tional data type NSAPI Webdriver ONCONFIG file
164. escription of 1 10 invoking 4 5 invoking an application using 2 14 linking AppPages using 2 10 overview of 4 3 registering 4 4 using multimedia content with 4 8 using URL prefix to invoke 4 6 AppPage Builder APB C 27 AppPage caching Webdriver variables to enable C 16 AppPage tags MICOMMENT 6 49 MIDEFERRED C 19 AppPage level security configuring C 14 Webdriver variables to enable C 14 AppPages accessing Web server variables in 5 8 and WebExplode function 1 4 1 5 calling recursively C 29 creating with AppPage Builder 4 7 elements of 3 4 in architecture diagram 1 6 securing with NSAPI Webdriver C 12 specifying largest C 9 tags 1 9 using tags and attributes in 1 5 Arithmetic variable processing functions 8 3 8 10 auth_cache Webdriver variable C 11 auth_crypt_udr Webdriver variable C 13 AUTH_TYPE Web server variable 5 8 A BC DEFGH Boldface type Intro 7 C CACHERESULTS attribute of MISQL tag 6 6 6 18 cache_admin Webdriver variable 7 5 C 17 cache_admin_password Webdriver variable C 18 cache_buckets Webdriver variable C 20 cache_directory Webdriver variable C 16 C 20 cache_maxsize Webdriver variable C 20 cache_page Webdriver variable C 16 cache_page_buckets Webdriver variable C 16 cache_page_debug Webdriver variable C 19 cache_page_life Webdriver variable C 17 cache_page_timestamp Webdriver variable C 18 Caching 6 18 C 26 CHECKBOXLIST system dynamic tag 9 8 Client file upload 13 7 Col
165. essor ignores tags that it does not recognize including Web DataBlade module tags Like other SGML processing tags the Web DataBlade module tags and attributes are not case sensitive You can use uppercase letters lowercase letters or any combi nation of the two The text and many of the examples in this manual show function and data type names in mixed lettercasing uppercase and lowercase Because IBM Informix Dynamic Server is case insensitive you do not need to enter function names exactly as shown you can use uppercase letters lowercase letters or any combination of the two IBM Informix Web DataBlade Module Application Developer s Guide Icon Conventions Icon Conventions Throughout the documentation you will find text that is identified by several different types of icons This section describes these icons Comment Icons Comment icons identify three types of information as the following table describes This information always appears in italics Icon Label Description Warning Identifies paragraphs that contain vital instructions cautions or critical information Important Identifies paragraphs that contain significant o information about the feature or operation that is being described Tip Identifies paragraphs that offer additional details or shortcuts for the functionality that is being described Platform Icons Platform icons identify paragraphs that contain platform
166. exceptions variable to on and the WebExplode function does not invoke an MIERROR tag for the exception that occurs the database exception message returned by the WebExplode function is displayed by Webdriver If you set the show_exceptions variable to off and the WebEx plode function does not invoke an MIERROR tag for the exception that occurs Webdriver displays the HTTP 1 0 500 Server error message The following process_error html AppPage has no MIERROR tag lt HEAD gt lt TITLE gt Error Processing Page lt TITLE gt lt HEAD gt lt MIVAR gt STEST_VAR lt MIVAR gt Using Tags in AppPages 6 47 Processing Errors with Webdriver The following illustration shows sample output when the TEST_VAR variable has not been assigned and show_exceptions is set to on Web Browser http webserver hr map webdriver Mlval process_err http domain port hr_app Mlval process_error html Exception from Informix XUWEB1 937 Undefined variable TEST_VAR Figure 6 12 Show Exceptions On The following illustration shows sample output when the TEST_VAR variable has not been assigned and show_exceptions is set to o f Web Browser Webdriver Error Message http domain port hr_app Mlval process_error html HTTP 1 0 500 Server error 6 48 IBM Informix Web DataBlade Module Application Developer s Guide Figure 6 13 Show Exceptions Off MICOMMENT Tag MICOM MENT Tag Use the
167. f user defined tags usage Includes cache hits Shows SQL statement being executed by MISQL tag Shows messages communicated to Webdriver Reserved for system usage Watches how MIDEFERRED and deferred variables are being used Traces direct UDR invocation Traces MI_EXEC Debugging Web DataBlade Module Applications A 7 MI_ WEBEXPLOG Trace File A 8 The trace value is additive therefore you can turn on multiple settings simultaneously For example if you set MI_WEBEXPLEVEL to 40 the WebEx plode function generates trace information for both tags and variable access Add 1 to the value of MI_WEBEXPLEVEL to generate output within your AppPages as HTML comments The output contains the session ID The WebExplode function writes the output to the trace file Important Ifyou add 1 to the value of MI_WEBEXPLEVEL to generate output within your AppPages as HTML comments the additional text within your HTML might change how the Web browser renders your AppPage MI_WEBEXPLOG Trace File When you enable tracing the WebExplode function writes the information to the trace file specified by the MI_WEBEXPLOG variable If you do not set MI_WEBEXPLOG or if the server cannot write to the specified file the server creates a file in the tmp directory with a tre file extension You can also write your own message to the trace file using the TRACEMSG variable processing function For example you can log errors to
168. fault_project VARCHAR 30 NOT NULL REFERENCES wbProjects def_object_type VARCHAR 40 NOT NULL textarea_width INTEGER DEFAULT 80 textarea_height INTEGER DEFAULT 20 versioning CHAR DEFAULT t web_lint INTEGER DEFAULT 2 PRIMARY KEY name AppPage Builder Schema B 13 The wbObjectTypes Table B 14 The wbObjectTypes Table The wbObjectTypes table stores the types of objects you can add to your Web application using AppPage Builder The Add Object AppPage of AppPage Builder lists seven types of objects you can add to your application AppPage Audio Document Dynamic Tag Image User Defined Routine and Video Each of these object types corresponds to a single row in the wbObjectTypes table Each of these object types in turn maps to one or more rows in the wbExtensions table based on the MIME supertype of each extension AppPage Builder uses these relations between the wbObjectTypes and wbExtensions tables to determine which extensions correspond to a particular object type For example the Image object type can have the following four extensions bmp jpeg jpg or gif The following CREATE TABLE statement describes the schema of the wbUsers table CREATE TABLE wbObjectTypes object_type VARCHAR 40 NOT NULL super_type VARCHAR 40 NOT NULL page_suffix VARCHAR 40 NOT NULL PRIMARY KEY object_type IBM Informix Web DataBlade Module Application Developer s Guide Web DataBlade Module Variables
169. ferred section Using Advanced AppPage Tags 7 7 The defer Prefix The defer Prefix When Webdriver caches an AppPage it uses variables sent to the AppPage as a key to create the name of the file that is stored in the cache directory Variables in the dynamic content of the MIDEFERRED tag however might change each time the AppPage is called These types of variables therefore should not be part of the key used to create and find files in the AppPage cache To specify to Webdriver that a variable should not be used in the key prefix the variable with the defer keyword For example the following test_page html AppPage uses the MIDEFERRED tag lt MIVAR gt Page is MIval lt MIVAR gt lt MIDEFERRED gt lt MIVAR gt Total is defer total lt MIVAR gt lt MIDEFERRED gt Assume the page is requested in succession with the following URLs url_mapped_path webdriver MIval test_page defer total 100 url_mapped_path webdriver MIval test_page defer total 101 url_mapped_path webdriver MIval test_page defer total 102 All three URLs reference the same cached page but each request causes the deferred section to be re executed with a unique value of defer total The results are as follows Page is test_page Total is 100 Page is test_page Total is 101 Page is test_page Total is 102 Important Nesting of the MIDEFERRED tag is not allowed 7 8 IBM Informix Web DataBlade Module Application De
170. first_name varchar 40 last_name varchar 40 title varchar 40 onsite boolean department varchar 40 3 Load data into the employees table 4 Execute the following procedure for each session to store new lines as the HTML data type EXECUTE PROCEDURE ifx_allow_newline t If you want to disallow new lines execute the following procedure EXECUTE PROCEDURE ifx_allow_newline f Using DataBlade Module Functions in AppPages 12 5 WebExplode 5 Insert an AppPage into the web_apps table The emp_list AppPage contains an MISQL tag that retrieves data from the employees table as shown here EXECUTE PROCEDURE ifx_allow_newline t insert into web_apps values emp_list employee listing lt HTML gt lt HEAD gt lt TITLE gt Employee List lt TITLE gt lt HEAD gt lt BODY gt lt H2 gt Current list of employees and job titles lt H2 gt lt MISQL SQL Select first_name last_name title from employees gt lt B gt 1 2 lt B gt 3 lt BR gt lt MISQL gt lt BODY gt lt HIML gt i Retrieve the AppPage using the WebExplode function The WebExplode function executes the query within the MISQL tag and formats the results according to the specifications in the MISQL tag SELECT WebExplode app_frm FROM web_apps WHERE app_id emp_list The WebExplode function returns the following HTML HTML gt HEAD gt lt TITLE gt Employee List lt TITLE gt
171. for example to include a date or time stamp in the text of the AppPage A large object that m Is stored in an sbspace a logical storage area that contains one or more chunks Has read write and seek properties similar to a UNIX file Is recoverable Obeys transaction isolation modes Can be retrieved in segments by an application Smart large objects include CLOB and BLOB data types An Informix file that contains information that lets a client application locate and connect to an Informix database server anywhere on a network Dynamic tags provided by the Web DataBlade module that allow you to reuse existing HTML to simplify the construction and maintenance of Web applications Examples of system dynamic tags are CHECKBOXLIST RADI OLIST and SELECTLIST See also dynamic tag user defined dynamic tag See user defined routine tag 4 BM Informix Web DataBlade Module Application Developers Guide URL prefix user defined dynamic tag user defined routine user defined routine tag variable expression variable processing function vector variable virtual processor walking window Part of a URL that client applications send to the Web server to invoke HTML pages execute CGI programs such as the CGI Webdriver call Web server plug ins such as the NSAPI Apache or ISAPI Webdriver and so on The Web server interprets the URL prefix to perform the appropriate action depending on how you have configured
172. from 1 to the maximum number of rows in the result set If you do not specify a row index 1 is assumed The highest row index dictates the size of the data window that is displayed The following select2 html AppPage illustrates column and row formatting specifications and the corresponding output lt MISQL SOL select first_name last_name from staff gt lt TR gt lt TD gt 1 2 lt TD gt lt TD gt 1 2 2 2 lt TD gt lt TR gt Using System Variables to Format the SQL Results The WebExplode function returns the following sample output to the client lt HTML gt lt HEAD gt lt TITLE gt Simple Select 2 lt TITLE gt lt HEAD gt lt BODY gt lt TABLE BORDER gt lt TR gt lt TD gt John Somebody lt TD gt lt TD gt Joe Average lt TD gt lt TR gt lt TR gt lt TD gt Mark Markup lt TD gt lt TD gt NOVALUE NOVALUE lt TD gt lt TR gt lt TABLE gt lt BODY gt lt HTML gt The following illustration shows sample Web browser output Web Browser Simple Select 2 e faa imple Selec URL http domain port hr_app Mlval select2 html John Somebody Joe Average 4 Mark Markup NOVALUE NOVALUE The WebExplode function processes the preceding data set two rows at a time because 2 is the highest row index specified If 3 was the highest row index specified the data would be processed three rows at a time and so on Disp
173. g file C 20 New in Version 4 0 Specifies the full pathname of the log file to which Webdriver messages are written IBM Informix Web DataBlade Module Application Developer s Guide Variable session Enabling Use of Session Variables in AppPages Enabling Use of Session Variables in AppPages To enable the use of session variables in your AppPages use the Web DataBlade Module Administration Tool to set the following Webdriver variables Name of Variable in Versions 3 3 and Previous Mandatory MI_WEBSESSION Yes Description This variable allows you to select the method for binding a session ID to the browser This variable can have values of url cookie or auto If setto url then the session ID is bound to any dynamic anchor variable contained within the page Typically this variable would be WEB_HOME If set to cookie the session ID is tracked with a variable sent back to the browser as a cookie If you select auto Webdriver automatically determines which method is best to use session_home MI_WEBSESSIONHOME _ Yes if using auto orurl This variable identifies which configu ration file variable is used by your application to anchor HREF tags For example if your application uses WEB_HOME as its anchor WEB_HOME is the value set for this variable If multiple values are required for this variable they should be separated by commas 1 of 2 Web DataBlade Module Variables C 21 Enabl
174. ge the WebExplode function generates the following XML lt xml version 1 0 gt lt TABLE_DATA gt lt ROW_DATA ID 1 gt lt ID_DATA gt 1 lt ID_DATA gt lt NAME_DATA gt Mary Smith lt NAME_DATA gt lt ROW_DATA gt lt ROW_DATA ID 2 gt lt ID_DATA gt 2 lt ID_DATA gt lt NAME_DATA gt John Grant lt NAME_DATA gt lt ROW_DATA gt lt TABLE_DATA gt IBM Informix Web DataBlade Module Application Developer s Guide Generating XML Formatted Data In this example you specify all the XML tags such as lt ROW_DATA gt and lt TABLE_DATA gt in the standard way of using the MISOL AppPage tag Using Attributes of the MISQL AppPage Tag Starting with Version 4 00 UC2 of the Web DataBlade module you can use XML specific attributes of the MISOL AppPage tag to automatically generate an XML stream with default XML tags The following table describes these XML specific attributes MISQL Attribute Description XMLDOC Specifies the DOC type of the generated XML stream You must specify this attribute for the WebExplode function to generate an XML stream XMLROW Specifies the name of the XML tag that delineates rows If you do not specify this attribute the WebExplode function generates the default lt ROW gt and lt ROW gt tags XMLVERSION Specifies the version of XML If you do not specify this attribute the default is 1 0 The following AppPage snippet shows how to use these attributes
175. getting_started project should be selected as the default project 3 Type the name of your AppPage welcome in the Page ID text box Be sure Path is set to and Extension is set to html 4 Type the following HTML code in the AppPage text area lt my_header TITLE Web Applications Inc gt lt center gt lt hl gt Welcome to Web Applications Inc lt h1 gt lt center gt You can click lt a href lt MIVAR gt SWEB_HOME lt MIVAR gt MIval page2 html gt here lt a gt to see a list of all the non system tables in your database lt hr gt Or enter the name of a table in the text box to see its columns lt br gt lt FORM METHOD post ACTION lt MIVAR gt SWEB_HOME lt MIVAR gt gt lt MIVAR NAME table gt lt MIVAR gt lt MIVAR gt lt INPUT TYPE INPUT SIZE 40 NAME table VALUE Stable gt lt MIVAR gt lt INPUT TYPE SUBMIT VALUE See columns gt lt INPUT TYPE HIDDEN NAME MIval VALUE page3 html gt lt FORM gt lt my_footer gt 5 Click Save Notice the syntax in the previous HTML for invoking the my_header and my_footer dynamic tags in the AppPage Also notice that this AppPage has two methods of linking to a subsequent AppPage the ANCHOR tag and the FORM tag The ANCHOR tag method uses the following syntax You can click lt a href lt MIVAR gt SWEB_HOME lt MIVAR gt MIval page2 html gt here lt a gt to see a list of all the non system tables in your database The FORM tag method uses
176. gs This means that by default the WebExplode function looks in the webTags table when it invokes a dynamic tag AppPage Builder however stores dynamic tags in the wbTags table For this reason if you use AppPage Builder to create your AppPages and user defined dynamic tags you must set the variable MI_WEBTAGSTABLE to wbTags in your Webdriver configuration This ensures that the WebExplode function looks in the wbTags table and not the webTags table for dynamic tags The webTags system table is described in the IBM Informix Web DataBlade Module Administrator s Guide The following CREATE TABLE statement describes the schema of the wbTags table CREATE TABLE wbTags ID VARCHAR 30 description VARCHAR 254 parameters VARCHAR 254 class VARCHAR 64 current_version INTEGER last_changed datetime year to second last_changed_by VARCHAR 30 last_locked datetime year to second last_locked_by VARCHAR 30 object HTML wizData BLOB PRIMARY KEY ID CONSTRAINT wbTagld PUT object in 2 wizData in 2 AppPage Builder Schema B 7 The wb TagVersions Table B 8 Versions table CREATE TABLE wbTagVersions PUT object in 2 wizData in IBM Informix Web DataBlade Module Application Developer s Guide The wbTagVersions Table 2 The wbTag Versions table stores previous versions of dynamic tags The wbTag Versions table has a schema similar to the wbTags table but with
177. he purpose of enabling i the exchange of information between independently created programs and other programs including this one and ii the mutual use of the information which has been exchanged should contact IBM Corporation J74 G4 555 Bailey Ave P O Box 49023 San Jose CA 95161 9023 U S A Such information may be available subject to appropriate terms and condi tions including in some cases payment of a fee The licensed program described in this information and all licensed material available for it are provided by IBM under terms of the IBM Customer Agreement IBM International Program License Agreement or any equiv alent agreement between us D 2 IBM Informix Web DataBlade Module Application Developers Guide Any performance data contained herein was determined in a controlled environment Therefore the results obtained in other operating environ ments may vary significantly Some measurements may have been made on development level systems and there is no guarantee that these measure ments will be the same on generally available systems Furthermore some measurements may have been estimated through extrapolation Actual results may vary Users of this document should verify the applicable data for their specific environment Information concerning non IBM products was obtained from the suppliers of those products their published announcements or other publicly available sources IBM has not tested thos
178. he IBM Informix Web DataBlade module It includes the following topics m What Is the Web DataBlade Module following m Product Architecture on page 1 4 m Product Features on page 1 9 What Is the Web DataBlade Module The Web DataBlade module is a collection of SQL functions data types tags and client applications that enables you to create Web applications that dynamically retrieve data from an Informix database In typical Web database applications most of the logic is in gateway appli cation code written in Perl Tel or C This Common Gateway Interface CGI application connects to a database builds and executes SQL statements and formats the results Using the Web DataBlade module you need not develop a CGI application to dynamically access database data Instead you create HTML pages that include Web DataBlade module specific tags also called AppPage tags and functions that dynamically execute the SQL statements you specify and format the results These pages are called Application Pages AppPages The types of data you retrieve can include traditional data types as well as HTML image audio and video data Overview 1 3 Product Architecture AppPages are themselves stored in the database A Web application that uses the Web DataBlade module therefore first retrieves the AppPage from the database then passes the AppPage through an SOL function that interprets the special AppPage tags and fun
179. he Netscape Web server Microsoft Internet Information Server and Apache Web Server respectively and they eliminate CGI process overhead The Web DataBlade Module Administration Tool a Web DataBlade module application provides a user interface to create and update Webdriver mappings and configurations A subset of the examples in this guide and the IBM Informix Web DataBlade Module Administrator s Guide are available in the directory INFORMIXDIR extend web version examples where INFORMIXDIR refers to the main Informix directory and version refers to the current version of the Web DataBlade module installed on your computer Important In some examples in this guide long lines of code wrap to accommodate the fonts used in the guide rather than at the most logical places for the code Therefore it is not recommended that you follow these examples exactly when you write your code 1 10 IBM Informix Web DataBlade Module Application Developer s Guide Before You Begin Before You Begin Before you begin developing AppPages you or your Web DataBlade module administrator must have previously performed certain administrative tasks to set up the correct development environment In particular this guide is written with the assumption that you or your Web DataBlade module administrator have Installed the Web DataBlade module on your database server Created a database with logging enabled Registered the Web DataBlade module in yo
180. he encrypted password in the Mlusertable table If they match then the user is authenticated If set to OFF default value then Webdriver does not encrypt the password 2 of 2 Web DataBlade Module Variables C 13 Enabling Basic AppPage Level Security Enabling Basic AppPage Level Security To configure AppPage level authorization use the Web DataBlade Module Administration Tool to set the Webdriver variables listed in the following table Name of Variable in Variable Versions 3 3 and Previous Mandatory Description MIpagelevel Same Yes Specifies the name of the INTEGER column of the table that stores AppPages that contains the access level of the AppPage MI_WEBACCESSLEVEL Same Yes Specifies the access level of all users for a particular Webdriver configuration redirect_url MI_WEBREDIRECT No Specifies the URL to redirect users to if they do not have access to the AppPage they attempt to retrieve error_page MI_WEBERRORPAGE No 0 14 IBM Informix Web DataBlade Module Application Developer s Guide Set to the value of the AppPage that contains error handling routines Variable lo_query_string Customizing the Query to Retrieve Large Objects Customizing the Query to Retrieve Large Objects To customize the query that Webdriver uses to retrieve large objects add the Webdriver variables described in the following table to your Webdriver configuration using the Web DataBlade Modu
181. he following requests specified with the REQUEST user defined attribute of the MIEXEC tag m RAWPERL Executes the text between the lt MIEXEC gt and lt MIEXEC gt tags as Perl code m UPPER Converts the text between the lt MIEXEC gt and lt MIEXEC gt tags to uppercase In each example m Thename of the directory that contains the SERVE pl Perl program is Nocal perlscripts m The perl binary that executes Perl programs is located in the directory usr local bin The following example shows how to use the SERVE pl Perl program to convert the text between the lt MIEXEC gt and lt MIEXEC gt tags to uppercase lt MIVAR NAME SRVC gt cd local perlscripts usr local bin perl SERVE p1 lt MIVAR gt lt MIEXEC SERVICE SRVC REQUEST UPPER gt This text when part of the MIEXEC tag is in MiXeD cAsE lt MIEXEC gt The above sample AppPage returns the following text to the browser THIS TEXT WHEN PART OF THE MIEXEC TAG IS IN MIXED CASE In this example the SERVICE attribute specifies how to find and execute the SERVE pl program The REQUEST attribute specifies that the parameter REQUEST with a value of UPPER be sent to the SERVE pl program The body of the MIEXEC tag This text when part of the MIEXEC tag is in MiXeD cAsE is sent to the SERVE pl program and is converted to uppercase The output of the SERVE pl program is then sent to
182. he fourth field can be set to yes or no it tells whether or not Webdriver passes the variable to the WebExplode function Current Value The final field is the current value of the variable Using WebLint Use the WebLint function to find syntax errors within AppPage tags WebLint is described in WebLint on page 12 8 Enabling WebExplode Tracing Use the Web DataBlade Module Administration Tool to set the following variables for your Webdriver configuration to enable logging of the WebEx plode function trace information Variable Mandatory Content MI_WEBEXPLEVEL Yes Enables WebExplode function tracing MI_WEBEXPLOG No File to which WebExplode messages are written A 6 IBM Informix Web DataBlade Module Application Developers Guide MI_ WEBEXPLEVEL Trace Settings MI_WEBEXPLEVEL Trace Settings The following table lists the MI_WEBEXPLEVEL trace settings Trace Value 1 Information Displayed Lowest granularity HTML output on entry into major routines such as WebExplode Medium granularity Message output on entry to all functions Highest granularity Message output for internal loops The granularity trace values in the preceding table can be applied to each of the components listed in the following table Trace Value 8 16 32 64 128 256 1024 2048 4096 Information Displayed Watches variable access Traces extended variable processing functions Shows details o
183. he value of the INDEX TO or STEP attributes does not affect loop processing after it has commenced Using Tags in AppPages 6 33 Loop Processing The following flowchart illustrates the program logic for the FOR loop Figure 6 6 FOR Loop Processing Process body of loop Increment decrement INDEX by STEP 6 34 IBM Informix Web DataBlade Module Application Developer s Guide Loop Processing FOREACH Loop Processing The FOREACH loop uses the following two attributes of the MIBLOCK tag Attribute Description INDEX Variable used to iterate through the elements of the vector variable FOREACH Name of vector variable If it is a normal variable then it is treated as a vector variable with one element The FOREACH loop is entered if the attribute is present Once the loop is entered the entire body of the MIBLOCK tag is processed for the first element in the vector variable Then as long as there are more elements in the variable the body of the MIBLOCK tag is processed When there are no more elements in the variable the loop is exited and execution continues at the terminating tag The following example uses the MIVAR tag to first create a vector variable called vec that has three elements hard green expensive The example then loops through the body of the MIBLOCK tag three times once for each element in the vector variable lt MIVAR NAME vec 1 gt hard lt MIVAR gt lt MIVAR NAME vec 2
184. his variable is not set the connection is made using the INFOR MIXSERVER database server config name Yes The name of the Webdriver configuration to use The Webdriver configuration is stored in the WebConfigs system table in the database specified by the database variable config security No When set to ON security is enabled for this Webdriver mapping which means that only the user specified by the config_user variable in the Global section of the web cnf file can use this Webdriver mapping The config_security variable should appear only in Webdriver mappings used to invoke the Web DataBlade Module Administration Tool 2 of 2 Web DataBlade Module Variables C 5 Webdriver Variables Stored in the Database Webdriver Variable connection_life Webdriver Variables Stored in the Database This section describes the Webdriver variables that are stored in the database as part of a Webdriver configuration These include both schema related Webdriver variables and feature related Webdriver variables Managing Webdriver Connections to the Database To modify the behavior of Webdriver connections to the database for specific Webdriver configurations use the Web DataBlade Module Administration Tool to set the Webdriver variables described in the following table Name of Variable in Versions 3 3 and Previous Mandatory Description MI_WEBRECONNECT No Specifies the life of a connection or in other words the maximum
185. hs BU Bk te O27 NAME Attribute te it OL ge eek kon rd a ra 26 28 DEFAULT Attribute 2 a 6 28 COND Attribute 629 ERR Attribute a e 6 29 MIBLOCK Tag lt s ww ww eee 6 29 ERR Attribute 6 31 COND Attribute ee 6 31 Loop Processing a ee ee ee o ee 6 32 FOR Loop Processing bk ai tbe A ae te ude CO9 FOREACH Loop Processing Bt ae Hh ety ee ae ee 46539 WHILE Loop Processing 2 2 1 ee ww ee 6 37 MELESE Tag oc foc Bonk Ga a 1688 MIERRORTag 2 2 ee ee 6 40 TAG Attribute 2 2 A E 6 41 ERR Attribute bot a th ees 46 42 Creating a Generic Error dl pa e e CR a a AOS Creating a Specific Error Handler 2 2 2 2 1 ww 6 43 Handling Error Conditions we 6 44 Processing Errors with Webdriver a 6 46 MICOMMENT Tag we 6 49 Special Characters in AppPage Tags 1 6 51 Special HTML Characters 2 0 wee 6 51 Special Formatting Characters 2 1 we 6 52 6 2 IBM Informix Web DataBlade Module Application Developer s Guide In This Chapter This chapter discusses the AppPage tags and attributes that are included with the Web DataBlade module and used to create AppPages The following tags are covered in this chapter MISQL Tag on p
186. ics of product fred lt MIVAR gt lt MIBLOCK gt In this example the vec vector variable has three elements The MIBLOCK AppPage tag loops through the vector variable three times and displays each corresponding value Manipulating a Vector Variable You can use the following four variable processing functions to manipulate a vector variable VECAPPEND VECSIZE REPLACE SEPARATE Use the VECAPPEND variable processing function to add a new value to the end of the vector variable Use the VECSIZE variable processing function to determine the size of a vector variable 5 6 IBM Informix Web DataBlade Module Application Developer s Guide Vector Variables The following example shows how to use the VECAPPEND and VECSIZE variable processing functions lt MIVAR NAME flowers gt lt MIVAR gt lt MIVAR gt S SETVAR flowers 1 rose lt MIVAR gt lt MIVAR gt S SETVAR flowers 2 hyacinth lt MIVAR gt lt MIVAR gt S SETVAR flowers 3 marigold lt MIVAR gt lt MIVAR gt VECAPPEND flowers daisy lt MIVAR gt The vector has lt MIVAR gt VECSIZE flowers lt MIVAR gt elements lt p gt The last element is lt MIVAR gt S flowers VECSIZE flowers lt MIVAR gt Use the SEPARATE and REPLACE variable processing functions to separate the elements in a vector variable and replace the values with something else For detailed examples of using these two variable processing functions
187. ing Use of Session Variables in AppPages Name of Variable in Variable Versions 3 3 and Previous Mandatory session_location MI_WEBSESSIONLOC Yes Description This variable describes how the persistent state is handled If the session code is going to run within the same process this variable needs to refer to the full path of the directory to create session state files This directory must be created and owned by the same user who owns the Web server If the code is going to run as a separate process the variable needs to refer to a port and IP address in the form port ip address session_buckets MI_WEBSESSIONSUB No This variable is used to define the number of subdirectories that are available to hash the session data if the site is exceptionally large It is only required if session management is being controlled within the same process The default is 100 session_life MI_WEBSESSIONLIFE No C 22 IBM Informix Web DataBlade Module Application Developer s Guide This variable is used to define the amount of time a session is allowed to continue It measures time from the last update to the session stack if a session stack exists or time from session creation Granularity is in seconds default hours h or days d and uses the same syntax as cache_page_life For more information about AppPage caching refer to the IBM Informix Web DataBlade Module Administrator s Guide 2 of 2 Variable show_excep
188. ing syntax shows a generic URL used to invoke an AppPage if you use NSAPI or Apache Webdriver http domain port webdriver_mapping MIval path appage_id extension The following syntax shows a generic URL used to invoke an AppPage if you use ISAPI Webdriver http domain port webdriver_mapping drvisapi dll MIval path appage_id extension The following syntax shows a generic URL used to invoke an AppPage if you use the CGI Webdriver http domain port webdriver_mapping webdriver MIval path appage_id extension Basics of AppPage Development 3 9 How to Invoke AppPages 3 10 URL Element http domain port webdriver_mapping Mlval path appage_id extension The following table describes the elements of the previous URL example Description Which Internet protocol the browser should use when accessing a resource on a server The domain name for the Web server The port number of the Web server process A colon is used as a separator between the domain and the port Defaults to port 80 if blank The name of the Webdriver mapping you are using to connect to the database The Webdriver variable thatis used to specify the AppPage The value in the path column of the table that stores your AppPages For the APB schema this column is called path The actual name of the AppPage stored in the ID column of your AppPage table The value in the extension column of the wbPages table To
189. invoke an AppPage called welcome html you type the following URL into your browser http ariel 8080 hr_app MIval pages welcome html In the previous example the Webdriver mapping is hr_app the path is pages the appage_id is welcome and the extension is html IBM Informix Web DataBlade Module Application Developer s Guide Using Mlpath and Mlextension Using Mipath and Mlextension You can set the MIpath and MIextension Webdriver variables to default paths and extensions For example use the Web DataBlade Module Admin istration Tool to set MIpath to and MIextension to html If you set these you do not have to specify a path or extension in the URL For example you can enter the following URL in your browser to invoke the welcome html AppPage http domain port hr_app MIval welcome This technique is useful if you have a pre 4 0 version application that you do not want to rewrite by adding explicit paths and extensions How to Link AppPages Web applications typically have more information than can fit on one AppPage Your Web application should provide you the ability to navigate from one page to another Linking AppPages requires placement of an identifier in one AppPage that permits a connection with another AppPage There are two methods for linking AppPages within an IBM Informix Web DataBlade module application You can m Link AppPages with the ANCHOR tag m Link AppPages with the FORM tag Each
190. ion with session gt variables and have set the session Webdriver variable to ur1 you must attach the ISAPI filter library to the Microsoft Internet Information server service For detailed information refer to the chapter on the ISAPI Webdriver in the Informix Web DataBlade Module Administrator s Guide Examples of Using Session Variables To specify a session variable in an AppPage you add the prefix session to the front of the variable In the following example an AppPage contains a reference to a session variable session test The first time this AppPage is invoked the URL does not contain a session ID The following example shows the syntax for setting the session test variable lt MIVAR NAME session test gt xyz lt MIVAR gt lt br gt Webdriver generates a new session ID which is passed through to the WebExplode function as two variables The first is a dynamically allocated variable session ID and the second is a modified anchor variable WEB_HOME Since WEB_HOME is used in subsequent pages to anchor other pages to the same application as the user hits these references the session ID continues to be available to Webdriver On future pages this session ID is used to access session variables created or modified in previous pages The following AppPage gets the value of the session variable session test The URL used to call this AppPage uses a session ID which Webdriver inter prets to p
191. is lost The third method provides a way that always chooses cookies but can revert to URL based capture if the browser is ignoring cookies This way combines the two methods on first invocation When the browser receives a subsequent request with the ID in both the cookie and the URL it abandons the URL and continues processing as if just cookie had been set If it sees only a URL ID it continues as if URL session management had been selected This method is known as auto IBM Informix Web DataBlade Module Application Developer s Guide Variable Setting Session Variables Setting Session Variables To enable the use of session variables in your AppPages use the Web DataBlade Module Administration Tool to set the following Webdriver variables Mandatory Description session session_home session_location session_buckets session_life Yes Yes if using auto or url Yes This variable allows you to select the method for binding a session ID to the browser This variable can have values of url cookie or auto If set to ur1 then the session ID is bound to any dynamic anchor variable contained within the page Typically this variable would be WEB_HOME If set to cookie the session ID is tracked with a variable sent back to the browser as a cookie If you select auto Webdriver automatically determines which method is best to use This variable identifies which configuration file variable is used by yo
192. ists Webdriver appends additional messages to it The following example shows a Global section of a web cnf file lt Global gt dbconnmax 10 anchorvar WEB_HOME debug_file disk1 webdriver log debug_level 4 maxcharsize 2 lt Global gt In the example Webdriver writes tracing messages to the file disk1 webdriver log Webdriver writes only messages about query requests to the database server such as calls to the WebExplode function or authorization requests Checking Log Files Be sure to check your Web server error log files for any additional infor mation when you encounter an error Debugging Web DataBlade Module Applications A 11 Running CGI Webdriver Interactively 1 2 Running CGI Webdriver Interactively To debug configuration issues you must first determine which component of your installation is failing If you are unsure whether it is the Web server or Webdriver that is failing when you attempt to retrieve an AppPage bypass the Web browser and Web server and call Webdriver interactively Important This works only for the CGI implementation of Webdriver To run Webdriver interactively Log in as the owner of your Web server HTTPD Move to the directory in which the Webdriver executable file is located cd disk6 netscape ns home cgi Set the following variables in your UNIX environment SCRIPT_NAME QUERY_STRING SCRIPT_NAME is the relative path of the Webdriver
193. lade Module Administration Tool to set the following variables for your Webdriver configuration to enable logging of WebEx plode function trace information Variable Mandatory Content MI_WEBEXPLEVEL Yes Enables WebExplode function tracing MI_WEBEXPLOG No File to which WebExplode messages are written Web DataBlade Module Variables C 27 Managing Dynamic Tags Managing Dynamic Tags Use the Web DataBlade Module Administration Tool to set the following dynamic tag WebExplode variables Variable Mandatory Description MI_WEBTAGSTABLE No Specifies the database table that the WebExplode function searches for the body of a dynamic tag This variable can be set to the following two values webTags or wbTags The default value if this variable is not set is webTags You must set the MI_WEBTAGSTABLE variable to woTags in your Webdriver configuration if you developed your Web appli cation using the APB application included in Version 4 0 or later of the Web DataBlade module or Version 2 0 of Data Director for Web MI_WEBTAGSSOL No Specifies a user defined SELECT statement that the WebEx plode function runs to retrieve the body of a dynamic tag Never set the MI_WEBTAGSSQL variable in your Webdriver configuration The variable should only be set for Web applica tions that were developed with Version 1 1 or earlier of Data Director for Web The MI_WEBTAGSTABLE variable takes precedence over the MI_WEBTAGS
194. lade Module Application Developer s Guide In This Chapter This chapter describes the IBM Informix Web DataBlade module API routines It includes the following chapters m The Web DataBlade Module API Functions following m WebHtmlToBuf on page 14 5 m WebBufToHtml on page 14 8 The Web DataBlade Module API Functions As described in other chapters of this guide you store AppPages in columns of data type HTML a Web DataBlade module specific data type The HTML data type is a multirepresentational data type which means that the way the data is internally stored varies depending on the size of the data Sometimes the entire AppPage is stored in the table row other times part of the AppPage is stored in a smart large object The implementation of this feature is trans parent to the user it is the Web DataBlade module that determines how the AppPage is stored Because at least a portion of an HTML data type data is always stored in a row you cannot use smart large object functions of the DataBlade API such as mi_lo_open and mi_lo_read to access the HTML object For this reason the Web DataBlade module provides the following two API functions so you can manipulate the contents of an HTML data type in your C programs WebHtmlToBuf and WebBufToHtml Using DataBlade Module API Functions in AppPages 14 3 The Web DataBlade Module API Functions Use the WebHtmlToBuf function to copy the contents of a
195. laying Rows with No Value When you process multiple rows at a time you might need to display rows with no value for the columns See Specifying Replacement Values for NULL or No Value Columns on page 6 13 for more information Using Tags in AppPages 6 9 Using System Variables to Format the SQL Results Display Repeated ltems To display items that are repeated with every column use within curly braces This formatting technique is useful when you do not know the number of rows or columns to be retrieved for display The select3 html AppPage displays each column in a separate table cell lt HTML gt lt HEAD gt lt TITLE gt Simple Select 3 lt TITLE gt lt HEAD gt lt BODY gt lt TABLE BORDER gt lt MISQL SQL select from staff gt lt TR gt lt TD gt lt TD gt lt TR gt lt MISQL gt lt TABLE gt lt BODY gt lt HTML gt The WebExplode function returns the following sample output to the client lt HTML gt lt HEAD gt lt TITLE gt Simple Select 3 lt TITLE gt lt HEAD gt lt BODY gt lt TABLE BORDER gt lt TR gt lt TD gt John lt TD gt lt TD gt Somebody lt TD gt lt TD gt Senior Consultant lt TD gt lt TR gt lt TR gt lt TD gt Joe lt TD gt lt TD gt Average lt TD gt lt TD gt Consultant lt TD gt lt TR gt lt TR gt lt TD gt Mark lt TD gt lt TD gt Markup lt TD gt lt TD gt Software Development Engineer lt TD gt lt T
196. le Administration Tool Name of Variable in Versions 3 3 and Previous MI_WEBLOQUERY Mandatory Yes Content Contains the SQL statement that is used to query the database for a large object Use standard C language variable syntax s to specify a parameter string lo_query_params MI_WEBLOPARAMS Yes Specifies the variables that are substituted for the parameters in the SQL statement specified by the lo_query_string variable You must use the variable name MIvalObj to specify the name of the large object you want to retrieve lo_error_zerorows MI_WEBLOZEROROWS No Specifies the integer error number that Webdriver should return if the SQL statement that Webdriver uses to retrieve large objects specified by the lo_query_string variable returned zero rows lo_error_sql MI_WEBLOSQLERROR No Specifies the integer error number that Webdriver should return if an SQL error occurs when Webdriver retrieves a large object using the SQL statement specified by the lo_query_string variable Web DataBlade Module Variables C 15 Enabling AppPage Caching Enabling AppPage Caching To set AppPage caching for your Webdriver configuration use the Web DataBlade Module Administration Tool to set the Webdriver variables listed in the following table Name of Variable in Versions 3 3 Webdriver Variable and Previous Mandatory Description cache_page MI_WEBCACHEPAGE Yes Specifies wheth
197. le or IBM Informix Data Direc tor for Web to develop your Web applications both applications store your user defined dynamic tags in the wbTags table The wbTags table is created when you install the appropriate version of AppPage Builder or Data Director for Web in your database Since the wbTags table is not the default dynamic tag storage table you must let the WebExplode function know that your dynamic tags are stored in the wbTags table You do this by setting the Web driver variable MI_WEBTAGSTABLE to wbTags in your Webdriver configuration When the WebExplode function is looking for a dynamic tag it first deter mines whether you have set the MI_WEBTAGSTABLE variable in your Webdriver configuration If you have it searches for the dynamic tag in the specified table Otherwise the WebExplode function searches the webTags table Both the webTags and wbTags table contain copies of all three system dynamic tags If you specify a dynamic tag in your AppPage that is not defined in the appropriate dynamic tags table either webTags or wbTags the WebEx plode function does not generate an error Instead the WebExplode function returns the dynamic tag specification unaffected in the WebEx plode function output For a detailed description of the webTags system table refer to the IBM Informix Web DataBlade Module Administrator s Guide For more information on the wbTags table refer to Appendix B AppPage Builder S
198. le to dynamically retrieve data from an Informix database The manual describes topics such as how to configure the Web DataBlade module for your database server how to configure the NSAPI Apache CGI and ISAPI Webdrivers how to implement security in your Web applications and how to increase the perfor mance of your Web applications 10 IBM Informix Web DataBlade Module Application Developers Guide Printed Documentation The following related IBM Informix documents complement the information in this manual Data Director for Web is a set of Windows tools that allows you to develop and manage Informix based Web sites and that provides an interface to the Web DataBlade module For detailed information about Data Director for Web refer to the IBM Informix Data Director for Web User s Guide Before you can use the IBM Informix Web DataBlade module you must install and configure IBM Informix Dynamic Server The admin istrator s guide for your database server provides information about how to configure the server and also contains information about how it interacts with DataBlade modules Once you have installed the Web DataBlade module you must use BladeManager to register it into the database where the DataBlade module will be used See the DataBlade Module Installation and Regis tration Guide for details on registering DataBlade modules If you have never used Structured Query Language SQL read the IBM Informix Guide to
199. lication Developers Guide Where AppPage Objects Are Stored m Error handling The Web DataBlade module provides tags and variables to handle error conditions such as SQL errors undefined variables and incorrect constructs See Error Handling with the MI_DRIVER_ERROR Variable on page 5 17 MISQL Tag on page 6 5 and MIERROR Tag on page 6 40 for more information on error handling Where AppPage Objects Are Stored AppPages are stored in a table in the database for easy retrieval If you use AppPage Builder APB to create your application an AppPage is stored in the wbPages table An object like an image or an audio clip is stored as a large object in the wbBinaries table A dynamic tag is a dynamically expanded AppPage fragment that can be easily shared among multiple AppPages Dynamic tags are stored in the wbTags table The wbExtensions Table The wbExtensions table required by the Web DataBlade module stores information about the tables in which you store your AppPages images dynamic tags and so on Each type of object has an extension for example AppPages use the html extension In the wbExtensions table the row in which the extensions column describes the table stores the object The wbExtensions table is composed of the following column names and data types Column Name Data Type Length Description extension VARCHAR 12 The file extension for example html or gif name VARCHAR 30 The nam
200. llowing example uses a table in the superstores_demo demonstration database provided with IBM Informix Dynamic Server the scripts to create this database are under INFORMIXDIR demo dbaccess demo_ud lt MISQL COND XST rep_num SQL select from sales_reps where rep_num Srep_num gt Using Variable Processing Functions in AppPages 8 3 Variable Processing Functions 8 4 tas variables Function Important Variables and variable expressions are interpreted only within MISQL MIVAR and MIERROR tags and within the COND attribute of the MIBLOCK The following functions can be performed on Web DataBlade module Returns 4 val1 val2 valn val1 val2 valn val1 val2 valn val1 val2 valn val1 val2 lt val1 val2 gt val1 val2 val1 val2 lt val1 val2 gt val1 val2 AND val1 val2 valn CONCAT arg1arg2 IBM Informix Web DataBlade Module Application Developers Guide Returns the sum of the numbers vall1 val2 valn Returns the results of subtracting the numbers val2 through valn from vall Returns the result of multiplying the numbers vall val valn Returns the results of dividing the number vall by val valn If the numbers val1 and val2 are equal returns 1 otherwise returns 0 If the number vall is less than val2 returns 1 otherwise returns 0 If the number vall is
201. lly displayed if VAR1 is nonzero lt BR gt lt B gt The value of VARI is lt MIVAR gt S VAR1 lt MIVAR gt lt B gt lt BR gt lt MIBLOCK gt This is always displayed lt BODY gt lt HTML gt If the condition in the MIBLOCK tag evaluates to true that is if the VAR1 variable has been assigned a value other than 0 in the URL that calls it or in an HTML form the value of the variable is displayed The AppPage might be called with the following URL http myhost hr map MIval cond_display htmlgVAR 1 1 Using Tags in AppPages 6 31 Loop Processing The preceding AppPage returns the following output to the client lt HTML gt lt HEAD gt lt TITLE gt Conditional Display lt TITLE gt lt HEAD gt lt BODY gt This is always displayed lt BR gt This is conditionally displayed if VAR1 is nonzero lt BR gt lt B gt The value of VAR1 is 1 lt B gt lt BR gt This is always displayed lt BODY gt lt HTML gt If the VAR1 variable is undefined the preceding AppPage returns the following output to the client lt HTML gt lt HEAD gt lt TITLE gt Conditional Display lt TITLE gt lt HEAD gt lt BODY gt This is always displayed lt BR gt This is always displayed lt BODY gt lt HTML gt NXST and other variable processing functions you can use to create variable expressions are described in Chapter 8 Using Variable Processing Functions in AppPages Loop Processing This section
202. lowing example is a sample plain text page stored in your Web appli cation table This is a plain text page lt MIVAR gt S HTTPHEADER content type text plain lt MIVAR gt It is displayed without rendering any HTML tags so that characters such as lt HR gt appear normally and are not treated as markup tags The resulting HTTP response to the Web browser is as follows Content length 222 Content type text plain This is a plain text page It is displayed without rendering any HTML tags so that characters such as lt HR gt appear normally and are not treated as markup tags Tip The HTTPHEADER variable expression can be placed anywhere within the AppPage Using Cookies Cookies are a mechanism used by Webserver side connections such as Webdriver to store and retrieve information on the client side of the connection such as your Web browser You can set cookies in your AppPages and then convert cookies into Web DataBlade module variables Setting Cookies You can set cookies on any AppPage by adding an HTTP header to the AppPage as follows HTTPHEADER set cookie name value You can set additional attributes in the second parameter to the HTTPHEADER variable expression as follows HTTPHEADER set cookie name value expires DATE path PATH domain DOMAIN_NAME For more information on cookies see http home netscape com newsref std cookie_spec html 13 4 IBM Informix Web DataBlade
203. lt MIVAR NAME flowers gt lt MIVAR gt lt MIVAR gt SETVAR flowers lt MIVAR gt SETVAR flowers lt MIVAR gt SETVAR flowers lt MIVAR gt SETVAR flowers cose lt MIVAR gt hyacinth lt MIVAR gt marigold lt MIVAR gt lt MIVAR gt lt MIVAR gt This is the second element in the array flowers 2 lt MIVAR gt The value of the fourth element is a 0 length string Use the DEFAULT attribute to set a default value for a particular element in the vector array Use the UNSETVAR variable processing function to remove a vector variable as shown in the following example lt MIVAR gt UNSETVAR flowers lt MIVAR gt An AppPage that tries to access a vector variable that has been unset returns an error Using Variables in AppPages 5 5 Vector Variables Looping Through a Vector Variable The example in the previous section shows how to use the MIVAR AppPage tag to display a single element in a vector variable by specifying the appro priate index number within brackets If you want to display each element in a vector variable use the MIBLOCK AppPage tag with the FOREACH attribute in combination with the MIVAR AppPage tag as shown in the following example lt MIVAR NAME vec 1 gt hard lt MIVAR gt lt MIVAR NAME vec 2 gt green lt MIVAR gt lt MIVAR NAME vec 3 gt expensive lt MIVAR gt lt MIBLOCK INDEX fred FOREACH vec gt lt MIVAR gt Characterist
204. ma similar to the wbBinaries table but with a few extra columns used to store versioning information The following CREATE TABLE statement describes the schema of the wbBin ary Versions table CREATE TABLE wbBinaryVersions version_ID SERIAL ID VARCHAR 30 path VARCHAR 178 extension VARCHAR 12 description VARCHAR 254 height INTEGER width INTEGER current_version INTEGER last_changed datetime year to second last_changed_by VARCHAR 30 read_level INTEGER last_locked datetime year to second last_locked_by VARCHAR 30 delete_status INTEGER DEFAULT 0 version_label VARCHAR 80 version_comment VARCHAR 254 object BLOB PRIMARY KEY version_ID CONSTRAINT wbBinaryVersionID FOREIGN KEY extension REFERENCES wbExtensions PUT object IN 2 B 6 IBM Informix Web DataBlade Module Application Developers Guide The wbTags Table The wbTags Table The wbTags table stores system and user defined dynamic tags The ID column stores the unique identifier of the dynamic tag You specify this identifier in your AppPage with the syntax lt tag_id gt when you want to invoke a dynamic tag The dynamic tag itself is stored in the object column which is of data type HTML The wbTags table is similar to the webTags system table in that they both store dynamic tags The webTags system table is created when you register the Web DataBlade module in your database and is the default table for storing dynamic ta
205. me title onsite department varchar 40 varchar 40 varchar 40 boolean varchar 40 Using Dynamic Tags in AppPages 9 15 SELECTLIST The following example is the selectlist html AppPage lt HTML gt lt HEAD gt lt TITLE gt SELECTLIST Example lt TITLE gt lt HEAD gt lt BODY gt lt MIBLOCK COND XST action gt lt Block to perform update when submitting form gt lt MIVAR NAME where gt S SEPARATE names lt MIVAR gt lt MIVAR NAME sql_statementl gt update employees set onsite t where first_name in S where lt MIVAR gt lt MISQL SQL sql_statement1 gt lt MISQL gt lt MIVAR NAME sql_statement2 gt update employees set onsite f where first_name not in Swhere lt MIVAR gt lt MISOL SQL sql_statement2 gt lt MISQL gt lt MIBLOCK gt lt H3 gt Employees that work onsite lt H3 gt lt FORM METHOD POST ACTION lt MIVAR gt SWEB_HOME lt MIVAR gt gt lt Hidden Fields gt lt INPUT TYPE hidden NAME action VALUE on gt lt INPUT TYPE hidden NAME MIval VALUE selectlist html gt lt SQL to generate selection list gt lt SELECTLIST NAME names SIZE 8 MULTIPLE SOL select first_name from employees order by first_name SELECTED select first_name from employees where onsite t gt lt P gt Control click names to toggle on and off Then choose Submit lt P gt lt INPUT TYPE SUBMIT VALUE Submit gt lt IN
206. mechanism works more slowly and uses more memory Therefore it is recommended that you not use this attribute with queries that return large amounts of data 6 18 IBM Informix Web DataBlade Module Application Developer s Guide CACHERESULTS Attribute Clearing the Cache The WebExplode function does not automatically update the results cache when the underlying table is updated You must explicitly clear the cache if you change the underlying table in any way To clear the results cache execute the WebClearResultsCache routine as shown in the following example execute function WebClearResultsCache mc_caption In this case the routine deletes all entries in the cache whose SQL string contain the string mc_caption You can execute the WebClearResultsCache routine with no arguments in which case all entries in the cache are deleted It is recommended that you not use the CACHERESULTS attribute on tables that are frequently updated This is because you must clear the results cache each time the table is updated which could result in poorer overall perfor mance than if you did not use results caching at all ISTAR and Caching Results A results cache is attached to the database that executes the MISQL AppPage tag that has a CACHERESULTS attribute In an ISTAR query the data in the cache might come from many different databases This means that if the underlying table in one database changes the cache must be clear
207. ment in your AppPage The MISOL tag has its own attributes such as SOL COND and ERR Overview 1 5 Architecture Diagram Web browser http URL 1 6 Architecture Diagram The following diagram illustrates the architecture of the Web DataBlade module Web server Look up connection Figure 1 1 Web DataBlade Module Architecture IDS ORDBMS Webdriver configuration table Look up configuration Build SOL statement Web server AppPage table environment HTML page HTML page web cnf file with dynamic with MISQL data tags WebExplode function PY The sequence of events starts with a user typing a URL ina browser and ends with the AppPage rendered in the browser as follows 1 A user enters a URL with a Webdriver request and the name of an AppPage in a browser as shown in the following example http ariel 8080 hr_map MIval welcome html The browser makes a request to the Web server The Web server uses its configuration files and information from its environment to determine how to invoke Webdriver Depending on the type of Webdriver that has been configured for your Web DataBlade module installation the Web server can execute a CGI program CGI Webdriver call a Netscape API shared object NSAPI Webdriver call an Apache API object Apache Webdriver and so on IBM Informix Web DataBlade Module Application Developers Guide
208. method is described next Basics of AppPage Development 3 11 Linking AppPages with the ANCHOR Tag Linking AppPages with the ANCHOR Tag The anchor variable in an AppPage is a variable whose value is generated by Webdriver based on the URL prefix used to invoke the AppPage Anchor variables are used to link together one or more AppPages in the same Web application Use the HREF attribute of the ANCHOR tag to link AppPages in your Web application to each other Use the WEB_HOME anchor variable and the MIVAR AppPage tag to dynamically generate these links The following example shows a generic method to link to an AppPage using the ANCHOR tag lt a href lt MIVAR gt SWEB_HOME lt MIVAR gt MIval path id ext Linking AppPages with the FORM Tag Another way to link the AppPages in your Web application is to create a hidden INPUT button in an HTML form The FORM tag for the button must specify WEB_HOME as the action For example lt FORM METHOD POST ACTION lt MIVAR gt SWEB_HOME lt MIVAR gt gt When you submit the form the following INPUT tag causes the display_table html AppPage to be invoked lt INPUT TYPE HIDDEN NAME MIval VALUE display_table html gt 3 12 IBM Informix Web DataBlade Module Application Developer s Guide Example of Using FORM Tag Links Example of Using FORM Tag Links The following select_table html AppPage allows you to type a table name into the table_name text field and then submit the form
209. mic tag in the Description text box Type the following HTML code in the Dynamic Tag text area lt title gt TITLE lt title gt lt head gt lt body gt 7 Click Save Create a Footer Use the following procedure to create a footer tag To create a footer tag ao F wo N lt br gt lt br gt lt br gt lt br gt Click Add Object Click Dynamic Tag Type my_footer in the Tag ID text box Type a description of the dynamic tag in the Description text box Type the following HTML code in the Dynamic Tag text area lt HR WIDTH 90 gt lt CENTER gt lt FONT S IZE 1 gt lt A HREF http www informix com gt Copyright of INFORMIX SOFTWARE INC lt A gt lt FONT gt lt CENTER gt lt body gt lt html gt 6 Click Save Web DataBlade Module Tutorial 2 7 Steo 3 Create the First AppPage of Your Application Step 3 Create the First AppPage of Your Application The first AppPage of your Web enabled application welcomes users Follow these steps to create it To create the first page of the application 1 On the Add Dynamic Tag AppPage click Add Object The Add Object AppPage appears showing the getting_started project as your default project Web Browser APB Add Object Figure 2 3 APB Add Object URL http domain port hr_app Mlval APB20 apb html AppPage Bullder 2 0 _ MainMenu AddObject Edit Object AdminMenu Add Object Select the type of objec
210. ml AppPage lt HTML gt lt HEAD gt lt TITLE gt RADIOLIST Example lt TITLE gt lt HEAD gt lt BODY gt lt MIBLOCK COND XST action gt RADIOLIST lt Block to perform update when submitting form gt lt H3 gt Details for Employee lt MIvar gt name lt MIVAR gt lt H3 gt lt MIVAR NAME sql_statement gt select from employees where first_name Sname lt MIVAR gt lt MISOL SOL sql_statement gt lt B gt Name lt B gt 1 2 lt BR gt lt B gt Title lt B gt 3 lt BR gt lt B gt Onsite lt B gt 4 lt BR gt lt B gt Department lt B gt 5 lt BR gt lt MISQL gt lt MIBLOCK gt lt FORM METHOD POST ACTION lt MIVAR gt SWEB_HOME lt MIVAR gt gt lt H3 gt Choose an Employee lt H3 gt lt Hidden Fields gt lt INPUT TYPE hidden NAME action VALUE on gt lt INPUT TYPE hidden NAME MIval VALUE radiolist html gt lt MIVAR NAME name DEFAULT gt S name lt MIVAR gt lt SQL to generate radio button list gt lt RADIOLIST NAME name SQL select first_name from employees order by first_name CHECKONE Betty gt lt P gt Select a name Then choose Submit lt P gt lt INPUT TYPE SUBMIT VALUE Submit gt lt INPUT TYPE RESET VALUE Reset gt lt FORM gt lt HR gt lt MIVAR COND S XST Saction gt SQL executed lt I gt S sql_statement lt 1I gt lt MIVAR gt lt P gt lt BODY gt lt HTML gt Using Dynamic Tags i
211. ms in the list box are all the UDRs that have been created in the database 10 8 IBM Informix Web DataBlade Module Application Developer s Guide Web Browser APB Add a User Defined Routine Tag URL http domain port apb AppPage Builder 2 0 MainMenu AddObject Edit Object AdminMenu Add a User Defined Routine Tag Choose a Routine you wish to register in webudrs Routine Signature webupper htm M CONTINUE webupper Parameters Po Description ParamTypes html Routine type Function Owner informix Location INFORMIXDIR extend web 4 13 UC1 web bld WebUpper Default Project TEXTAREA Width Versioning APB 2 0 80 Off Default Object TEXTAREA Height WebLint Checking 20 Off User Name default User Level 0 AppPage Creating a UDR Tag Figure 10 1 Inserting a UDR into the WebUdrs Table Using UDR Tags in AppPages 10 9 Creating a UDR Tag 4 Click Continue APB populates the AppPage with UDR information from the syspro cedures table You cannot update some of the text boxes such as Param Types Routine Type Owner and Location 5 If you want to change the name of the UDR tag to be different from its corresponding UDR enter the new name in the Routine ID text box 6 Enter the class in the Class text box For information on the class see the table describing the
212. n AppPages 9 13 RADIOLIST The following figure is sample Web browser output Web Browser RADIOLIST Example Figure 9 2 RADIOLIST Browser URL http domain port hr_app M lval radiolist html Output Details for Employee Betty Name Betty Pen Title Senior Line Worker Onsite t Department manufacturing Choose an Employee O Beth O Betty O Craig O Gonzo O Kermit O Sarah O Simon O Wilma Select a name Then choose Submit y 9 14 IBM Informix Web DataBlade Module Application Developer s Guide SELECTLIST The SELECTLIST system dynamic tag creates an HTML selection list based on the attributes you specify SELECTLIST has the following attributes Attribute NAME SOL MULTIPLE SELECTED SELECTONE No SIZE SELECTLIST Mandatory Description Yes Yes Specifies the value of the NAME attribute of the items in the selection list Specifies the SOL statement that returns a list of items to compose the selection list If specified users can make multiple selections Specifies the SQL statement that returns a list of items that are initially selected Specifies the value of a single item initially selected Specifies the number of visible choices The following example illustrates the use of SELECTLIST to display infor mation about employees based on the following employees table schema create table employees first_name last_na
213. n Developers Guide URL Add Project Edit Project Add Object Type Edit Object Type Add Extension Edit Extension Web Browser APB Admin Menu Administration Features Administration Features When you invoke the Admin Menu option of APB the browser displays the following AppPage Figure 4 2 http domain port hr_app Mlval APB20 apb_admin html APB Admin Menu database MA A _ _ OD Option Edit User Add Project Edit Project Add Object Edit Object Admin Menu Edit and delete users in the database Add a new project to the database Edit and delete project stored in the database Add a new object type to the database Edit and delete object types stored in the database Add a new extension to the database Edit and delete an extension stored in the The following table describes APB administrative features Action Modify user preferences including changing the user password changing the default project or object type changing the TEXTAREA height or width turning AppPage versioning on or off and changing the level of WebLint checking for syntax errors Add a new project A project contains all of the AppPages and other objects associated with a particular Web application Change the owner or the description of a project 1 of 2 Using AppPage Builder 4 9 Adding an Extension Option Add Object Type Edit Object Type Ad
214. n HTML object an AppPage into an object of type MI_LVARCHAR in your C program You can then use standard DataBlade API functions to manipulate the MI_LVARCHAR object Then use the WebBufToHtml function to copy the contents of the MI_LVARCHAR object back into an HTML object so you can update or insert the AppPage back into the table that stores AppPages The following sections describe in more detail how to use the two Web DataBlade module API functions For more information on the HTML data type refer to Chapter 11 Using the HTML Data Type 14 4 IBM Informix Web DataBlade Module Application Developers Guide WebHtmiToBut WebHtml ToBuf The WebHtmlToBuf API function copies the contents of an HTML object into an MI_LVARCHAR object Syntax MI_LVARCHAR WebHtmlToBuf HTML html_object html_object A pointer to the HTML object to be converted into an MI_LVARCHAR data type Usage In your C program do not call the WebHtm ToBuf API function directly rather use the mi_routine_get mi_routine_exec and mi_routine_end DataBlade API functions instead First use the mi_routine_get DataBlade API function to look up the WebHtmlToBuf function by its signature and to fetch its function descriptor Then use the mi_routine_exec DataBlade API routine to execute the WebHtmlToBuf function Pass the pointer to the HTML object to the mi_routine_exec function which returns contents of the HTML objec
215. n the Informix folder To display this folder choose Start gt Programs gt Informix from the task bar Program Group Item Description Documentation Notes This item includes additions or corrections to manuals along with information about features that might not be covered in the manuals or that have been modified since publication Release Notes This item describes feature differences from earlier versions of IBM Informix products and how these differences might affect current products This file also contains information about any known problems and their workarounds IBM Welcomes Your Comments To help us with future versions of our manuals we want to know about any corrections or clarifications that you would find useful Include the following information m The name and version of your manual m Any comments that you have about the manual m Your name address and phone number Send electronic mail to our address doc informix com We appreciate your suggestions Introduction 13 Overview In This Chapter What Is the Web DataBlade Module Product Architecture Webdriver The WebExplode Funtion Tags and Attributes Architecture Diagram Enterprise Replication Converting from a 9 2x Server Reverting to a 9 2x Server Product Features Before You Begin 1 3 1 3 1 2 IBM Informix Web DataBlade Module Application Developer s Guide In This Chapter This chapter provides an overview of t
216. n which each AppPage displays a subset of the entire set of rows returned from a SELECT statement You can navigate through the set of returned rows by clicking buttons on the AppPages Glossary 5 web cnf file Web DataBlade Module Administration Tool Webdriver Webdriver configuration Webdriver configuration file Webdriver mapping Webdriver variable WebExplode function The default name of the Webdriver configuration file that describes the con nection between the Web server and the Informix database server A Web DataBlade module application used to add update or delete Web driver mappings and Webdriver configurations for the database to which you are connected A client application that connects to an Informix database at the request of a Web server and retrieves AppPages from a table Webdriver passes the retrieved AppPage to the WebExplode function and returns the resulting HTML to the Web server See also Apache Webdriver CGI Webdriver ISAPI Webdriver NSAPI Webdriver The name given to a set of Webdriver variables and user defined variables associated with a particular Web DataBlade module application Webdriver configurations are stored in the WebCM Contfigs system table in the database See web cnf file The name given to the set of Webdriver variables in a single Map section of the web cnf file that Webdriver uses to connect to a particular database Web driver mappings have the same name
217. nformation caching set the extensions Webdriver variable to cache Name of Variable in Variable Versions 3 3 and Previous Mandatory Content extensions MI_WEBEXTENSIONS No Default setting is nocache Set to cache to enable caching C 26 IBM Informix Web DataBlade Module Application Developer s Guide Variable Using the New AppPage Builder or Data Director for Web Using the New AppPage Builder or Data Director for Web If you use the version of AppPage Builder included in Version 4 12 UC1 or later of the IBM Informix Web DataBlade module or you use Data Director for Web to develop AppPages you must set the schema_version Webdriver variable to the value wb This Webdriver variable is automatically included in the apb2 and ddw Webdriver configurations when you install the Web DataBlade Module Administration Tool in your database If you use Version 3 32 or earlier of AppPage Builder to develop AppPages you should not include the schema_version variable in your Webdriver configuration Name of Variable in Versions 3 3 and Previous Mandatory Content schema_version MI_WEBSCHEMADEF No Set to wb if you are using Version 4 12 UC1 or later of the IBM Informix Web DataBlade module or Data Director for Web WebExplode Variables This section describes the WebExplode variables These variables are stored in the database as part of a Webdriver configuration Enabling WebExplode Tracing Use the Web DataB
218. nformix Web DataBlade Module Application Developer s Guide Example of Using an HTML Data Type The following Web DataBlade functions return HTML to the caller WebExplode WebUnHTML FileTOoHTML WebURLDecode WebURLEncode Example of Using an HTML Data Type This example shows how to use DB Access to create a simple table that contains a column of data type HTML for storing AppPages The following simple AppPage is then inserted into the table lt HTML gt lt TITLE gt This is the Title lt TITLE gt lt BODY gt This is the body lt BODY gt lt HTML gt First create the table CREATE TABLE AppPageTable id VARCHAR 20 objectHTML Then execute the ifx_allow_newline procedure EXECUTE PROCEDURE ifx_allow_newline t Using the HTML Data Type 11 5 Example of Using an HTML Data Type Finally insert the AppPage EXECUTE PROCEDURE ifx_allow_newline t INSERT INTO AppPageTable VALUES mainpage lt HTML gt lt TITLE gt This is the title lt TITLE gt lt BODY gt This is the body lt HTML gt 11 6 IBM Informix Web DataBlade Module Application Developer s Guide Using DataBlade Module Functions in AppPages In This Chapter pde a a wl VA ee ds a WebExplodel s ice o 4 4 0 40 e 44 e o WebRelease 2 7 eee a WebUnHIMLQ s 205 one 2a Baek Se ae Zoe Saw WebURLDecode 2 2 ee eee WebURLEncode lt e sos 2 r doe ior brod kis u FileTOHTML
219. nstruction and maintenance of your Web applications a The Web DataBlade module provides system dynamic tags that simplify the creation of check box lists radio button lists and selection lists a Youcan also create user dynamic tags A user dynamic tag is a tag that you create and register in the database Overview 1 9 Product Features Webdriver allows you to customize Web applications using infor mation from its configuration file the Webdriver configurations stored in the database the Web server environment URLs HTML forms and your own Web application variables without additional CGI programming Webdriver also allows you to track persistent session variables between AppPages AppPage Builder APB a development tool that is packaged with the Web DataBlade module provides a user interface to create and update AppPages and to manage multimedia database content APB is itself a Web DataBlade module application made up of linked AppPages APB uses the same database schema as IBM Informix Data Director for Web Data Director for Web is a set of Windows tools that allows you to develop and manage Informix based Web sites and that pro vides an interface to the Web DataBlade module For detailed information about Data Director for Web refer to the IBM Informix Data Director for Web User s Guide The NSAPL ISAPI and Apache implementations of Webdriver allow you to use the proprietary features of t
220. nt HTML INTEGER returns LVARCHAR The following table describes the arguments to the WebLint function Argument Data Type Description HTML HTML The HTML argument is the name of an AppPage INTEGER INTEGER The INTEGER argument represents the level of checking to be performed Levels of INTEGER argument checking are described in the following table Level Description 0 Returns PASS or FAIL Checking stops as soon as an error is encountered 1 Returns PASS or error text describing the first error encountered 2 Returns PASS or error text describing all errors encountered 3 Same error processing as level 2 with additional checks on variables Issues a warning if a value is not assigned to a variable within the AppPage 12 8 IBM Informix Web DataBlade Module Application Developer s Guide URL http domain port hr_app WebLint Example The following SELECT statement executes the WebLint function against the welcome html AppPage in the wbPages table select WebLint object 1 from wbPages where ID welcome and path and extension html Suppose the welcome html AppPage contains the following HTML content with a missing slash in the end MIVAR tag lt TITLE gt lt MIVAR gt title lt MIVAR gt lt TITLE gt The following error message is displayed by WebLint when the level of checking is greater than 0 Figure 12 2 Web Browser APB Add Application Page WebLin
221. number of requests an integer value that Webdriver makes to the database before the connection is shut down and reestablished The default value is 100 You should set this Webdriver variable to another value only under the guidance of Technical Support connection_wait MI_WEBDBCONNWAIT No Specifies the amount of time in milli seconds that Webdriver yields and waits to establish a connection if Webdriver was unable to make the initial connection due to the maximum number of database connections having already been reached The maximum number of Webdriver connections to the database server is specified by the dbconnmax Webdriver variable in the Global section of web cnf file 1 of 4 C 6 IBM Informix Web DataBlade Module Application Developers Guide Managing Webdriver Connections to the Database Name of Variable in Webdriver Variable Versions 3 3 and Previous Mandatory Description connect_as_user MI_USER_ REMOTE No When set to ON specifies that Webdriver establish the connection to the database as the user specified by the REMOTE_USER Web browser variable and not as the user specified in the Map section of the web cnf file By default if this Webdriver variable is not set Webdriver always establishes connections to the database as the user specified by the user Webdriver variable in the appropriate Map section of the web cnf file This Webdriver variable applies only to the NSAPI ISAPI and Apache im
222. odule Application Developers Guide CHECKBOXLIST Attribute Mandatory Description CHECKED No Specifies the SOL statement that returns a list of items that are initially checked CHECKONE No Specifies the value of a single item initially checked PRE No Specifies text that precedes every check box field POST No Specifies text that follows every check box field Default is lt BR gt 2 of 2 The example of CHECKBOXLIST displays information about employees based on the following employees table schema create table employees first_name varchar 40 last_name varchar 40 title varchar 40 onsite boolean department varchar 40 Using Dynamic Tags in AppPages 9 9 CHECKBOXLIST 9 10 The following example is the checkboxlist html AppPage lt HTML gt lt HEAD gt lt TITLE gt CHECKBOXLIST Example lt TITLE gt lt HEAD gt lt BODY gt lt MIBLOCK COND XST action gt lt Block to perform update when submitting form gt lt MIVAR NAME where gt SEPARATE names lt MIVAR gt lt MIVAR NAME sql_statementl gt update employees set onsite t where first_name in S where lt MIVAR gt lt MISOL SQL sql_statement1 gt lt MISQL gt lt MIVAR NAME sql_statement2 gt update employees set onsite f where first_name not in Swhere lt MIVAR gt lt MISOL SOL sql_statement2 gt lt MISOL gt lt MIBLOCK gt lt H3 gt Employees that work onsite
223. odyHeader SbodyLen 1 put lenght in a reasonible place my body while lt SOCK gt Sbody _ if length body gt SbodyLen last chop body remove terminating CR sender added Sexecute body svec split amp Sattributes foreach vec name value Sattributes S name value undef results clear out return data region 4 got the request execute the request 4 processRequest 4 send the results execution is finished 4 if defined results convert results vector back undef stagedResults while name value each results SstagedResults name value e chop stagedResults Sresults length stagedResults stagedResults Totg else results 0 print SOCK Sresults n Sresults length bodyResult SbodyResult print SOCK Sresults n end of infinite loop close LOG close SOCK end of child code 1 The support routines sub executeCommand my fileName shift shift off of _ my Sattr shift my cmd shift 7 18 IBM Informix Web DataBlade Module Application Developer s Guide Sample Perl Program SERVE pl Svec split amp Sattr variable to hash foreach vec name value Sattributes name value my fileCreate gt SfileName create the file open TMPFIL fileCreate die open fail
224. ogs an error message to the trace file lt MIERROR TAG MIVAR gt TRACEMSG An error occurred on page MIval lt MIERROR gt A single MIERROR AppPage tag in an AppPage acts as a generic error handler even if it has an ERR attribute to link it to specific AppPage tag execution For more information on the TRACEMSG variable processing function see Enabling WebExplode Tracing on page A 6 Creating a Specific Error Handler The following example shows how to use the ERR attribute of the MIERROR tag to link an MIERROR tag to an error produced by a specific AppPage tag lt MIERROR ERR CM_ERROR_HANDLER gt An error has occured while serving your request Please contact system administrator and pass on the following details lt BR gt Error Code MI_ERRORCODE lt BR gt Error State MI_ERRORSTATE lt BR gt Error Message MI_ERRORMSG lt BR gt SQL Statement SMI_SOQL lt BR gt lt MIERROR gt lt MISQL ERR CM_ERROR_HANDLER SQL select id from your_table gt 1 lt MISQL gt In the example the your_table table does not exist The ERR attribute of the MISQL tag specifies the exact MIERROR tag that should be called in this case labeled with the CM_ERROR_HANDLER label Using Tags in AppPages 6 43 Handling Error Conditions Handling Error Conditions When the WebExplode function first encounters an MIERROR tag on an AppPage only the COND and ERR attributes are evaluated Variables between the start and end t
225. ollowing sections Using AppPage Builder 4 5 Using the URL Prefix Specially Created to Invoke APB 4 6 Using the URL Prefix Specially Created to Invoke APB Typically when the Web DataBlade module is initially configured for your database with the websetup utility the Web DataBlade module adminis trator creates a special URL prefix that maps to the Webdriver mapping that specifies the apb2 Webdriver configuration The apb2 Webdriver configu ration is automatically registered in your database as part of the registration of the Web DataBlade Module Administration Tool The special URL prefix to invoke APB is typically apb2 If the Web DataBlade module administrator has set up this special URL prefix specify it in your URL to invoke the main APB AppPage For example assume the name of your Web server computer is ariel the port number of the Web process is 8080 and the URL prefix to invoke APB is apb2 Use the following URL to invoke APB in your browser http ariel 8080 apb2 Tip Many Web servers require you add the extra slash at the end of the URL For detailed information on URL prefixes Webdriver mappings and Webdriver configurations refer to the IBM Informix Web DataBlade Module Administrator s Guide Using Any URL Prefix If the Web DataBlade module administrator has not created a special URL prefix to invoke APB directly you can use any URL prefix that maps to a Webdriver mapping to invoke APB S
226. olname colno from syscolumns a systables b where a tabid b tabid and b tabname trim Stable_name order by colno gt lt TH gt 1 lt TH gt lt MISQL gt lt TR gt lt MISOL SOL select from Stable_name gt lt TR gt lt ID gt lt TD gt lt TR gt lt MISQL gt lt TABLE gt lt BODY gt lt HTML gt Tag on page 6 5 display_table html AppPage Web Browser Display Table Data URL http domain port hr_map sales Sales Department 50000 ca marketing Marketing for all products 70000 ca 3 14 IBM Informix Web DataBlade Module Application Developer s Guide For more information on the MISOL tag used in this example The display_table html AppPage is invoked when you submit the form displayed by select_table The display_table html AppPage retrieves the column headers for the specified table in the submitted table_name field from the syscolumns and systables system catalog tables and displays the column headers and the rows of the specified table within an HTML table see MISOL The following illustration shows sample Web browser output for the Figure 3 2 Display Table Data How to Retrieve Large Objects How to Retrieve Large Objects The Web DataBlade module provides built in support for objects typically found in Web applications such as images audio and video These objects are called large objects As with A
227. ow_exceptions and error_page are not set the following actions take place NOTFOUND goes to http www yoursite com NOACCESS goes to http www yoursite com TRUNCATED returns 500 Server Error ORYTIMEOUT returns 500 Server Error Using Variables in AppPages 5 19 Using Tags in AppPages In This Chapter lt eme a 0 on aces e GOs 6 3 AppPage Tags 4 1 we ee o koet e alene e eao 6 3 MISQL Tag E 65 Using System Variables to Format the SQL Results a om E oee 88 6 7 Specifying Column and Row Formatting Information 6 7 Displaying Processing Information Bate amp gate et SOc Specifying Replacement Values for NULL or No Value Columns 2 we 6 13 WINSTART Attribute 2 ew 6 14 WINSIZE Attribute ww 6 15 RESULTS Attribute 6 15 DATASET Attribute ee 6 17 CACHERESULTS Attribute 2 6 18 Clearing the Cache As a ch oy e ed ORO ISTAR and Caching Results a e y ns e Oh e OLD Maximum Size of a Results Cache hts oh a E o Disabling the Cache While Updating Tables hes eis tg Oh ee ws O20 SERIAL and SERIAL8 Attributes Ly na a 6220 PREPARE Attribute ros OR Ae cu OR Se ra 10 21 Generating XML Formatted Data a A es As alt A da Ae aie ee MODS Using Your Own XML Tags a Aue os ot OLA Using Attributes of the MISOL AppPage Tag Bh ow the a 629 MIVAR Tag me gi Oe ge D oD
228. pPages table lt HTML gt lt HEAD gt lt TITLE gt FileToHTML Example lt TITLE gt lt HEAD gt lt BODY gt lt MISQL SQL INSERT INTO webAppPages VALUES benefits FileToHTML tmp myfile txt gt lt MISQL gt lt BODY gt lt HTML gt 12 18 IBM Informix Web DataBlade Module Application Developer s Guide WebRmtShutdown WebRmtShutdown The WebRmtShutdown function shuts down the currently running Perl program that was previously started by the MIEXEC tag Syntax WebRmt Shutdown Arguments None Returns WebRmtShutdown returns 0 if the currently running Perl program has been successfully shut down and 1 if not Example The following webrmt html AppPage calls the WebRmtShutdown function lt HTML gt lt HEAD gt lt TITLE gt WebRmt Shutdown Example lt TITLE gt lt HEAD gt lt BODY gt lt B gt To shut down the currently running Perl program execute the WebRmtShutdown function lt B gt lt MISQL SQL EXECUTE FUNCTION WebRmt Shutdown gt lt MISQL gt lt BODY gt lt HTML gt Using DataBlade Module Functions in AppPages 12 19 Using Other Webdriver Features In This Chapter Adding HTTP Headers to AppPages Retrieving Non HTML Pages Using Cookies Setting Cookies Des accept_cookie Webdriver Variable Converting Cookies into Web DataBlade Module Variables Uploading Client Files Setting the Directory Submitting the Form Exampl
229. partial page caching Enables you to execute a Perl program in your AppPage Important You can nest all AppPage tags within the MIBLOCK tag You can also nest an MISQL tag within another MISQL tag 6 4 IBM Informix Web DataBlade Module Application Developers Guide MISQL Tag MISQL Tag Use the MISQL tag to execute SQL statements and to format the results of those statements in AppPages The expansion of SQL takes place in the database server before the resulting HTML is returned to the client The MISQL tag has the following tag attributes Attribute Mandatory Description SQL Yes Specifies a single SOL statement The statement must be executable inside a trans action block NAME No Specifies the name of the variable to which the formatted results of the MISQL tag are assigned If NAME is not specified the results are output COND No Specifies if the tag is executed only if this condition evaluates to TRUE nonzero If the COND attribute is not present the tag is executed ERR No Specifies how an error should be processed Because multiple errors can occur on an AppPage use the ERR attribute to link the error processing to a particular MIERROR tag WINSTART No Specifies the first row in the current data set to process See WINSTART Attribute on page 6 14 WINSIZE No Specifies the maximum number of rows to be processed See WINSIZE Attribute on page 6 15 RESULTS No Specifies the name used in acces
230. pdate AppPages APB is itself a Web DataBlade module application made up of linked App Pages Tags that are provided with the Web DataBlade module and are processed by the WebExplode function The tags identify ele ments of an HTML page and specify the structure and formatting for that page The implementation of Webdriver that uses a CGI program to connect to databases and execute AppPages See also Webdriver Apache Webdriver ISAPI Webdriver NSAPI Webdriver code set deployment directive dynamic tag Global Language Support GLS INFORM IXDIR INFORM IX SERVER ISAPI Webdriver A set of unique bit patterns that are mapped to the characters contained in a specific natural language which include the alphabet digits punctuation and diacritical marks There can be more than one code set for a language for example the code sets for the English language include ASCII I508895 1 and Microsoft 1252 You specify the code set that your database server uses when you set the GLS locale See also multibyte code set Global Language Support GLS locale Moving a Web application from a development environment to a production environment An entry in a Web server s configuration file that identifies the steps in the Web server s request response processes that handle HTTP transactions Examples of directives in Netscape s obj conf file are NameTrans and Ser vice An HTML tag that allows multiple AppPag
231. pe Use the HTML data type the same way you use the VARCHAR data type For example you can use the standard SOL statements such as SELECT INSERT UPDATE DELETE and LOAD to view and update the HTML data type columns Because there is a cast from the HTML data type to the CHARACTER data type you can also use the standard string functions such as CONCAT and TRIMO on the HTML data type columns Typically you use AppPage Builder APB to create and edit AppPages If however you use a different application to create and edit AppPages by manipulating columns of data type HTML you must first execute the ifx_allow_newline t procedure Otherwise you cannot enter new lines in your AppPages and store as the HTML data type For example in DB Access execute the following syntax to enable entry of new lines EXECUTE PROCEDURE ifx_allow_newline t To disallow new lines use the following syntax EXECUTE PROCEDURE ifx_allow_newline f Functions That Use or Return the HTML Data Type The following Web DataBlade functions take the HTML data type as an argument WebExplode HTML HTML See WebExplode on page 12 4 WebUnHTML HTML See WebUnHTML on page 12 12 FileToHTML ATML See FileToHTML on page 12 17 WebURLDecode HTML See WebURLDecode on page 12 14 WebURLEncode HTML See WebURLEncode on page 12 15 WebLint HTML integer See WebLint on page 12 8 11 4 IBM I
232. pecify MIval APB20 apb html after the URL prefix For example assume the name of your Web server computer is ariel and the port number of the Web process is 8080 Further assume that the URL prefix hx_map maps to a Webdriver mapping that specifies a Webdriver configu ration in the web40 database The following URL invokes APB for the web40 database http ariel 8080 hr_map MIval APB20 apb html Tip You cannot use the URL prefix that invokes the Web DataBlade Module Admin istration Tool to invoke APB You can only use this URL prefix to invoke the Web DataBlade Module Administration Tool IBM Informix Web DataBlade Module Application Developers Guide Creating Web Applications in AppPage Builder For detailed information on URL prefixes Webdriver mappings and Webdriver configurations refer to the IBM Informix Web DataBlade Module Administrator s Guide Creating Web Applications in AppPage Builder When you invoke APB the browser displays the following AppPage Use APB to create and maintain AppPages and other multimedia objects that make up your Web applications Figure 4 1 Web Browser APB MainMenu APB Main M Main Menu URL http domain port hr_app Mlval APB20 apb html AppPage Bullder 2 0 Main Menu Add Object Add a new object to the database Edit Object Edit delete and view objects stored in the database Admin Menu Manage user accounts and projects User Name Default
233. played until the next MISQL tag is executed 6 12 IBM Informix Web DataBlade Module Application Developer s Guide Using System Variables to Format the SQL Results Specifying Replacement Values for NULL or No Value Columns When you format your SQL output NULL is displayed by default if a column has a null value NOVALUE is displayed by default if you specify a column variable greater than the number of columns in the row or if there is no value for a column when the output is formatted to display multiple rows on the same line m Use the MI_NULL variable to specify the text to be displayed when a null value is retrieved m Use the MI_NOVALUE variable to specify the text to be displayed when no value is retrieved In the following select5 html AppPage the MI_LNULL and MI_NOVALUE variables are assigned to a blank space lt HTML gt lt HEAD gt lt TITLE gt Simple Select 5 lt TITLE gt lt HEAD gt lt BODY gt lt TABLE BORDER gt lt MIVAR NAME MI_NOVALUE gt lt MIVAR gt lt MIVAR NAME MI_NULL gt lt MIVAR gt lt MISQL SOL select first_name last_name from celebrities gt lt TR gt lt TD gt 1 2 lt TD gt lt TD gt 1 2 2 2 lt TD gt lt TR gt lt MISQL gt lt TABLE gt lt BODY gt lt HTML gt The WebExplode function returns the following sample output to the client lt HTML gt lt HEAD gt lt TITLE gt Simple Select 5 lt TITLE gt lt HEAD gt lt BODY gt lt
234. ple mentations of Webdriver In addition you can only use this Webdriver variable if you have enabled user authentication for the corresponding Web server connect_user_ max MI_USER_DBCONNMAX No Specifies the maximum number of connections that Webdriver establishes as the user specified by the REMOTE_USER Web browser variable The default value of this Webdriver variable is 1 The connect_user_max Webdriver variable can only be set in conjunction with the connect_as_user Webdriver variable This Webdriver variable applies only to the NSAPI ISAPI and Apache imple mentations of Webdriver In addition you can only use this Webdriver variable if you have enabled user authentication for the corresponding Web server query_timeout MI_WEBORYTIMEOUT No Specifies the maximum number of seconds that Webdriver allows a query to run before Webdriver interrupts the query 2 of 4 Web DataBlade Module Variables C 7 Managing Webdriver Connections to the Database Webdriver Variable keepalive Name of Variable in Versions 3 3 and Previous MI_WEBKEEPALIVE Mandatory No Description Specifies the interval in seconds at which Webdriver checks the Web browser connection If the browser is no longer connected because a STOP or CANCEL signal has been sent by the browser the running query is interrupted and the Web server is freed to execute the next query request This variable applies only to the NSAPI ISAP
235. plication The IBM Informix Web DataBlade module contains enterprise replication ER support for the HTML data type The necessary support functions are automatically created in your database when you register the Web DataBlade module on a Version 9 30 or later server Please refer to the Guide to IBM Informix Enterprise Replication for information on how to design your replication system as well as how to administer and manage data replication throughout your enterprise If you are using a tool like Application Page Builder 2 0 APB20 you must install the tool in each of the replicated sites and set up the tables that contain the HTML content the wbPages as well as the User Dynamic Tags and other supporting tables for replication If you are using the Administrator s Tool adminTool you must install the adminTool in each of the replicated sites and you must manually update the webconfigs table with the adminTool at each site Important It is your responsibility to maintain consistent system information throughout your enterprise This means that you must ensure that all copies of the tables that your applications utilize are synchronized at all times Converting from a 9 2x Server If you register this version of the Web DataBlade module in a database on a Version 9 2x server and then subsequently convert your server to Version 9 30 or later and want to use ER you must use BladeManager and repeat the regis
236. ppPage as a vector variable Vector variables are automatically used if you use the CHECKBOXLIST system dynamic tag and the SELECTLIST system dynamic tag with the MULTIPLE attribute Refer to Using System Dynamic Tags on page 9 8 for detailed information on using the CHECKBOXLIST and SELECTLIST system dynamic tags gt Important You can only use the POST method to pass vector variables from a form to an AppPage Using the GET method with vector variables is not supported Web DataBlade Module System Variables Web DataBlade module system variables are set by the database server when an SQL statement is executed within the MISOL tag For more information on using these variables see Using System Variables to Format the SQL Results on page 6 7 Web Server and Web Browser Variables By default the following Web server and Web browser variables are available to the WebExplode function when you use Webdriver AUTH_TYPE HTTP_USER_AGENT HTTP_REFERER HTTP_HOST HTTP_URI REMOTE_ADDR REQUEST_METHOD SERVER_PROTOCOL QUERY_STRING REMOTE_USER MI_WEBACCESSLEVEL MI_WEBGROUPLEVEL 5 8 IBM Informix Web DataBlade Module Application Developers Guide Web Server and Web Browser Variables To access these Web browser and Web server variables in an AppPage you must explicitly add them as user variables in the Webdriver configuration you use to access your Web application This procedure is described lat
237. ppPages you store large objects in a table in the database Similarly to invoking AppPages you can also invoke or retrieve large objects from the table where they are stored APB provides a table to store large objects in called wbBinaries You can either retrieve large objects by specifying the names by which they are stored in the wbBinaries table or by using their large object handles unique identifiers within the database in which they are stored Retrieving Large Objects By Name The following syntax shows how a large object is retrieved within an AppPage by specifying its name lt IMG SRC lt MIVAR gt SWEB_HOME lt MIVAR gt MIval path id extension For example to retrieve a large object called flower with an extension type of gif you include the following code in your AppPage lt IMG SRC lt MIVAR gt SWEB_HOME lt MIVAR gt MIval images flower gif Retrieving Large Objects By Large Object Handles This section describes how you can retrieve a large object into your AppPage based on its large object handle This method is particularly useful when retrieving large objects that are not stored in the wbBinaries table You can retrieve large objects by their large object handles when you dynam ically retrieve the results of a SELECT statement Basics of AppPage Development 3 15 Retrieving Large Objects By Large Object Handles 3 16 1 Use the Web DataBlade Module Administration Tool to set the following Webdrive
238. r UPDATE statement to insert the contents of a file into an HTML column in the database table that contains AppPages Syntax The FileToHTMLO function has the following two signatures FileToHTML filename returns HTML FileToHTML filename locale returns HTML The following table describes the arguments to the File ToHTMLO function Argument Data Type Description filename LVARCHAR Specifies the full pathname of the file on the operating system file system that you want to convert to HTML and insert into a table The database server always looks for the file on the client computer locale LVARCHAR Specifies the client locale of the client application Client locale refers to the language territory and code set that the client application uses to perform read and write operations on the client computer If you are using the default client locale U S English then you do not need to specify a client locale and can use the first version of the FileToHTMLO function which takes just one argument Using DataBlade Module Functions in AppPages 12 17 FileToHTML Example Assume the table in which you store your AppPages is called webAppPages and has the following simple schema CREATE TABLE webAppPages id VARCHAR 10 apppageHTML i The following AppPage shows how to use the File ToHTMLO function in an INSERT statement to insert the contents of the file tmp myfile txt into the HTML column of the webAp
239. r been here before Figure 13 2 Cookie URL http domain port hr_app Mlval cookie html Subsequent Request Has the user been here before Welcome Back You have been here before Uploading Client Files If you use a Web browser that supports client file upload you can use Webdriver to upload files from your client computer The following example HTML form retrieves an image file into the input_imagel variable The HTML form is processed by the process_file html AppPage lt FORM ENCTYPE multipart form data METHOD POST ACTION lt MIVAR gt SWEB_HOME lt MIVAR gt gt lt INPUT TYPE TEXT NAME file_name gt lt INPUT TYPE FILE NAME input_imagel gt lt INPUT TYPE SUBMIT VALUE Send File gt lt INPUT TYPE HIDDEN NAME MIval VALUE process_file html gt lt FORM gt Using Other Webdriver Features 13 7 Setting the Directory 13 8 Setting the Directory Use the Web DataBlade Module Administration Tool to set the following Webdriver variable to upload client files Variable Mandatory Content upload_directory No Directory on the Web server machine in which uploaded files are placed Default is tmp Set upload_directory to the directory on the Web server computer where the uploaded files are to be placed In the preceding example if upload_directory is set to local Web uploads Webdriver creates the file Nocal Web uploads input_image1 PID where PID is the process ID for the Webdriver proce
240. r in Your Database This section describes how to register APB in your database if it has not already been registered as part of the initial Web DataBlade module setup for your database with the websetup utility To find out whether APB is currently registered in your database execute the following SQL statement SELECT FROM wbpages WHERE id apb and path APB20 and extension html If the SELECT statement returns a value APB is registered in your database Typically the owner of a database registers APB in the database To register APB in your database 1 Create an sbspace in your database to store the AppPages that make up the APB application Be sure to enable logging for the sbspace You may use an existing sbspace such as the default sbspace pointed to by the SBSPACENAME parameter in the ONCONFIG file To create a new sbspace use the onspaces utility For detailed infor mation on using the onspaces utility refer to the Administrator s Guide for your database server 2 At the operating system prompt change to the directory that contains the APB utilities and data This directory is INFORMIXDIR extend web version apb2 where INFORMIXDIR refers to the main Informix directory and version refers to the current version of the Web DataBlade module installed on your computer For example if INFORMIXDIR is set to local informix for your database server and the current Web DataBlade module version is
241. r than character gt terminates a tag you must also place double quotes around any variable expression containing it lt MIVAR NAME x gt 100 lt MIVAR gt lt MIVAR NAME y gt 50 lt MIVAR gt lt MIBLOCK COND gt x y gt X is greater than Y lt MIBLOCK gt In general itis a good idea to keep expressions within quotes even if you are not aware of any special characters that need to be suppressed 8 18 IBM Informix Web DataBlade Module Application Developer s Guide Using Dynamic Tags in AppPages In This Chapter What Are Dynamic Tags Specifying Dynamic Tags in AppPages Where Dynamic Tags Are Stored Dynamic Tag WebExplode Variables Using System Dynamic Tags CHECKBOXLIST RADIOLIST SELECTLIST Creating User Defined Dynamic Tags Adding User Defined Dynamic Tags with AppPage Builder Example of Creating a User Defined Dynamic Tag Special Characters in Dynamic Tags 9 3 9 3 9 4 9 5 9 7 9 8 9 11 9 15 9 17 9 18 9 19 9 21 9 2 IBM Informix Web DataBlade Module Application Developer s Guide In This Chapter This chapter describes system and user defined tags It includes the following topics What Are Dynamic Tags following Specifying Dynamic Tags in AppPages on page 9 4 Where Dynamic Tags Are Stored on page 9 5 Dynamic Tag WebExplode Variables on page 9 7 Using System Dynamic Tags on page 9 8 Creating User Defined Dynamic
242. r variable in your Webdriver configuration Webdriver Variable Mandatory Description MItypeObj Yes MIME type and subtype used to export the large object such as image gif Be sure to check the Overwrite checkbox when you add this variable to your Webdriver configuration 2 Use the MISOL AppPage tag in your AppPage to select the large object from the table 3 Use the LO Webdriver variable combined with WEB_HOME to specify the selected large object handle and retrieve the large object into your AppPage Important Do not set the LO Webdriver variable in your Webdriver configuration because this forces Webdriver to ignore the MIval Webdriver variable Only specify the LO Webdriver variable in the URL you use to retrieve the large object For example assume you have stored images in the object column of a table called webImages The following AppPage retrieves one of the images using its large object handle lt HTML gt lt HEAD gt lt TITLE gt Retrieving Large Objects lt TITLE gt lt HEAD gt lt BODY gt lt H3 gt Display the image lt H3 gt lt HR gt lt MISQL SQL select object from webImages where ID flower gt lt IMG SRC WEB_HOME LO 1 gt lt BR gt lt MISQL gt lt BODY gt lt HTML gt For instructions on changing the query string if you want to add security to large objects see the IBM Informix Web DataBlade Module Administrator s Guide For more information
243. ration Licensing 2 31 Roppongi 3 chome Minato ku Tokyo 106 0032 Japan The following paragraph does not apply to the United Kingdom or any other country where such provisions are inconsistent with local law INTERNATIONAL BUSINESS MACHINES CORPORATION PROVIDES THIS PUBLICATION AS IS WITHOUT WARRANTY OF ANY KIND EITHER EXPRESS OR IMPLIED INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF NON INFRINGEMENT MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE Some states do not allow disclaimer of express or implied warranties in certain transactions therefore this statement may not apply to you This information could include technical inaccuracies or typographical errors Changes are periodically made to the information herein these changes will be incorporated in new editions of the publication IBM may make improvements and or changes in the product s and or the program s described in this publication at any time without notice Any references in this information to non IBM Web sites are provided for convenience only and do not in any manner serve as an endorsement of those Web sites The materials at those Web sites are not part of the materials for this IBM product and use of those Web sites is at your own risk IBM may use or distribute any of the information you supply in any way it believes appropriate without incurring any obligation to you Licensees of this program who wish to have information about it for t
244. ration of variables using the Web DataBlade Module Administration Tool refer to the IBM Informix Web DataBlade Module Administrator s Guide IBM Informix Web DataBlade Module Application Developer s Guide Variable show_exceptions redirect_url error_page Error Handling with the MI_DRIVER_ERROR Variable Error Handling with the MI_DRIVER_ERROR Variable You can handle Webdriver error conditions with error messages that are more descriptive than the standard browser error messages by selecting a page in the database to be the error catching page Set the following Webdriver variables with the Web DataBlade Module Administration Tool to modify the error messages seen by the browser as different types of errors are encountered Mandatory Content No Set to on or of When on Webdriver displays the database exception returned by the WebExplode function When of Webdriver displays the HTTP 1 0 500 Server error message Default is off No Set to the URL to redirect users to if they do not have access to the AppPage they attempt to retrieve No Set to the value of the AppPage that contains error handling routines If error_page is set Webdriver calls this page and all error handling is processed on that page The following table lists the errors provided for post AppPage execution Error Condition Error Message QRYTIMEOUT Query exceeded the query_timeout value NOTFOUND No page exists in the database 404
245. re hy d tae bi GB a 7 9 SERVICE Attribute eS ts ELO Using the MIEXEC Tag in an Apalai O E Examples of Using the MIEXEC Tag 7 13 Sample Perl Program SERVE pl 1 ww 7 15 Chapter 8 Using Variable Processing Functions in AppPages In ThisEhapter smsi a ode a A as a Le ee 8 3 Variable Processing Functions SI ae ee ee ee 8 3 Using Variable Expressions in AppPages pian a 810 Using Arithmetic Functions in Variable Expressions o 8 10 Using SEPARATE and REPLACE in Variable Expressions 8 11 Using Variable Expressions to Format Output Conditionally 8 13 Special Characters in Variable Expressions 8 17 vi IBM Informix Web DataBlade Module Application Developer s Guide Chapter 9 Chapter 10 Chapter 11 Chapter 12 Using Dynamic Tags in ia In This Chapter What Are Dynamic Tags f 3 Specifying Dynamic Tags in Ap Pare i Where Dynamic Tags Are Stored Dynamic Tag WebExplode Variables Using System Dynamic Tags CHECKBOXLIST RADIOLIST SELECTLIST Creating User Defined Dynamic Tags ee Adding User Defined Dynamic Tags with AppPage Builder Example of Creating a User Defined Dynamic Tag Special Characters in Dynamic Tags Using UDR Tags in AppPages In This Chapter F What Is a User Defined Roue UDR Tag Where Are UDR Tags Stored Specifying a UDR Tag in an AppPage Creating a UDR Tag Using the HTML Data Type In This Chapter The HTML Data Type
246. refer to Using SEPARATE and REPLACE in Variable Expressions on page 8 11 Forms and Variable Vectors If you use a form on your AppPage that uses the TYPE CHECKBOX attribute of the INPUT tag to create a check box for users to make multiple selections you can specify that the form variables be stored in a vector variable Do this by making sure that each NAME attribute specifies the same variable name Then in the AppPage thatis invoked when the user clicks the Submit button use the MIBLOCK AppPage tag with the FOREACH attribute to loop through the passed vector variable as shown in Looping Through a Vector Variable on page 5 6 The following example shows how to store check box form variables in a vector variable called mycheckbox lt form method post gt lt input type hidden name MIval value myform gt lt input type hidden name process value true gt lt br gt Please check one or more options lt br gt lt input type checkbox name mycheckbox value optionl checked gt Option 1 lt input type checkbox name mycheckbox value option2 gt Option 2 lt input type checkbox name mycheckbox value option3 checked gt Option 3 lt hr gt lt input type submit gt lt form gt Using Variables in AppPages 5 7 Web DataBlade Module System Variables If you use the SELECT tag with the MULTIPLE attribute to specify a selectable list of options in your form the selected options are also passed to the called A
247. res binary data such as images Microsoft Word files video clips and bitmaps The ID path and extension columns uniquely identify a binary object The extension of the binary object determines what type of object it is based on information in the wbExtensions table For example the extensions gif and jpeg indicate that the object is an image and the extension doc indicates that the object is a Microsoft Word document The binary object itself is stored in the object column which is of data type BLOB AppPage Builder also stores other information about the binary object such as a description of the object when it was last changed and the user who last changed it The following CREATE TABLE statement describes the schema of the wbBin aries table CREATE TABLE wbBinaries 1D VARCHAR 30 path VARCHAR 178 extension VARCHAR 12 description VARCHAR 254 height INTEGER width INTEGER current_version INTEGER last_changed datetime year to second last_changed_by VARCHAR 30 read_level INTEGER last_locked datetime year to second last_locked_by VARCHAR 30 object BLOB PRIMARY KEY ID path extension CONSTRAINT wbBinld FOREIGN KEY extension REFERENCES wbExtensions extension PUT object IN 2 AppPage Builder Schema B 5 The wbBinaryVersions Table The wbBinaryVersions Table The wbBinary Versions table stores previous versions of binary objects The wbBinary Versions table has a sche
248. retrieves other HTML pages before retrieving this AppPage again On any subsequent retrieval of this AppPage the browser displays the Welcome Back message lt HTML gt lt HEAD gt lt TITLE gt Has the user been here before lt TITLE gt lt HEAD gt lt BODY gt lt H2 gt Has the user been here before lt H2 gt lt HR gt lt See if the flag variable has been set gt lt MIBLOCK COND S XST flag gt lt Flag variable has been set gt lt B gt Welcome Back You have been here before lt B gt lt MIBLOCK gt lt MIBLOCK COND NXST flag gt lt Flag variable has NOT been set gt lt Set a cookie lt MIVAR gt S HTTPHEADER set cookie flag yes lt MIVAR gt lt B gt This is the first time you have been to this page lt B gt lt MIBLOCK gt lt BODY gt lt HTML gt The following figure shows sample Web browser output the first time the cookie AppPage is retrieved Web Browser Has the user been here before Figure 13 1 Cookie First URL http domain port hr_app Mlval cookie html Request Has the user been here before This is the first time you have been to this page lt HN gt 13 6 IBM Informix Web DataBlade Module Application Developer s Guide Uploading Client Files The following figure shows sample Web browser output on any subsequent retrieval of the cookie AppPage Web Browser Has the use
249. ribute of MIBLOCK tag 6 30 WINSIZE attribute of MISQL tag 6 5 6 15 WINSTART attribute of MISQL tag 6 5 6 14 X xml extension 6 23 XMLDOC attribute of MISQL tag 6 25 XML Formatted Data 6 23 XMLROW attribute of MISQL tag 6 25 XMLVERSION attribute of MISOL tag 6 25 XOR variable processing function 8 9 XST variable processing function 8 9 Symbols character in variable expressions 8 17 in Web DataBlade module tags 6 51 amp in dynamic tags 9 19 in dynamic tags 9 19 9 21 8 IBM Informix Web DataBlade Module Application Developer s Guide
250. rmix Error Messages manual If you prefer you can look up the error messages in the online message file described in the introduction to the IBM Informix Error Messages manual Online Documentation The online documentation for the Web DataBlade module includes release notes and documentation notes Release Notes and Documentation Notes In addition to printed documentation the following sections describe the online files that supplement the information in this manual Examine these files before you begin using the IBM Informix Web DataBlade module They contain vital information about application and performance issues On UNIX platforms the following online files appear in the INFORMIXDIR extend web version directory where version refers to the current version of the IBM Informix Web DataBlade module Online File Purpose WEBDOC TXT Describes features that are not covered in the manual or that have been modified since publication WEBREL TXT Describes any special actions that are required to configure and use the Web DataBlade module on your computer This file also describes new features and feature differences from earlier versions of the Web DataBlade module and how these differences might affect current products Additionally this file contains information about any bugs and their workarounds 12 IBM Informix Web DataBlade Module Application Developers Guide IBM Welcomes Your Comments The following items appear i
251. roduce the variable value lt MIVAR gt Ssession test lt MIVAR gt lt br gt To unset the session test session variable use the following syntax Unsetting session test session variable lt MIVAR gt UNSETVAR session test lt MIVAR gt 5 14 IBM Informix Web DataBlade Module Application Developer s Guide Examples of Using Session Variables The following example shows an AppPage that uses three different session variables session item session description and session count The session variables are populated by a SELECT statement Since these session variables survive for the duration of the session subsequent AppPages do not need to keep selecting from a table they can simply refer to the existing variables Using session variables can thereby notably increase performance lt MIBLOCK COND NXST Sdriver session gt lt PRE gt Hummm No driver session indicates that you have not got session management configured correctly or you did not hit up this page with a session_home anchor variable lt MIBLOCK gt lt MIVAR gt SETVAR myindex 0 lt MIVAR gt lt MISOL SQL select item_code description count from sestesttab gt lt MIVAR gt SETVAR myindex Smyindex 1 SETVAR session item_code Smyindex 1 SETVAR session description myindex URLENCODE 2 SETVAR session count Smyindex 3 lt MIVAR gt lt MISQL gt lt MIVAR gt
252. rol body of an MIBLOCK MIVAR or MISQL tag The depth indicates the number of levels to exit from Truncates the real number value to an integer by discarding any fractional part Adds the HTTP header name with the value to an AppPage For more information see Adding HTTP Headers to AppPages on page 13 3 If expr is nonzero evaluates and returns dotrue 2 of 6 Using Variable Processing Functions in AppPages 8 5 Variable Processing Functions Function Eexpr dotrue dofalse INDEX which string ISNOVALUE num ISNULL num ISINT value ISNUM value LOWER string MOD valuel value2 NC string1 string2 NE string1 string2 NOT value 8 6 IBM Informix Web DataBlade Module Application Developer s Guide Returns If expr is nonzero dotrue is evaluated and returned Otherwise evaluates and returns dofalse The branch not chosen by expr is not evaluated The parameter string is assumed to contain one or more values delimited by a comma The numeric value which selects one of these values to be extracted Numbering of the items in string begins with 0 Determines if column num has no value Determines if column num current value is null If value is an integer returns 1 otherwise returns 0 A number that is of equal value to an integer such as 1 0 evaluates to 1 If value is numeric returns 1 otherwise returns 0 Returns string converted to
253. s Intro 5 Special characters in dynamic tags 9 21 in variable expressions 8 17 in Web DataBlade module tags 6 51 6 52 Specifying a row index 6 8 Specifying largest AppPage C 9 Specifying URL encoded characters C 9 SQL attribute of MISQL tag 6 5 SQL attribute of MISQL tag 6 6 STEP attribute of MIBLOCK tag 6 30 STRFILL variable processing function 8 8 String variable processing functions 8 3 STRLEN variable processing function 8 8 SUBSTR variable processing function 8 8 Syntax errors WebLint 12 8 Index 5 ABCODEFGAHA System dynamic tags CHECKBOXLIST 9 8 RADIOLIST 9 11 SELECTLIST 9 15 System requirements database Intro 5 software Intro 5 System tables WebConfigs C 5 System variables 6 7 to 6 14 7 TAG attribute of MIERROR tag 6 41 Tags CHECKBOXLIST 9 8 dynamic 9 3 FORM 13 14 IMG 13 12 MIBLOCK 6 29 MIELSE 6 38 MIERROR 6 40 to 6 48 MIEXEC 7 9 MIFUNC 7 3 MISQL 6 5 to 6 15 MIVAR 6 27 to 6 28 RADIOLIST 9 11 SELECTLIST 9 15 SGML 1 5 6 3 9 4 system dynamic 9 8 tracing A 6 user defined routine UDR 10 3 Web DataBlade module 1 5 1 9 5 3 6 3 7 3 XML 6 23 Tip icons Intro 9 TO attribute of MIBLOCK tag 6 30 TRACEMSG variable processing function 6 43 8 8 A 6 Tracing Web DataBlade module tags A 6 Tracing Webdriver errors C 2 TRIM variable processing function 8 8 Troubleshooting Webdriver A 2 A 12 JK L MN OP QRS TU VW X Y ze Two pass query processing 13 15 U UDR user defined routine 10 3
254. s no xml extension in the list then you must add one to the wbExten sions table To add an xml extension to the wbExtensions table 1 In APB click Add Extension from the admin menu AppPage and type the values for the text boxes shown in the following table TextBox Value Extension XML Name XML Page Source Table wbPages Super Type text Sub Type xml ID Column ID Content Column object Path Column path Retrieval Method WebExplode Using Tags in AppPages 6 23 Generating XML Formatted Data 6 24 2 Click Save APB adds the xml extension to the wbExtensions table and you are ready to create an AppPage that generates XML formatted data Important Currently the only browser that can use XML data is Microsoft Internet Explorer Version 5 The examples in the following sections use this table and data CREATE TABLE people id INTEGER name VARCHAR 30 i INSERT INTO people VALUES 1 Mary Smith INSERT INTO people VALUES 2 John Grant Using Your Own XML Tags The following AppPage shows how you can generate XML formatted data from the data in the people table lt xml version 1 0 gt lt TABLE_DATA gt lt MISOL SQL select id name from people gt lt ROW_DATA ID SMI_CURRENTROW gt lt ID_DATA gt 1 lt ID_DATA gt lt NAME_DATA gt 2 lt NAME_DATA gt lt ROW_DATA gt lt MISQL gt lt TABLE_DATA gt When you invoke this AppPa
255. sed If however you set MI_WEBEXPLODE_DEPTH to 100 the AppPage calls itself 100 times and then stops Variable Mandatory Content MI_WEBEXPLODE_DEPTH No Limits the number of times an AppPage can call itself recursively C 30 IBM Informix Web DataBlade Module Application Developer s Guide Notices IBM may not offer the products services or features discussed in this document in all countries Consult your local IBM repre sentative for information on the products and services currently available in your area Any reference to an IBM product program or service is not intended to state or imply that only that IBM product program or service may be used Any functionally equivalent product program or service that does not infringe any IBM intellectual property right may be used instead However it is the user s responsibility to evaluate and verify the operation of any non IBM product program or service IBM may have patents or pending patent applications covering subject matter described in this document The furnishing of this document does not give you any license to these patents You can send license inquiries in writing to IBM Director of Licensing IBM Corporation North Castle Drive Armonk NY 10504 1785 U S A For license inquiries regarding double byte DBCS information contact the IBM Intellectual Property Department in your country or send inquiries in writing to IBM World Trade Asia Corpo
256. ser name password combinations so users can change their passwords within a Web application use the Web DataBlade Module Admin istration Tool to set the Webdriver variable listed in the following table Name of Variable in Versions 3 3 and Previous MI_WEBAUTHCACHE Mandatory Yes Description Allows you to reset user name and password combinations so users can change their passwords within an application You can set the auth_cache Webdriver variable to three values on off and check The default value is on If you set the variable to on Webdriver always uses the password value in the Web server cache If you set the variable to off Webdriver always uses the password value in the database If you set the variable to check and the value in the Web server cache is different from the Web browser value Webdriver updates the Web server cache with the password value in the database Web DataBlade Module Variables C 11 Enabling NSAPI ISAPI and Apache Security Variable Name Enabling NSAPI ISAPI and Apache Security To use the security features of the Netscape Web server Microsoft Internet Information Server or Apache Web Server use the Web DataBlade Module Administration Tool to set the Webdriver variables listed in the following table Name of Variable in Versions 3 3 and Previous Mandatory Content Mlusertable Same Yes Name of the table that contains user access information
257. signment the tag is equivalent to an MIVAR tag with no NAME attribute and the text between start and end tags is output Default is TAG MIVAR COND No Tag is enabled only if this condition evaluates to true nonzero ERR No Specifies how an error should be processed Because multiple errors can occur on an AppPage use the ERR attribute to link the error processing to a particular MIERROR tag For more information on the COND attribute see MIBLOCK Tag on page 6 29 6 40 IBM Informix Web DataBlade Module Application Developers Guide TAG Attribute The following table lists the variables that become active when the body of the MIERROR tag is executed Variable When Set Description MI_ERRORCODE On error Error code returned from the SOL statement All WebExplode errors return an error code of 937 For explanations of error codes see IBM Informix Error Messages MI_ERRORSTATE On error SOLSTATE returned from the SOL statement when an error occurs MI_ERRORMSG On error Error message returned from the SQL statement TAG Attribute When an error occurs and the WebExplode function invokes an MIERROR tag the tag behaves like an MISQL MIVAR or dynamic tag depending on the TAG attribute Use the TAG MISQL attribute assignment to execute the SOL statement specified in the SQL attribute The following example shows how to use the TAG attribute The SELECT statement specified in the SOL attribute
258. sing the set of rows returned from a SELECT statement The scope of the RESULT attribute does not extend beyond the MISQL tag See RESULTS Attribute on page 6 15 Using Tags in AppPages 6 5 MISQL Tag Attribute Mandatory Description DATASET No Specifies how many rows can be fetched per iteration through the MISQL tag DEFAULT No Default value for any unassigned variables between the start and end MISQL tags This value can be another variable CACHE No Allows you to cache the results of a call to a SQL RESULTS statement within an MISQL AppPage tag PREPARE No Sets up an SQL statement for dynamic execution the variables are substituted with real values at runtime See PREPARE Attribute on page 6 21 For more information on the ERR attribute see MIERROR Tag on page 6 40 For more information on the COND attribute see MIBLOCK Tag on page 6 29 Specify the SQL statement to retrieve or modify database data in the SQL attribute of the MISQL tag Specify formatting information which indicates how to display the results of the SOL statement between the start and end MISQL tags In the following example of an MISQL tag 1 refers to the first column returned by the SELECT statement in this case name and 2 refers to the second column in this case company lt MISOL SOL select name company from customers gt 1 2 lt MISQL gt The following section describes how to format the results of the S
259. specific information Icon Description Identifies information that is specific to Windows Windows operating systems Identifies information that is specific to UNIX operating systems These icons can apply to a row in a table one or more paragraphs or an entire section A symbol indicates the end of the platform specific information Introduction 9 Screen Illustration Conventions Screen llustration Conventions The illustrations in this manual represent a generic rendition of various windowing environments The details of dialog boxes controls and windows have been deleted or redesigned to provide this generic look Therefore the illustrations in this manual depict Web browser output a little differently than the way it appears on your screen Additional Documentation This section describes the Web DataBlade module documentation available from Informix m Printed documentation m Online documentation Printed Documentation The following Informix manuals are part of the IBM Informix Web DataBlade module documentation set and provide more information about the DataBlade module m The IBM Informix Web DataBlade Module Application Developer s Guide describes how to develop Web enabled database applications that dynamically retrieve data from the Informix database m The IBM Informix Web DataBlade Module Administrator s Guide describes how to administer Web applications that use the Web DataBlade modu
260. ss when the form is submitted If upload_directory is not set the uploaded files are placed in the tmp directory by default After Webdriver finishes processing the AppPage the uploaded file is removed from the upload_directory directory Submitting the Form When you submit the form you can access the following variables in the AppPage that processes the form Variable Name Description input_file Full pathname of the uploaded file on the Web server machine input_file_name Full pathname of the client file input_file_type MIME type of the uploaded file may be unknown IBM Informix Web DataBlade Module Application Developer s Guide Example In the preceding example if the client file is named D images input_image gif the following variables are accessible in the process_file AppPage Variable Name Assignment input_imagel local Web uploads input_image1 PID input_imagel_name D images input_image gif input_imagel_type image gif Use the FileToBlob function to create a large object from the uploaded image For more information about large objects see IBM Informix Guide to SQL Reference If Webdriver is unable to write the file to the directory specified by upload_directory it sets the value of the file variable to MI_ERROR Example The following example illustrates the use of client file upload in which uploaded files are stored in the uploads table with the schema CREATE TABLE uploads name varchar 40
261. ssions to Format Output Conditionally Using Variable Expressions to Format Output Conditionally You can also use variable processing functions to format output conditionally Example of Conditional Output The following varexp2 html AppPage illustrates how a variable expression can be used to process the results of a SELECT statement lt HTML gt lt HEAD gt lt TITLE gt Conditional Output lt TITLE gt lt HEAD gt lt BODY gt lt B gt Display employee names by department lt B gt lt MIVAR NAME LAST gt lt MIVAR gt lt TABLE BORDER 1 gt lt MISQL SOL select b name a first_name a last_name from employees a departments b where a department b name order by b name a last_name gt lt TR gt lt TD gt IF NE 1 SLAST 1 lt TD gt lt TD gt 2 3 lt TD gt S SETVAR SLAST 1 lt TR gt lt MISQL gt lt TABLE gt lt BODY gt lt HTML gt This AppPage queries the employees and departments tables and displays the employees by department The department name is not output when the name has not changed from the previous row retrieved Using Variable Processing Functions in AppPages 8 13 Using Variable Expressions to Format Output Conditionally The following figure shows sample Web browser output Web Browser Conditional Output URL http domain port hr_app Mlval varexp2 htm Display employee names by department manufacturing Betty Pen
262. syntax shows how to use the INTERNAL attribute with the cache_admin function lt MIFUNC INTERNAL cache_admin optionl valuel option2 value2 gt deferred html lt MIFUNC gt Using Advanced AppPage Tags 7 5 INTERNAL Attribute 7 6 The following table shows the possible name value pairs Option Possible Values cache_mode enable disable purge view matchlist name value pairs separated by amp for example name Joe amp id 3 app_page Name of an AppPage cache_password Password if required to administer caching message Name of variable to return result See the IBM Informix Web DataBlade Module Administrator s Guide for an expla nation of the cache administration AppPage and examples of AppPage caching The session_admin Function The session_admin function gives AppPages execution of some session management activities related to the current session The following example shows the proper syntax to use for the INTERNAL attribute with the session_admin function lt MIFUNC INTERNAL session_admin option value gt deferred html lt MIFUNC gt The following table shows the possible name value pair Option Possible Value session_mode clear end IBM Informix Web DataBlade Module Application Developers Guide MIDEFERRED Tag MIDEFERRED Tag The MIDEFERRED tag enables partial page caching for AppPages that contain both static and dynamic sections and that have already been configured for Web
263. t lt MIBLOCK COND gt SBEGIN 1 gt lt MIVAR gt lt A HREF SWEB_HOME MIval walkingl html amp START SBEGIN SWINSIZE amp WINSIZE SWINSIZE gt Previous SWINSIZE Rows lt A gt IF lt MI_ROWCOUNT SWINSIZE No More Rows lt MIVAR gt lt MIBLOCK gt lt MIBLOCK COND AND gt SEND SWINSIZE gt MI_ROWCOUNT WINSIZE gt lt MIVAR gt lt A HREF SWEB_HOME MIval walkingl html amp START SEND amp WINSIZE SWINSIZE gt Next SWINSIZE Rows lt A gt lt MIVAR gt lt MIBLOCK gt lt BODY gt lt HTML gt Using Variable Processing Functions in AppPages 8 15 Using Variable Expressions to Format Output Conditionally This example queries the systables table and displays only the rows that are within the current data window The WebExplode function suppresses the display of a row when the row is not within the current data window The following figure shows the Web browser output for the first set of rows retrieved Figure 8 4 Web Browser Walking Window Walking Window 1 alking Window URL http domain port hr_app Mlval walking htm wbExtensions wbPages wbPageVersions Next 4 Rows The following figure shows the Web browser output for the next set of rows retrieved Web Browser Walking Window i see pe alking Window URL http domain port hr_app Mlval walking htm wbBinaryVersions wbResProjects
264. t ebLin e VIEW EDIT 1 error Tag lt MIVAR gt begins before previous tag lt MIVAR gt ends lt MIVAR gt title lt MIVAR gt A E A v 4 Tip You can attempt to execute an AppPage even if WebLint reports errors in the AppPage You can execute the WebLint function on the file that contains an AppPage directly from the operating system prompt Execute the weblint command from the INFORMIXDIR extend web version utils directory or add the INFORMIXDIR extend web version utils directory to your path Then enter the following command weblint level lt AppPage_file Using DataBlade Module Functions in AppPages 12 9 WebLint Alternately you can enter this command cat AppPage_file weblint level 12 10 IBM Informix Web DataBlade Module Application Developer s Guide WebRelease WebRelease The WebRelease function returns the version of the Web DataBlade module Syntax WebRelease returns LVARCHAR Arguments None Example The following webrelease html AppPage calls the WebRelease function to display the version number and date of the Web DataBlade module lt HTML gt lt HEAD gt lt TITLE gt WebRelease Example lt TITLE gt lt HEAD gt lt BODY gt lt B gt The current version of the Web DataBlade module is lt B gt lt MISQL SOL execute function WebRelease gt 1 lt MISQL gt lt BODY gt
265. t lt HEAD gt lt BODY gt lt Show columns of employees table in a form gt lt with multi value check box Turn checked gt lt columns into a comma separated list A lt MIVAR NAME column_headers gt lt MIVAR gt lt HR gt lt STRONG gt Select Columns from Employees Table lt STRONG gt lt BR gt lt MIVAR gt lt FORM METHOD POST ACTION SWEB_HOME gt lt MIVAR gt lt MISQL SQL select a colname colno from syscolumns a systables b where a tabid b tabid and b tabname employees order by colno gt lt INPUT TYPE CHECKBOX NAME column_list VALUE 1 gt 1 lt MISQL gt lt INPUT TYPE HIDDEN NAME MIval VALUE table_prog html gt lt INPUT TYPE SUBMIT VALUE Get Rows gt lt HR gt lt FORM gt lt On the second time through the form aan lt retrieve the selected columns from the Se lt database display in table format SS lt MIVAR COND NXST column_list NAME column_list gt lt MIVAR gt lt MIBLOCK COND NOT EQ column_list gt lt MIVAR NAME Sselect_list gt SEPARATE Scolumn_list lt MIVAR gt lt MIVAR NAME column_headers gt REPLACE select_list lt TH gt lt TH gt lt MIVAR gt lt TABLE BORDER gt lt TR gt lt TH gt lt MIVAR gt Scolumn_headers lt MIVAR gt lt TH gt lt TR gt lt MISQL SOL select select_list from employees order by 1 gt lt TR gt lt TD gt lt TD gt lt TR gt lt MISQL gt lt
266. t TD gt lt A HREF SWEB_HOME LO 2 amp t ype 3 gt 1 lt A gt lt TD gt lt TD gt 4 lt TD gt lt TR gt lt MISQL gt lt TABLE gt lt BODY gt lt HTML gt 13 10 IBM Informix Web DataBlade Module Application Developer s Guide Example The following example shows sample Web browser output Figure 13 3 Web Browser File Upload Form File Upload F ile Upload Form URL http domain port hr_app Name File _ CALOGOS GRAYLOGO gif Insert New Object Inserted 1 new objects The SQL executed was INSERT into uploads VALUES graylogo image gif File ToBlob tmp upload 008987 client uploads object C LOGOS GRAYLOGO gif Here are all of the uploaded objects bookmark C NETSCAPE Program Bookmark htm graylogo C LOGOS GRAYLOGO gif v HN gt Using Other Webdriver Features 13 11 Passing Image Map Coordinates Passing Image Map Coordinates Set the MImap variable to enable image map coordinates to be passed to AppPages Variable Mandatory Content MImap Yes Set to on or off When on the URL is treated as an image map and the values are passed as x and y coordinates Default is off Important MImap must be set in the URL that invokes the AppPage MImap must not be set as a Webdriver variable in a Webdriver configuration There are two ways to pass image map coordinates within a Web
267. t as a MI_DATUM object In your C program cast this MI DATUM object to an MI_LVARCHAR object Remember to use the mi_routine_end DataBlade API function to release the resources associated with the mi_routine_get function See the sample C program at the end of this section for an example of using these API functions For detailed information on the functions and data types of the DataBlade API refer to the DataBlade API Programmer s Manual Using DataBlade Module API Functions in AppPages 14 5 WebHtmiToBuf Return Values A pointer to the MI_LVARCHAR object that contains the contents of the converted HTML object Example The following example C program shows how to use the WebHtmlToBuf API routine to convert the contents of the HTML object html into an MI_LVARCHAR object The example uses the DataBlade API routines mi_routine_get mi_routine_exec and mi_routine_end include lt stdio h gt include lt ctype h gt include lt string h gt include lt stdlib h gt include lt mi h gt include lt alloca h gt include lt assert h gt BRR KIRK KKK IK RR IR IR RII I ORR II IO OR KK k k htmlToLVarchar conn html mi_lvarchar htmlToLVarchar MI_CONNECTION conn mi_lvarchar html MI_FUNC_DESC routineFunctDesc MI_DATUM data mi_integer error routineFunctDesc mi_routine_get conn 0 function WebHtmlToBuf html if routineFunctDesc NULL printf mi_routin
268. t you wish from the list below AppPage Audio Document Dynamic Tag Image User Defined Routine Ta Video User Name Default Project TEXTAREA Width Versioning default getting started 80 Off User Level Default Object TEXTAREA Height WebLint Checking 0 AppPage 20 Off 2 8 IBM Informix Web DataBlade Module Application Developer s Guide Steo 3 Create the First AppPage of Your Application 2 Click AppPage The Add AppPage AppPage appears Web Browser APB Add AppPage Figure 2 4 APB Add AppPage URL http domain port hr_app Mlval APB20 apb html AppPage Builder 2 0 MainMenu AddObject Edit Object AdminMenu Add AppPage You can base this new AppPage on an existing AppPage to copy from the list below Project APB 2 0 w CONTINUE Path APB20 w Page ID Extension html w CONTINUE SAVE Path Page ID Extension OA a Project Read Level acting anal bd Description AppPage Enter filename to import AppPage from User Name Default Project TEXTAREA Width Versioning default getting started 80 Off User Level Default Object TEXTAREA Height WebLint Checking 0 AppPage 20 Off 4 Web DataBlade Module Tutorial 2 9 Steo 3 Create the First AppPage of Your Application 2 10 Your
269. ta type x Inputs MI_CONNECTION an open connection ae mi_lvarchar a buffer to be converted into an HTML data type Returns either NULL error in conversion a mi_lvarchar the input buffer converted into an HTML data type Notes a This example uses the WebBufToHtml function that is registered i with the database server at the same time that the Web DataBlade x Module is registered mi_lvarchar lVarcharToHtml MI_CONNECTION conn mi_lvarchar buf MI_FUNC_DESC routineFunctDesc MI_DATUM data mi_integer error routineFunctDesc mi_routine_get conn 0 function WebBufToHtml lvarchar if routineFunctDesc NULL return NULL data mi_routine_exec conn routineFunctDesc amp error buf if error MI_ERROR return NULL Using DataBlade Module API Functions in AppPages 14 9 WebBurToHtml mi_routine_end conn routineFunctDesc release resources return mi_lvarchar data 14 10 IBM Informix Web DataBlade Module Application Developer s Guide Debugging Web DataBlade Module Applications The Web DataBlade module is one of many components of your Web enabled applications Other components are your Web browser your Web server and the Informix database You can use a variety of techniques to resolve problems with creation configuration or execution of Web applications m To debug Web applications as you are developing them a Use
270. table contains the following three rows to describe these relationships ID path extension project welcome pages html hr_project welcome pages html sales_project logo images gif hr_project The following CREATE TABLE statement describes the schema of the wbResProject table CREATE TABLE wbResProjects ID VARCHAR 30 path VARCHAR 178 extension VARCHAR 12 project VARCHAR 30 PRIMARY KEY ID path extension project CONSTRAINT wbResProjld FOREIGN KEY project REFERENCES wbProjects name di AppPage Builder Schema B 11 The wblnfo Table The wbInfo Table The wbInfo table stores information about the AppPage Builder database schema and the versioning model used to version AppPages binary objects and dynamic tags The following CREATE TABLE statement describes the schema of the wbInfo table CREATE TABLE wbInfo name VARCHAR 80 value VARCHAR 254 description VARCHAR 254 PRIMARY KEY name CONSTRAINT wbInfoName di B 12 IBM Informix Web DataBlade Module Application Developers Guide The wbUsers Table The wbUsers Table The wbUsers table stores information about users such as their password their level of security when reading AppPages their default project and so on The following CREATE TABLE statement describes the schema of the wbUsers table CREATE TABLE wbUsers name VARCHAR 40 NOT NULL password VARCHAR 40 NOT NULL security_level INTEGER NOT NULL de
271. table if the default set is not adequate For detailed information on how to add a new extension see Adding an Extension on page 4 10 The following CREATE TABLE statement describes the schema of the wbExtensions table CREATE TABLE wbExtensions extension VARCHAR 12 name VARCHAR 30 source_table VARCHAR 18 super_type VARCHAR 18 sub_type VARCHAR 18 ID_column VARCHAR 18 content_column VARCHAR 18 retrieval_method INTEGER path_column VARCHAR 18 PRIMARY KEY extension CONSTRAINT wb_extension dF IBM Informix Web DataBlade Module Application Developer s Guide The wbPages Table The wbPages Table The wbPages table stores your AppPages The ID path and extension columns uniquely identify an AppPage AppPages always have an extension of html or htm You can also store simple text files extension txt in the wbPages table The AppPage itself is stored in the object column which is of data type HTML AppPage Builder also stores other information about the AppPage such as a description of the AppPage when it was last changed and the user who last changed it The following CREATE TABLE statement describes the schema of the wbPages table CREATE TABLE wbPages ID VARCHAR 30 path VARCHAR 178 extension VARCHAR 12 description VARCHAR 254 author VARCHAR 30 keywords VARCHAR 254 current_version INTEGER last_changed datetime year to second last_changed_
272. tag Specify an ERR attribute in an MISQL MIVAR or MIBLOCK tag to invoke an MIERROR tag with a matching ERR attribute when an error occurs For example define an MIERROR tag as follows lt MIERROR ERR BADTABLENAME TAG MISOL SOL select error_msg from my_weberr_catalog where error_id BADTABLENAME gt 1 lt MIERROR gt The WebExplode function invokes this error handler if an error occurs during the processing of an MISQL or MIVAR tag the COND attribute of an MIBLOCK tag or dynamic tag with the same ERR attribute assignment ERR BADTABLENAME If the following MISQL tag generates an error when it is executed the preceding MIERROR tag with the matching ERR attribute is invoked lt MISQL ERR BADTABLENAME SQL select count from STABLE_NAME gt 1 lt BR gt lt MISQL gt If no MIERROR tag with a matching ERR attribute precedes the MISQL MIVAR MIBLOCK or dynamic tag that generates an error in the AppPage the WebExplode function invokes the generic error handler described in the following section 6 42 IBM Informix Web DataBlade Module Application Developer s Guide Creating a Generic Error Handler Creating a Generic Error Handler A generic error handler is an MIERROR tag without an ERR attribute Create a generic error handler to be invoked if an error occurs during the processing of a tag that has no ERR attribute or an invalid ERR attribute The following example of a generic error handler l
273. th the RESULTS attribute separated by a dot If you set RESULTS to myout put then the following example shows how to access the second column of the resulting set of rows Smyoutput 2 Using Tags in AppPages 6 15 RESULTS Attribute If a namespace is declared the data is accessible only through that namespace If you have declared a namespace with the RESULTS attribute you should not write into that namespace The following table lists the variables that should not be used with the RESULTS attribute within an MISOL statement Variable When Set Description MI_COLUMNCOUNT On execution MI_CURRENTROW On current row MI_ROWCOUNT After execution Number of columns retrieved in the SQL statement Current formatted row being displayed during execution of the SOL statement Set to the number of formatted rows displayed after the MISQL tag has been executed Number of rows retrieved in the SQL statement Updated after processing is complete SQL statement executed MI_SQL On execution tables Name Joe Mary Item Food Art If for example you used the RESULTS attribute and the MI CURRENTROW variable within a single MISOL statement an undefined variable error is returned or the MI_CURRENTROW is returned from a previous MISQL tag without the RESULTS attribute For an example of a nested MISQL statement consider the following two Money 10 11 Cost 6 16 IBM Informix Web DataBlade Module
274. the NSAPI and Apache Webdrivers anchorvar should always be set to WEB_HOME with a trailing forward slash For the ISAPI Webdriver the variable should be set to WEB_HOME drvisapi d11 For the CGI Webdriver the variable should be set to WEB_HOME webdriver Since anchorvar is always set to WEB_HOME you can always use WEB_HOME as an anchor variable in any AppPage driverdir No Specifies the directory that Webdriver uses to internally coordinate its interaction with the Web server The default value of this variable is tmp This variable is only used by the Apache and CGI implementations of Webdriver debug_file No Specifies the full pathname of the log file to which Webdriver messages are written debug_level No Enables Webdriver tracing to the log file specified by the debug_file variable You can override the value of the debug_level variable in the Global section of the web cnf file by setting it in your Webdriver configu ration using the Web DataBlade Module Administration Tool 1 of 2 C 2 IBM Informix Web DataBlade Module Application Developers Guide Variable maxcharsize Mandatory No The Global Section of the web cnf File Description When set to a value greater than 1 each character sent to the WebEx plode function is URL encoded If this variable is not set Webdriver URL encodes only special characters such as amp before sending it to the WebExplode function It is recommende
275. the database exception returned by WebExplode When off Webdriver displays the HTTP 1 0 500 Server error message Default is of f Managing Cookies Use the Web DataBlade Module Administration Tool to set the following Webdriver variable to specify the cookies that Webdriver recognizes Name of Variable in Versions 3 3 and Variable accept_cookie Previous Mandatory Description MI_WEBACCEPTCKI No Use the Web DataBlade Module Administration Tool to set the accept_cookie Webdriver variable to the name of cookies that your Web DataBlade module application uses All other cookies are ignored by Webdriver Multiple cookie names are separated by commas If you do not use this variable Webdriver assumes all cookies in the browser are part of the Web application C 24 IBM Informix Web DataBlade Module Application Developer s Guide Uploading Client Files Uploading Client Files Use the Web DataBlade Module Administration Tool to set the following Webdriver variable to upload client files Name of Variable in Variable Versions 3 3 and Previous Mandatory Content upload_directory MI_WEBUPLOADDIR No Directory on the Web server machine in which uploaded files are placed Default is tmp Passing Image Map Coordinates Set the MImap variable to enable image map coordinates to be passed to AppPages Variable Mandatory Content MImap Yes Set to on or off When on the URL is treated as an image map and the v
276. the following syntax Or enter the name of a table in the text box to see its columns lt br gt lt FORM METHOD post ACTION lt MIVAR gt SWEB_HOME lt MIVAR gt gt lt MIVAR NAME table gt lt MIVAR gt lt MIVAR gt lt INPUT TYPE INPUT SIZE 40 NAME table VALUE Stable gt lt MIVAR gt lt INPUT TYPE SUBMIT VALUE See columns gt lt INPUT TYPE HIDDEN NAME MIval VALUE page3 html gt lt FORM gt IBM Informix Web DataBlade Module Application Developer s Guide Step 4 Create the Second AppPage of Your Application For more information on linking AppPages using the ANCHOR and FORM tags refer to How to Link AppPages on page 3 11 For more information on using the MIVAR tag refer to MIVAR Tag on page 6 27 Step 4 Create the Second AppPage of Your Application The second AppPage of your application is linked to the first page by the ANCHOR tag It displays all the system catalog tables in an HTML table If you clicked the word here in the welcome html AppPage you used the ANCHOR tag method to link to a second AppPage If you entered a specific table name in the text box and clicked See columns you used the FORM tag method to link directly from your welcome html AppPage to a third AppPage This section describes how to create that second AppPage To create the second AppPage of the application 1 Click Add Object The Add Object AppPage appears showing getting_started as your default project 2
277. the trace file within your AppPages as follows lt MIVAR gt TRACEMSG You encountered the error MI_ERRORMSG lt MIVAR gt IBM Informix Web DataBlade Module Application Developer s Guide Enabling Webdriver Tracing Enabling Webdriver Tracing To enable Webdriver tracing set the Webdriver variables debug_file and debug_level in the Global section of the web cnf file The following table describes each variable Variable Description debug_level Enables Webdriver tracing to the log file specified by the debug_file variable For a full list of possible values for this variable refer to the table on page A 10 debug file Specifies the full pathname of the log file to which Webdriver writes messages debug_level Variable You can also set the debug_level Webdriver variable for your Webdriver configuration using the Web DataBlade Module Administration Tool The value of the debug_level Webdriver variable if set for your Webdriver configuration overrides the value of the variable in the Global section of the web cnf file For detailed information on using the Web DataBlade Module Adminis tration Tool to set Webdriver variables refer to IBM Informix Web DataBlade Module Administrator s Guide Debugging Web DataBlade Module Applications A 9 debug_level Variable A 10 Webdriver variable Trace Value 1 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768 The following table lists
278. ting the WEB virtual processor refer to the IBM Informix Web DataBlade Module Administra tor s Guide 5 Inyour AppPage add an MIEXEC tag that sets the SERVICE attribute to the commands needed to find and execute the Perl program Specifically set the SERVICE attribute to the command needed to change to the directory that contains the Perl program you want to execute and then to the command needed to execute the Perl pro gram Use the full pathname of the perl binary Use user defined attributes to the MIEXEC tag to specify parameters to the Perl program The following example shows how to use the MIEXEC tag in an AppPage lt MIVAR NAME SRVC gt cd local perlscripts usr local bin perl SERVE pl lt MIVAR gt lt MIEXEC SERVICE SRVC REQUEST UPPER gt This text when part of the MIEXEC tag is in MiXeD cASE lt MIEXEC gt For a detailed explanation of this example and other examples of using the MIEXEC tag in an AppPage refer to the next section 7 12 IBM Informix Web DataBlade Module Application Developer s Guide Examples of Using the MIEXEC Tag Examples of Using the MIEXEC Tag This section provides examples of using the MIEXEC tag in an AppPage to execute the SERVE pl sample Perl program The SERVE pl Perl program is described in detail in Sample Perl Program SERVE pl on page 7 15 Familiarize yourself with the program before you continue with this section The SERVE pl Perl program accepts t
279. tions Handling Errors with the MI_ DRIVER_ ERROR Variable Handling Errors with the MI_DRIVER_ERROR Variable Set the following Webdriver variables with the Web DataBlade Module Administration Tool to modify the error messages seen by the browser as different types of errors are encountered Name of Variable in Versions 3 3 and Previous MI_WEBSHOWEXCEPTIONS Mandatory No Content Set to on or off When on Webdriver displays the database exception returned by the WebEx plode function When off Webdriver displays the HTTP 1 0 500 Server error message Default is off redirect_url MI_WEBREDIRECT Set to the URL to redirect users to if they do not have access to the AppPage they attempt to retrieve error_page MI_WEBERRORPAGE No Set to the value of the AppPage that contains error handling routines Web DataBlade Module Variables C 23 Displaying Database Errors in a Browser Variable Displaying Database Errors in a Browser To display database errors in your browser instead of the generic HTTP 1 0 500 Server error error use the Web DataBlade Module Administration Tool to set the following Webdriver variable for your Webdriver configuration Name of Variable in Versions 3 3 and Previous Mandatory Content show_exceptions MI_WEBSHOWEXCEPTIONS No Use the Web DataBlade Module Administration Tool to set the show_exceptions variable to on or off When on Webdriver displays
280. tions on how to invoke APB in your browser see Invoking AppPage Builder on page 4 5 The application you create in the following tutorial consists of three linked AppPages The application queries the database for user tables and for each user table shows the columns of the selected table Overview of the Process This tutorial consists of six steps Add a project Create a user dynamic tag Create the first AppPage welcome page Create the second AppPage shows system catalog tables Create the third AppPage shows names of requested tables Invoke the application The following sections explain each step Web DataBlade Module Tutorial 2 3 Creating an Application with APB Creating an Application with APB AppPage Builder APB is a Web DataBlade module application that enables you to create and maintain the AppPages that make up your Web applica tions You can use APB to create AppPages with any Web browser that supports forms and tables as defined in the HTML 3 0 specification For more information on APB refer to Using AppPage Builder on page 4 1 Step 1 Add a Project If you want to create a Web enabled application using APB you must first add a project A project contains all of the AppPages and other objects associated with your Web application When you first invoke APB the browser displays the following AppPage Figure 2 1 Web Browser APB Main Menu APB Main M Main Menu
281. to generate an XML stream similar to that in the previous section lt MISOL SQL select id name from people XMLDOC TABLE_DATA XMLROW ROW_DATA gt lt MISQL gt When you invoke this AppPage the WebExplode function generates the following XML lt xml version 1 0 gt lt TABLE_DATA gt lt ROW_DATA ID 1 gt lt id gt 1 lt id gt lt name gt Mary Smith lt name gt lt ROW_DATA gt lt ROW_DATA ID 2 gt lt id gt 2 lt id gt lt name gt John Grant lt name gt lt ROW_DATA gt lt TABLE_DATA gt Using Tags in AppPages 6 25 Generating XML Formatted Data 6 26 Note that in lt MISQL XM lt xml v lt TABLE AANA AI lt lt lt lt lt TABLE the preceding XML the XML tags that delineate the columns have the same name as the columns themselves If you want to change the name of the tags that delineate the columns use the AS keyword in your SELECT statement as in SQL select id as ID_DATA name AS NAME_DATA from people LDOC TABLE_DATA XMLROW ROW_DATA gt lt MISQL gt When you invoke this AppPage the WebExplode function generates the following XML ersion 1 0 gt DATA gt ROW_DATA gt id_data gt 1 lt id_data gt name_data gt Mary Smith lt name_data gt ROW_DATA gt ROW_DATA gt id_data gt 2 lt id_data gt name_data gt John Grant lt name_data gt ROW_DATA gt _DATA gt IBM Informix Web DataBlade Module Application Developer s Guide
282. two values show_defer and execute_defer When set to show_defer and you invoke an AppPage with a deferred section Webdriver returns the deferred section in its original form If the Webdriver variable is set to execute_defer Webdriver executes the deferred section when you invoke the AppPage 4 0f 4 Web DataBlade Module Variables C 19 Enabling Large Object Caching Enabling Large Object Caching To set large object caching use the Web DataBlade Module Administration Tool to set the Webdriver variables listed in the following table Name of Variable in Webdriver Variable Versions 3 3 and Previous Mandatory Description cache_directory MI_WEBCACHEDIR Yes Specifies the directory on the Web server computer in which cached large objects are placed If not set large objects are not cached cache_buckets MI_WEBCACHESUB No Specifies the number of subdirectories per database created under the directory specified by cache_directory The default is one subdirectory per database cache_maxsize Variable debug_level MI_WEBCACHEMAXLO No Name of Variable in Versions 3 3 and Previous Description MI_WEBDRVLEVEL Enabling Webdriver Tracing Specifies the maximum size in bytes of large objects to be cached The default is 64 KB The following table describes each variable for enabling Webdriver tracing Enables Webdriver tracing to the log file specified by the debug_file variable debu
283. u persistent variables A variable can be set on one page and retrieved on another These variables are available as long as the session remains active and does not time out Using Variables in AppPages 5 11 How Session Management Assigns an ID to a Browser Instance 5 12 How Session Management Assigns an ID to a Browser Instance There are three methods of assigning a unique ID to a browser Cookies m URL m Auto The first method is through the use of cookies On the first request from a browser Webdriver sends a cookie called session ID to the browser This ID has been given a unique value by Webdriver When the browser makes another request it sends with it that cookie enabling Webdriver to re establish the session Cookies are the best approach to maintaining a session between browser interaction with the Web server and Webdriver The second method requires anchoring the session ID within the page itself so that any URLs pointing to subsequent pages that the user may select contain the ID within their path This method requires more configuration by the user and has implications when using the AppPage cache mechanism For more information on AppPage caching refer to the IBM Informix Web DataBlade Module Administrator s Guide The second method also requires that the browser always hit up an anchor string that contains the session ID As soon as a URL is selected that does not contain this ID the session information
284. ule Application Developer s Guide DLL Attribute Important If two MIFUNC tags are run in the same AppPage be sure that the name space variables are different MIFUNC tags can be nested but for best performance nesting is not recommended DLL Attribute The DLL attribute points to the dynamically linked library DLL that contains the function pointed to by the FUNCTION attribute You use the DLL attribute only in MIFUNC tags in AppPages invoked with the ISAPI Webdriver Other implementations of Webdriver ignore this attribute You can either specify the full pathname of the DLL in the DLL attribute or be sure that the directory that contains the DLL is in your Windows PATH system environment variable INTERNAL Attribute You can invoke two functions that are internal to Webdriver when you use the INTERNAL attribute of the MIFUNC tag These two functions are used for administering AppPage caching and session management and are described in the following sections The cache_admin Variable The Webdriver variable cache_admin allows you to set the name of a page that can call the cache_admin function Set the Webdriver variable cache_admin with the Web DataBlade Module Administration Tool to use the cache administration page provided by the Web DataBlade module Use the cache_admin function to create your own cache administration page rather than use the one provided by the Web DataBlade module The following
285. umn variables 6 7 Comment icons Intro 9 Commercial at in dynamic tags 9 19 9 21 Common Gateway Interface CGI 1 3 COND attribute of dynamic tag 9 5 of MIBLOCK tag 6 30 6 31 of MISQL tag 6 5 of MIVAR tag 6 27 Conditional output using variable expressions 8 13 Conditional statements 6 29 6 31 config_name Webdriver variable C 5 JK L MN OP QRS TU VW X Y ze config password Webdriver variable C 3 config_security Webdriver variable C 5 config user Webdriver variable C 3 Connections to the database specifying maximum C 2 connection_life Webdriver variable C 6 connection_wait Webdriver variable C 6 connect_as_user Webdriver variable C 7 connect_user_max Webdriver variable C 7 Contact information Intro 13 Cookies 13 4 converting into WebBlade variables 13 5 setting 13 4 Counting columns 6 11 Counting rows 6 11 D Data Director for Web 1 10 C 27 database Webdriver variable C 4 DATASET attribute of MISQL tag 6 6 dbconnmax Webdriver variable C 2 dbconntimeout Webdriver variable C 3 Debugging Webdriver A 2 A 12 C 2 C 20 debug_file Webdriver variable C 2 C 20 debug_level Webdriver variable C 2 C 20 DEFAULT attribute of MISQL tag 6 6 of MIVAR tag 6 28 Default locale Intro 6 Dependencies software Intro 5 Display repeated items 6 10 Displaying rows with no value 6 9 Documentation notes Intro 13 2 IBM Informix Web DataBlade Module Application Developer s Guide Double quotes in variable expressions 8 1
286. ur application to anchor HREF tags For example if your appli cation uses WEB_HOME as its anchor WEB_HOME is the value set for this variable If multiple values are required for this variable they should be separated by commas This variable describes how the persistent state is handled If the session code is going to run within the same process this variable needs to refer to the full path of the directory to create session state files This directory must be created and owned by the same user that owns the Web server If the code is going to run as a separate process the variable needs to refer to a port and IP address in the form port ip address This variable is used to define the number of subdirectories that are available to hash the session data if the site is exceptionally large It is only required if session management is being controlled within the same process The default is 100 This variable is used to define the amount of time a session is allowed to continue It measures time from the last update to the session stack if a session stack exists or time from session creation Granularity is in seconds default hours h or days d and uses the same syntax as cache_page_life For more information about AppPage caching refer to the IBM Informix Web DataBlade Module Administrator s Guide Using Variables in AppPages 5 13 Examples of Using Session Variables Important Ifyou are using the ISAPI Webdriver in conjunct
287. ur database Registered and configured the Web DataBlade Module Adminis tration Tool in your database Registered AppPage Builder APB in the database Although you are not required to use APB to develop AppPages this guide refers to it in its examples and assumes that you are using it to build AppPages Created the necessary Webdriver mappings and Webdriver configu rations to begin development Invoked both APB and the Web DataBlade Module Administration Tool in your browser to ensure that the DataBlade module is correctly configured for your database For detailed information on performing the preceding tasks refer to the IBM Informix Web DataBlade Module Administrator s Guide Overview 1 11 Web DataBlade Module Tutorial In This Chapter Overview of the Process Creating an Application with APB Step 1 Add a Project Step 2 Create User Defined Dyn t Tags Step 3 Create the First AppPage of Your Application Step 4 Create the Second AppPage of Your Application Step 5 Create the Third AppPage of Your a f Step 6 Invoke the Application 2 3 2 3 2 4 2 4 2 5 2 8 2 11 2 13 2 14 2 2 IBM Informix Web DataBlade Module Application Developer s Guide In This Chapter This chapter introduces you to the process of creating a Web enabled database application using the IBM Informix Web DataBlade module and AppPage Builder APB This chapter assumes you can invoke APB in your browser For instruc
288. ute an appropriate INSERT statement with the MISQL AppPage tag Within the MISQL AppPage tag set the SERIAL or SERIALS8 attribute to the name of a variable that you can subsequently query to find out what serial number was inserted into the column For example assume you have previously created a table with the following SQL statement CREATE TABLE serialtest id SERIAL id8 SERIAL8 name VARCHAR 20 6 20 IBM Informix Web DataBlade Module Application Developer s Guide PREPARE Attribute The following sample HTML shows how to use the MISOL AppPage tag to insert a row into the serialtest table and then use the MIVAR AppPage tag to return the values that the database server automatically inserted into the two serial columns lt MISOL SERIAL8 serial8var SERIAL serialvar SQL insert into serialtest name values whatever gt lt MISQL gt lt MIVAR gt Value of serial column was serialvar lt MIVAR gt lt p gt lt MIVAR gt Value of the serial8 column was serial8var lt MIVAR gt PREPARE Attribute You use the PREPARE attribute to set up an SQL statement for dynamic execution You embed variables in your query designated by question marks which are substituted by real values at runtime There are many reasons why you might want to prepare an SQL statement first and substitute actual values when you run the statement This section illustrates how to use the PREPARE attribute by describing two situations th
289. veloper s Guide The MIEXEC Tag The MIEXEC Tag The MIEXEC tag enables you to execute a Perl program in your AppPage You pass parameters to the Perl program by specifying user defined attributes to the MIEXEC tag You pass text to the Perl program by including it between the lt MIEXEC gt and lt MIEXEC gt tags If the Perl program returns information the WebExplode function replaces the full MIEXEC tag specification in the AppPage with the returned infor mation before the WebExplode function passes the rendered AppPage to Webdriver Although you can write your own Perl program to use with the MIEXEC tag it is recommended that you start with the sample Perl program presented in Sample Perl Program SERVE pl on page 7 15 and modify it to fit your needs Important To use the MIEXEC tag in your AppPages you must have previously started a WEB virtual processor You start a virtual processor by updating the ONCOMNFIG file with the appropriate VPCLASS entry and restarting the database server For detailed information on adding the WEB virtual processor to your database server refer to the IBM Informix Web DataBlade Module Administrator s Guide The MIEXEC tag has the following tag attributes Attribute Mandatory Description SERVICE Yes Specifies how to invoke the Perl program you want to execute For detailed information about using the SERVICE attribute r
290. vironment variables in the Setvar section of the web cnf file The following Informix environment variables are discussed in the IBM Informix Web DataBlade Module Administrator s Guide m INFORMIXSERVER mg INFORMIXDIR For a complete list of the Informix environment variables you can set in the Setvar section of the web cnf file refer to IBM Informix Guide to SQL Reference Important Do not set the Informix environment variables DBDATE and DBCENTURY in your web cnf file Their settings will be ignored Instead set them in your environment before you register the DataBlade module in your database The Map Section of the web cnf File The following table lists all the variables that can be included in the Map section of the web cnf file Map Variable Mandatory Description database Yes The name of the database to which Webdriver connects when a URL prefix specifies this Webdriver mapping user Yes The name of the user who connects to the database specified by the database variable password Yes The encrypted password of the user specified by the user variable password_key Yes The key that Webdriver uses to decrypt the password specified by the password variable 1 of 2 C 4 IBM Informix Web DataBlade Module Application Developers Guide Map Variable Mandatory The Map Section of the web cnf File Description server No The Informix database server to use when making the connection to the database If t
291. web 4 13 UC1 the UNIX command to change to the correct directory is cd local informix extend web 4 13 UC1 apb2 4 4 IBM Informix Web DataBlade Module Application Developer s Guide Invoking AppPage Builder Create the APB schema by executing the schema_create utility passing it the name of your database and the name of the sbspace in which the APB AppPage are stored For example to create the APB schema in a database called web40 and store the AppPages in the sbsp1 sbspace execute the following command at the operating system prompt createAPB20_DDW20schema web40 sbspl Load the APB data which includes AppPages and GIF into the database by executing the loadAPB20application utility For example to load the APB data into the web40 database execute the following command at the operating system prompt loadAPB20application web40 For detailed information on these utilities refer to the IBM Informix Web DataBlade Module Administrator s Guide Invoking AppPage Builder There are two ways to invoke APB in your browser Specify the URL prefix specially created to invoke APB in your URL This URL prefix maps to a Webdriver mapping that specifies the apb Webdriver configuration Use any URL prefix that maps to any Webdriver mapping other than the Webdriver mapping used to invoke the Web DataBlade Module Administration Tool and specify the text MIval APB20 apb html in the URL Both methods are described in the f
292. your database server registering the DataBlade module in a database and configuring Webdriver for your database For more infor mation on performing these administrative tasks refer to the IBM Informix Web DataBlade Module Administrator s Guide This section discusses the organization of the manual the intended audience and the associated software products that you must have to develop applica tions using the Web DataBlade module Introduction 3 Organization of This Manual 4 Organization of This Manual This manual includes the following chapters Chapter 1 Overview provides an overview of the architecture and features of the Web DataBlade module Chapter 2 Web DataBlade Module Tutorial describes the process of creating a Web enabled database application using the IBM Informix Web DataBlade module and AppPage Builder APB Chapter 3 Basics of AppPage Development describes the basic elements of AppPages the HTML pages that make up your Web enabled database application These basic elements include how to invoke an AppPage how to link one AppPage to another and how to retrieve large objects currently stored in a database table into an AppPage Chapter 4 Using AppPage Builder describes how to create and maintain Web DataBlade module applications using AppPage Builder Chapter 5 Using Variables in AppPages describes how to use Web DataBlade module variables to create Web enabled
Download Pdf Manuals
Related Search
Related Contents
Case Study Steuergerät Samsung GT-S5560 Manual de Usuario(TCE) Mostrar - Siemens Support CSP-3000(SE) OD500 User Manual Rev 1.1 取扱説明書 - ニチリョー Copyright © All rights reserved.
Failed to retrieve file