[ Previous ] [ Contents ] [ Index ] [ Next ]

Tcl API

The following new Tcl features are included in AOLserver Version 2.1:
Feature Where Documented
Linked interpreters for Tcl to simplify maintaining state in the single address space of the multi-threaded AOLserver Tcl Developer's Guide: Linked Interpreters and Shared Files
Order of evaluation for Tcl: private and shared Tcl directories can be specified for each virtual server, with private scripts overriding shared scripts for that virtual server Tcl Developer's Guide: Private and Shared Tcl Libraries
Client Tcl Debugging to allow specified IP addresses to get back traces rather than error messages in the event of a Tcl error Tcl Developer's Guide: Client Tcl Debugging
The ns_table and ns_column functions no longer require TINFO structures Tcl Developer's Guide: ns_column and ns_table
The ns_table info, ns_tablename, and ns_tablevalue functions are no longer available in Version 2.1, because the TINFO structure is no longer used. You can use the new ns_table value function in place of the ns_tablevalue function. NA
The ns_conn authdata function is no longer available. The authorization data for a connection can be obtained by calling ns_set as follows:
    [ns_set iget [ns_conn headers $conn] 
    Authorization]

NA
The ns_conn content function is no longer available. Use the ns_writecontent function instead. NA

The following Tcl functions are new (or newly-documented) for Version 2.1 and are described in detail in the alphabetic "Tcl API Function Reference" beginning on Tcl API Function Reference of the Tcl Developer's Guide.

Core Functions

These functions are always available.
Function Description
ns_adminlink Add a link to /NS/Admin page
ns_cpfp Copy a specified number of bytes from one file to another
ns_htmlselect Build an HTML SELECT form widget using specified data
ns_library Return directory for private or shared Tcl library
ns_mktemp Return a unique file name based on a template
ns_parsetime Return specified time element from a 10-element formatted time
ns_register_trace Register a Tcl script to a method and matching URL
ns_set Manipulate sets of key-value pairs. Several new subcommands -- create, find, ifind, isnull, key, and merge -- are supported, and some subcommands have additional arguments.
ns_server Get information about a virtual server
ns_shutdown Shut down the server and optionally restart it

Access Log Functions

These functions are available only if the Access Log (nslog) module is loaded.
Function Description
ns_accesslog Roll the access log on demand and get access log information

Scheduled Procedures

These functions allow you to specify a Tcl script to be run daily, weekly, or at specified intervals.
Function Description
ns_schedule_daily Schedule a procedure to run once a day
ns_schedule_proc Schedule a procedure to run at specified intervals
ns_schedule_weekly Schedule a procedure to run once a week
ns_unschedule_proc Stop a scheduled procedure

Sockets interface

The following functions are available for managing sockets:
Function Description
ns_hostbyaddr Resolve an IP address to a hostname
ns_sockaccept Accept a new socket connection
ns_sockcallback Register a socket callback script
ns_sockcheck Check if a socket is connected
ns_socklisten Create a socket listening for connections
ns_sockopen Connect to a remote host on the specified port
ns_sockselect Determine readable file id's

State functions

The following functions are available for maintaining state across connections and server reboots:
Function Description
ns_state_delete Remove state data for specified id
ns_state_restore Return state data for specified id and then remove it
ns_state_save Save state data to disk and return an id
ns_state_view Return state data for specified id

Threads interface

The following functions are available for managing threads:
Function Description
ns_critsec Manage critical sections
ns_event Manage events
ns_mutex Manage mutexes
ns_sema Manage semaphores
ns_thread Manage threads

Database Services Functions

These functions are only available when the Database Services (nsdb) module is loaded
Function Description
ns_buildsqldate Build an SQL date value from specified month, day, and year
ns_buildsqltime Build an SQL time value from specified time and AM/PM designation
ns_buildsqltimestamp Build an SQL timestamp from specified month, day, year, time, and AM/PM designation
ns_db bindrow Return an ns_set structure of column names returned by the previously-executed SQL command
ns_db exec Execute an SQL command
ns_dbformvalue Retrieve the value of a column specified by form data
ns_dbformvalueput Set default values in an HTML form for accessing the database
ns_dbquotename Surround a name by double quotes if it contains a space
ns_dbquotevalue Prepare a value string for inclusion in an SQL statement
ns_deleterow Delete row in specified table corresponding to form data
ns_entryform Return HTML of an entry form for the specified table
ns_entrywidget Return HTML form elements for entering data into specified table and column
ns_entrywidgetbytype Return HTML form elements for entering data into specified column and type
ns_ext Perform external database driver operations
ns_findrowbyid Return row corresponding to specified key/value pairs
ns_insertrow Insert form data into specified table as a new row
ns_localsqltimestamp Return a SQL timestamp containing the local time
ns_parsesqldate Return year, month, or day of specified SQL date value
ns_parsesqltime Return clock time or AM/PM designation of specified SQL time value
ns_parsesqltimestamp Return time, AM/PM designation, year, month, or day of specified SQL timestamp
ns_searchform Return HTML of a search form for the specified table
ns_searchopwidget Return HTML form element for searching data by the specified column and type
ns_searchqbf Return HTML table containing search results corresponding to search form data
ns_updateform Return HTML of an update form for the specified table and row
ns_upaterow Update row in specified table using form data
ns_updaterowbyid Update row corresponding to specified key/value pairs with specified column values

Permissions Functions

These functions are available only when the Access Control module (nsperm) is loaded.
Function Description
ns_group Add, delete, update, or get information about AOLserver groups
ns_method Add, delete, or get information about method aliases
ns_passwordcheck Verify a user/password combination
ns_perm Add, delete, update, or get information on permissions records
ns_user Add, delete, update, or get information about AOLserver users

Top of Page

[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright © 1996 America Online, Inc.