| Name | Last modified | Size | Description | |
|---|---|---|---|---|
| Parent Directory | - | |||
| Makefile | 02-Nov-2006 20:53 | 1.5K | ||
| README.html | 02-Nov-2006 20:53 | 6.7K | ||
| detach.c | 02-Nov-2006 20:53 | 2.4K | ||
| md5.c | 02-Nov-2006 20:53 | 14K | ||
| test/ | 02-Nov-2006 20:53 | - | ||
| utils.c | 02-Nov-2006 20:53 | 2.9K | ||
| utils.h | 02-Nov-2006 20:53 | 316 | ||
| utils8.c | 02-Nov-2006 20:53 | 8.5K | ||
INST to the
location where you have installed AOLserver.
dqd_utils-1.7.tar.gz in
the location of your choice.
dqd_utils-1.7 directory
and run make install. You must do this as a user
that has write access to $INST/bin.
Example:
export INST=/usr/local/aolserver tar xzf dqd_utils-1.7.tar.gz cd dqd_utils-1.7 make install
Add this to your nsd.tcl:
ns_section "ns/server/server1/modules" ns_param dqd_utils dqd_utils.so
These are the commands provided by dqd_utils.
dqd_internalredirect url
url must be a URL starting with a slash
(for example, /foo/bar.html).
This command passes url to
Ns_ConnRedirect. This makes the server restart the
main request handler as if url was the URL in
the original request. The server does not re-run preauth or
postauth filters.
dqd_md5 plaintext
plaintext
and returns the hash as a string of 32 hexadecimal characters.
For example:
set hash [dqd_md5 "this is a string"]
This example sets hash to
"b37e16c620c055cf8207b999e3270e9b".
unlist list var1 var2 ...
set list {foo bar baz}
unlist $list a b c d
This example sets a to "foo", b to "bar",
c to "baz", and d to "" (the empty
string). The unlist command is faster and more concise than a series
of set/lindex commands.
dqd_nssetToList setid listvar
setid to a list stored in
listvar. For example:
ns_db getrow $db $rowSet dqd_nssetToList $rowSet rowList
This example results in rowList containing a list
of the database column values for the retrieved row.
dqd_detachfile channelid name
channelid must be the id of a open Tcl
channel in the current interpreter. This command removes the
channel from the current interpreter and stores it in a private
namespace as name. The private namespace is
shared with the dqd_attachfile command.
Example:
# At server startup...
set cid [open "/etc/passwd" r]
dqd_detachfile $cid passwd
ns_share passwdLock
set passwdLock [ns_mutex create]
dqd_attachfile name
name in the
private namespace shared with dqd_detachfile. It
removes the associated channel from the private namespace and
attaches the channel to the current Tcl interpreter. The command
returns the new Tcl channel id.
Example:
# In a request handler... ns_share passwdLock ns_mutex lock $passwdLock set cid [dqd_attachfile passwd] seek $cid 0 set line [gets $cid] dqd_detachfile $cid passwd ns_mutex unlock $passwdLock
dqd_register_proxy method protocol script
method is an HTTP method such as
GET or POST (case is significant).
protocol is a URL protocol id such as
http or ftp. script
is a Tcl script.
When the server receives an HTTP request containing a full URL
(including a protocol and a hostname), and request method and
protocol match method and
protocol, the server runs
script. The server does not call any preauth or
postauth filters or the authentication handler. The server does
call trace handlers after script returns.
Typically script is simply the name of a Tcl proc.
dqd_rowsToXml dbhandle rowset
<table> element
containing one <r> element for each row.
Each <r> contains one element for each column,
using the column name as the tag. The XML will not contain any
whitespace that is not part of a field name or value. For
example, this code:
set db [ns_db gethandle]
set row [ns_db select $db {select id, name from users}]
dqd_rowsToXml $row
will produce something like this:
<table><r><id>1</id><name>Joe</name></r><r><id>2</id><name>Fred</name></r><r><id>3</id><name>Bob</name><r></table>
dqd_rowsToJavaScript dbhandle rowset
set db [ns_db gethandle]
set row [ns_db select $db {select id, name from users}]
dqd_rowsToJavaScript $row
will produce something like this:
[{id:'1',name:'Joe'},{id:'2',name:'Fred'},{id:'3',name:'Bob'}]
The output is intended to be JSON-compliant.
@(#) $Id: README.html,v 1.11 2005/05/28 05:29:06 rob2 Exp $