The Retargetable Server Pages Manual

Sam Jervis


Table of Contents

Introduction
I. The RSP Compiler
1. Installation
Prerequisites
Installation
2. Running the Compiler
Command Line Invocation
Using the Compiler as an Ant Task
Dependency Tracking
Code Generation Targets
Specifying Compiler Options
II. RSP Programmer's Guide
3. Basic Syntax
Escaping From HTML
Comments
Hyperlinks
Dynamic Hyperlink Translation
Including Header Files
4. Basic Types
Introduction
Integers
Doubles
Boolean
Strings
Objects
Arrays
5. Variables
Introduction
Declarations
Initialization
Variable Scope
Arrays
Constants
Visibility of Built-in Symbols
6. Expressions
Atomic Values
LValues
Operators
Operator Precedence
The new Operator
Increment and Decrement Operators
Type Casts
Arithmetic Operators
Comparison Operators
Logical Operators
Assignment Operators
7. Control Structures
if
while
do...while
for
break
continue
return
Compound Statements
8. Functions
Defining Functions
Function Calls
Library Functions
9. Writing Web Applications
Session Management
Using Session Variables
Clearing Session Variables
Enumerating Session Variable
Accessing Databases
Data Sources
Connections and Recordsets
Database Metadata
III. API Reference
I. Functions
asc - finds the ASCII value of a string character
chr - return a character with a given ASCII value
clearsession - clears a single session variable, or all session variables
error - get/set the RSP error message
getdatasources - enumerate available data sources
header - send raw HTTP headers
hex - convert an integer to an hexadecimal string
htmlencode - convert special characters to HTML entities
lower - convert a string to lower case
ltrim - remove leading whitespace
oct - convert an integer to an octal string
pad - pad a string up to a specified length
padleft - prefix a string up to a specified length
print - send text to the response
random - generates a random number
repeat - repeat a string
request - retrieve form data
rtrim - remove trailing whitespace
session - read a session variable
sessionkeys - returns an array of all the session variable names
setsession - set a session variable
strlen - finds the length of a string
substr - extract a portion of a string
translate - convert an RSP page name into a page name in the target language
trim - remove leading and trailing whitespace
upper - convert a string to upper case
urlencode - convert non-alphanumerics to URL encoded escape sequences
II. The Array Pseudo-Object
Array.length - find the length of an array
Array.resize - find the length of an array
III. The Connection Object
Connection - open a database connection
close - close a database connection
Connection.execute - execute an SQL update query
Connection.getmetacolumn - get the names of columns in meta data recordsets
Connection.isselect - determine if an SQL statement is a select or an update
Connection.openrs - execute an SQL select statement and return the recordset
Connection.opentablesrs - get a list of database tables
IV. The Recordset Object
Recordset.close - close an open recordset
Recordset.eof - determine if the cursor is after the last record
Recordset.fieldname - get the name of a particular field
Recordset.getstring - get the value of a particular field as a string
Recordset.goto - jump to a particular row in a recordset
Recordset.isnull - determine if a field contains SQL NULL
Recordset.next - move the recordset cursor on to the next row of the recordset
Recordset.numfields - get the number of fields in a recordset
Recordset.row - get the current row index
Recordset.rows - get the number of rows in the recordset
V. Constants
Database Type Constants - string constants for database types
Meta Column Constants - constants for database meta information columns
Script Constants - general constants available to running scripts
Glossary

List of Tables

2.1. Summary of Compiler Options
5.1. Default Initializations
6.1. Operator Precedence Table
6.2. Type Conversion Table
5. Database Type Constants
6. Meta Column Constants
7. Script Constants

List of Examples

2.1. Invoking the Compiler from Apache Ant
3.1. Escaping HTML
3.2. RSP comments
3.3. Hyperlink translation
3.4. Inclusion Example
5.1. Variable Declarations
5.2. Arrays Example
5.3. Constant Example
6.1. Increment/Decrement Example
6.2. Type Casts Example
6.3. Arithmetic Example
6.4. Arithmetic Example
6.5. Logical Operators Example
6.6. Assignments Example
7.1. if statement syntax
7.2. if...else statement syntax
7.3. while statement syntax
7.4. do...while statement syntax
7.5. for statement syntax
7.6. Translation of a for loop into a while loop
7.7. break syntax
7.8. continue syntax
7.9. return syntax
8.1. Function Declaration Syntax
8.2. Function Call Examples
8.3. Call-by-value Example
9.1. Example databases.inc.php file
9.2. Example databases.inc.asp file
9.3. Example databases.inc.jsp file
30. asc Example
31. chr Example
32. clearsession Example
33. error Example
34. getdatasources Example
35. header Example
36. hex Example
37. htmlencode Example
38. lower Example
39. ltrim Example
40. oct Example
41. pad Example
42. padleft Example
43. print Example
44. random Example
45. repeat Example
46. request Example
47. rtrim Example
48. session Example
49. sessionkeys Example
50. setsession Example
51. strlen Example
52. substr Example
53. translate Example
54. trim Example
55. upper Example
56. urlencode Example
57. Array.length Example
58. Array.resize Example
59. Connection Example
60. Connection.execute Example
61. Connection.getmetacolumn Example
62. Connection.isselect Example
63. Connection.openrs Example
64. Connection.opentablesrs Example
65. Recordset.close Example
66. Recordset.eof Example
67. Recordset.fieldname Example
68. Recordset.getstring Example
69. Recordset.goto Example
70. Recordset.isnull Example
71. Recordset.next Example
72. Recordset.numfields Example
73. Recordset.row Example
74. Recordset.rows Example