[Top] [Prev] [Next] [Bottom]
[Contents]
SaVaHtmlTable
Creates an HTML Table Component Object in your server application.
#include "SaRnHtml.h"
int SaVaHtmlTable(char* server, char* db,
char* table, int vendor, ...);
Arguments
- server
- pointer to the database server name where the table resides. Oracle must use "ORACLE" as the server name.
- db
- pointer to the database name where the table resides.
- table
- A string specifying the name of the table.
- vendor
- vendor id. (
SGESYBASE, SGEORACLE
, or SGEINFORMIX
)
- ...
- Variable length list of arguments. Each argument is a NULL terminated string option strings. The last argument in the list must be NULL to terminate the variable argument list. Option strings are name-value pairs separated by the string fragment, " : ".
Return Values
Returns 1 if successful.
Returns 0 otherwise.
Creates an HTML Table Component Object in your server application. The HTML Table Component Object manages HTML interfaces that can do insert, update, delete, and provide complex search capability. This application is also fully customizable through options strings specified in the function call or through an HTML template file. The Table Component recognizes the following options strings.
SaHtmlTable.UsePass : True
- This enables username and password textboxes used for insert, update, and delete. The defined constant, SA_TABLE_USE_PASS, sets this option in code.
- SaHtmlTable.EchoPass: True
- This enables echoing back of the username and password (not encoded) between insert, update, and delete operations. This saves the user from typing in the username and password for each insert, update, and delete operation. This only works when combined with the UsePass option. Do not use this option if security is a concern. The defined constant, SA_TABLE_ECHO_PASS, sets this option in code.
- SaHtmlTable.HideInsert : True
- This option disables insert operations. The defined constant, SA_TABLE_HIDE_INSERT, sets this option in code.
- SaHtmlTable.HideUpdate : True
- This option disables update operations. The defined constant, SA_TABLE_HIDE_UPDATE, sets this option in code.
- SaHtmlTable.HideDelete : True
- This option disables delete operations. The defined constant, SA_TABLE_HIDE_DELETE, sets this option in code.
- SaHtmlTable.Template : True
- This option tells the Table Component to use an HTML template for options. The name of the template file is derived from the table name. The string, "_tab.html" is appended to the table name to derive the HTML template file name. The owner name part of the table name is not used in this derivation. The template file must exist in the HTML directory of the server application. The template file must conform to certain requirements to be considered valid. The following shows an example template file.
<HTML><HEAD><TITLE>kcmarks</TITLE></HEAD><BODY>
##Sa_Table_Begin##
SaHtmlTable.TextBoxes : notes
SaHtmlTable.HideDelete : True
!SaHtmlTable.MaxRows : 5
SaHtmlTable.WhereClause : where price > 20.00
##Sa_Table_End##
##Sa_Table_List##
</BODY></HTML>
- The template file must contain the data sites, ##Sa_Table_Begin##, ##Sa_Table_End##, and ##Sa_Table_List## and in that order. The first two sites indicate where the form part of the Table Component will be placed. Options strings are added on separate lines between these first 2 sites. The defined constants are not recognized as they are in code. Use the character, !, at the beginning of a line to add comments. The last site indicates where to place the hotlist of anchors. The rest of the file, up to the first site, after the second to the third, and after the third site is "played" as is. If this template does not contain the begin and end <HTML></HTML> tags, then you must generate these elsewhere in code. The defined constant, SA_TABLE_TEMPLATE, can be used to set this option from code.
- SaHtmlTable.AutoKey : True
- This option indicates that there are columns which should not be used in the insert statement generated by the Table Component. These special columns may be auto generated prime keys or columns derived from other columns through rules. The latter should be excluded from update operations as described below. The defined constant, SA_TABLE_AUTO_KEY, can be used to set this option from code.
- SaHtmlTable.WhereClause : whereclaus
- This option appends an additional SQL fragment, whereclaus, to all search operations in the table. This can be used to limit searches of large tables or restrict access to a subset of rows. This is appended after the where clause that the Table Component already generates for search operations. If your appended whereclaus is itself a where clause, then make sure the keyword, where appears as the first 5 characters. To set this option from code the following fragment can be used:
- SaMakeOptionString(HTML_TABLE_WHERE_CLAUS,"where state='UT' "),
- The defined constant, HTML_TABLE_WHERE_CLAUS, provides the option name and SaMakeOptionString creates a properly formed option string with a value of its second parameter and a name of the first parameter.
- SaHtmlTable.WhereType
- This option sets what kind of update where clause to generate for update operations by the Table Component. Valid values are the defined constants, SA_TABLE_UPD_PRIME, SA_TABLE_UPD_PRIME_CHG, and SA_TABLE_UPD_PRIME_MOD. For setting from a template file the values 0, 1, and 2 must be used. SA_TABLE_UPD_PRIME uses the primary keys to build the where clause. SA_TABLE_UPD_PRIME_CHG uses the primary key columns and the updated columns to build the where clause. SA_TABLE_UPD_PRIME_MOD uses the primary keys and the updatable columns as specified below. These different modes have different behavior characteristics if multiple users are updating the same row. In the first case, the second person gets their changes and the first user does not know their changes have been overwritten. In the second case both may get their changes if they are updating different columns. In the third case the first user gets their changes. The second person doesn't but gets a message indicating that they did not get their changes. The default is the first case. To set this option from code the following fragment can be used:
- SaMakeOptionString(HTML_TABLE_WHERE_TYPE,
- SA_TABLE_UPD_PRIME_CHG),
- The defined constant, HTML_TABLE_WHERE_TYPE, provides the option name and SaMakeOptionString creates a properly formed option string with a value of its second parameter and a name of the first parameter.
- SaHtmlTable.MaxRows
- This option limits the number of rows for all search operations. Only positive values limit the number of rows. To set this option from code the following fragment can be used:
- SaMakeOptionString(HTML_TABLE_MAX_ROWS, "100"),
- The defined constant, HTML_TABLE_MAX_ROWS, provides the option name and SaMakeOptionString creates a properly formed option string with a value of its second parameter and a name of the first parameter.
- SaHtmlTable.EscHREF
- This options sets the return URL to "leave" the Table Component. Since the Table Component keeps calling its own server application and its own activator, the back button of a browser may be the slow way of leaving the Table Component. Even the Go menu may become too big. This URL allows for a quick escape. The default, if the option is not set, is to return to the start document for the server application. To set this option from code the following fragment can be used:
- SaMakeOptionString(HTML_TABLE_ESC_HREF, "http://www.bluestone.com"),
- The defined constant, HTML_TABLE_ESC_HREF, provides the option name and SaMakeOptionString creates a properly formed option string with a value of its second parameter and a name of the first parameter.
- SaHtmlTable.UpdateCols
- This option specifies which columns are allowed to be updated. The default is that all columns are updatable except prime keys and auto columns. For the value of the option use the columns names (case sensitive) separated by a comma. To set this option from code the following fragment can be used:
- SaMakeOptionString(HTML_TABLE_UPDATE_COLS, "state,zip"),
- The defined constant, HTML_TABLE_UPDATE_COLS, provides the option name and SaMakeOptionString creates a properly formed option string with a value of its second parameter and a name of the first parameter.
- SaHtmlTable.AutoCols
- This option specifies which columns are auto keys. They will not be used in the generated insert statement. The option, "SaHtmlTable.AutoKey : True", must also be set. For the value of the option use the columns names (case sensitive) separated by a comma. To set this option from code the following fragment can be used:
- SaMakeOptionString(HTML_TABLE_AUTO_COLS, "auto_id"),
- The defined constant, HTML_TABLE_AUTO_COLS, provides the option name and SaMakeOptionString creates a properly formed option string with a value of its second parameter and a name of the first parameter.
- SaHtmlTable.DisplayCols
- This option specifies which columns appear in the generated anchor hotlist. The default is that all columns are displayed, except prime keys and auto columns, in the order of the table definition. For the value of the option use the columns names (case sensitive) separated by a comma. Columns may appear multiple times. The order determines which order in the generated anchor hotlist. Prime key and auto key values can be used. To set this option from code the following fragment can be used:
SaMakeOptionString(HTML_TABLE_DISPLAY_COLS,
"au_lname,au_fname,au_lname"),
- The defined constant, HTML_TABLE_DISPLAY_COLS, provides the option name and SaMakeOptionString creates a properly formed option string with a value of its second parameter and a name of the first parameter. The example above defines a layout with the value of
au_lname
shown twice, on either side of au_fname
.
- SaHtmlTable.TextBoxes
- This option specifies which columns are displayed in textarea form elements. For the value of the option use the columns names (case sensitive) separated by a comma. To set this option from code the following fragment can be used:
- SaMakeOptionString(HTML_TABLE_TEXTBOX_COLS, "notes"),
- The defined constant, HTML_TABLE_TEXTBOX_COLS, provides the option name and SaMakeOptionString creates a properly formed option string with a value of its second parameter and a name of the first parameter.
- SaHtmlTable.SearchOps
- This option specifies which values will be displayed for each column. The default is that all columns use all search operations, including string type search operations on numeric data and vice versa. For the value of the option use the columns' names (case sensitive) separated by a comma. Columns not specified will have no search options available. This option also recognizes a syntax which allows for customizing the search options for a particular column. To make a column's search operations numeric, use
columname=num
instead of just the column name. For string type searches use columname=str
. For a single specific search option use: columname=val
where val is one of:
like
begins with
ends with
contains
equals
greater than
greater than or equals
less than
less than or equals
- To set this option from code the following fragment can be used:
SaMakeOptionString(HTML_TABLE_SEARCH_OPS,
"lname=str,salary=num,state"),
- The defined constant, HTML_TABLE_SEARCH_OPS, provides the option name and SaMakeOptionString creates a properly formed option string with a value of its second parameter and a name of the first parameter.
Example
SaVaHtmlTable("CEZANNE", "pubs2", "dbo.titles", SGESYBASE,
SA_TABLE_HIDE_DELETE,
SA_TABLE_HIDE_UPDATE,
"SaHtmlTable.MaxRows : 100",
SaMakeOptionString(HTML_TABLE_TEXTBOX_COLS, "notes"),
NULL);
See Also
[Top] [Prev] [Next] [Bottom]
[Contents]
info@bluestone.com
Copyright © 1997, Bluestone. All rights
reserved.