Previous Next Table of Contents

8. Listing of Macro Directives

8.1 HTML_START

Usage: HTML_START

Description: Whatever you put between HTML_START and HTML_END gets printed to stdout. You can incorporate C++ variables in between $

8.2 HTML_END

Usage: HTML_END

Description: Closes HTML_START

8.3 HTML_INCLUDE

Usage: HTML_INCLUDE(file)

Description: Equivalent to pasting the contents of the file between HTML_START and HTML_END

8.4 MAIN_START

Usage: MAIN_START

Description: embeds main() , and writes the code to send the HTTP header according to the settings determined by previous macros seen.

8.5 MAIN_END

Usage: MAIN_END

Description: Closes the body of main()

8.6 SQL_DB_DRIVER

Usage: SQL_DB_DRIVER(database)

Description: Specifies which database driver to use. Currently only MySQL is supported. The only valid value is mysql

8.7 SQL_DECL_DBH

Usage: SQL_DECL_DBH(dbh)

Description: Declares a global variable to be used for a connection handle.

8.8 SQL_ON_ERROR

Usage: SQL_ON_ERROR(error_handler)

Description: Specifies the function to invoke when a database call fails.

8.9 SQL_CONNECT

Usage: SQL_CONNECT(host, database, user, pass)

Description: Opens database connection. C++ expressions can be $ $ embeded into parameters.

8.10 SQL_DISCONNECT

Usage: SQL_DISCONNECT Description: Closes database connection

8.11 SQL_DO

Usage: SQL_DO(query)

Description: Executes query. Embedded C++ expressions OK.

8.12 SQL_CURSOR_DO

Usage: SQL_CURSOR_DO(query)

Description: executes query, and processes the results in a loop terminated by SQL_CURSOR_DONE. Embedded C++ expressions OK. Query results are in a variable sql_row of type char**. Columns should be accessed with sql_row0, sql_row1, sql_row2 , etc

8.13 SQL_CURSOR_DONE

Usage: SQL_CURSOR_DONE

Description: closes SQL_CURSOR_DO loop

8.14 SQL_CLIENT_APP

Usage: SQL_CLIENT_APP(cmd)

Description: Specifies the command line to call the application capable of processing CREATE TABLE/DROP TABLE sql statements to create or re-create the schema inferred from the HTML forms

8.15 SQL_SCHEMA_FILE

Usage: SQL_SCHEMA_FILE(filename)

Description: Specifies the file where the shell script creating/ dropping the tables will be written. You will need to execute it from the command line to create or re-create your schema inferred from the forms.

8.16 SQL_FORM_TO_TABLE

Usage: SQL_FORM_TO_TABLE(form_name)

Description: Infers the table schema from the form and generated DROP TABLE and CREATE TABLE writing it out to the schema file. The name of the table is the same as the name of the form. If you do not like the inferred type you can override it with a special parameter storage in the INPUT, TEXTAREA, or SELECT HTML tags. The storage parameter will only be used to infer the SQL type, it will not show in the HTML displayed by the generated program. Inference is done according to this rule:


HTML input typeInferred SQL Type

TEXT CHAR(15) NOT NULL
TEXTAREA TEXT NOT NULL
SELECT ENUM
RADIO ENUM
CHECKBOX ENUM('Y','N')

8.17 HTML_DO_HASH_PARSE

Usage: HTML_DO_HASH_PARSE

Description: Enables the cgi-lib.pl style CGI input parsing. The results are stored in C++ STL equivalent of an associative array cgi_parse_hash . You can reference the elements the same way you do in Perl. This does not replace form classes, though, so you can use both.

8.18 SQL_FORM_DB_WRITE

Usage: SQL_FORM_DB_WRITE(form_name, table name)

Description: Outputs the form data into the corresponding SQL table. The best (although not mandated) way to use this macro is along with SQL_FORM_TO_TABLE. If the table has a primary key, the data will be replaced in case of a match rather than inserted

8.19 SQL_FORM_DB_READ

Usage: SQL_FORM_DB_READ(form_name, table_name, where_constraint)

Description: Read the data from an SQL table into the form. The best (although not mandated) way to use this macro is along with SQL_FORM_TO_TABLE.

8.20 SQL_TABLE_EXPORT

Usage: SQL_TABLE_EXPORT(table_name)

Description: Sends the exported comma-delimited table data to stdout enclosed in <pre> </ pre>

8.21 HTTP_COOKIE_CLASS

Usage: HTTP_COOKIE_START(cookie_name, lifetime, domain, path, member_list)

Description: Generates a cookie hanlding class. member_list is the list of cgi++-0.8.tar.gzencoded name/value pairs stored in the cookie. Lifetime is in seconds. An instance with the name of cookie_name will be created. Each member is public and has the type string

8.22 HTTP_COOKIE_MAKER

Usage: HTTP_COOKIE_MAKER(function_name)

Description: Specifies that the HTTP header needs to have Set-cookie and will invoke function_name to print the value of the cookie to stdout.

8.23 MAIL_INIT

Usage: MAIL_INIT(from, to, reply_to, subject)

Description: Starts e-mail session by opening a mail pipe to the mail app.

8.24 MAIL_CLOSE

Usage: MAIL_CLOSE

Description: closes the e-mail session by closing the pipe

8.25 MAIL_START

Usage: MAIL_START

Description: Anything between this macro and MAIL_END will be sent to the currently open mail pipe. You must first open the pipe with MAIL_INIT

8.26 MAIL_END

Usage: MAIL_END

Description: closes the MAIL_START macro

8.27 MAIL_ON_ERROR

Usage: MAIL_ON_ERROR

Description: specifies the function to call in case there mail operations fail

8.28 MAIL_APP

Usage: MAIL_APP

Description: spefifies the application to be invoked on the other end of the mail pipe. Default is /usr/sbin/sendmail -t .


Previous Next Table of Contents