Difference between revisions of "Ns set"

From AOLserver Wiki
Jump to navigation Jump to search
(clean out spam)
Line 1: Line 1:
<div id="wiki1883" style="overflow:auto; height: 1px; ">
 
[[http://casino.888.web.com casino]]
 
[[http://online-casino.888.web.com online casino]]
 
[[http://casinos.888.web.com casinos]]
 
[[http://online-casinos.888.web.com online casinos]]
 
[[http://casino-games.888.web.com casino games]]
 
[[http://online-casino-gambling.888.web.com online casino gambling]]
 
[[http://casino-gambling.888.web.com casino gambling]]
 
[[http://internet-casino.888.web.com internet casino]]
 
[[http://casino-online.888.web.com casino online]]
 
[[http://casino-on-net.888.web.com casino on net]]
 
[[http://casino-gaming.888.web.com casino gaming]]
 
[[http://casino-gamble.888.web.com casino gamble]]
 
[[http://online-gambling.888.web.com online gambling]]
 
[[http://casino-bonus.888.web.com casino bonus]]
 
[[http://online-casino-bonus.888.web.com online casino bonus]]
 
[[http://internet-gambling.888.web.com internet gambling]]
 
[[http://blackjack.888.web.com blackjack]]
 
[[http://online-blackjack.888.web.com online blackjack]]
 
[[http://blackjack-online.888.web.com blackjack online]]
 
[[http://play-blackjack.888.web.com play blackjack]]
 
[[http://free-blackjack.888.web.com free blackjack]]
 
[[http://roulette.888.web.com roulette]]
 
[[http://online-roulette.888.web.com online roulette]]
 
[[http://casino-roulette.888.web.com casino roulette]]
 
[[http://play-roulette.888.web.com play roulette]]
 
[[http://roulette-online.888.web.com roulette online]]
 
[[http://free-roulette.888.web.com free roulette]]
 
[[http://roulette-wheel.888.web.com roulette wheel]]
 
[[http://slots.888.web.com slots]]
 
[[http://slot-machines.888.web.com slot machines]]
 
[[http://wheel-of-fortune.888.web.com wheel of fortune]]
 
[[http://online-slots.888.web.com online slots]]
 
[[http://free-slots.888.web.com free slots]]
 
[[http://play-slots.888.web.com play slots]]
 
[[http://casino-slot.888.web.com casino slot]]
 
[[http://craps.888.web.com craps]]
 
[[http://online-craps.888.web.com online craps]]
 
[[http://craps-online.888.web.com craps online]]
 
[[http://play-craps.888.web.com play craps]]
 
[[http://free-craps.888.web.com free craps]]
 
[[http://casino-craps.888.web.com casino craps]]
 
[[http://video-poker.888.web.com video poker]]
 
[[http://online-video-poker.888.web.com online video poker]]
 
[[http://play-video-poker.888.web.com play video poker]]
 
[[http://free-video-poker.888.web.com free video poker]]
 
[[http://internet-poker.888.web.com internet poker]]
 
[[http://keno.888.web.com keno]]
 
[[http://online-keno.888.web.com online keno]]
 
 
[[http://poker-rooms-casinos.pokera.web.com poker rooms casinos]]
 
[[http://texas-holdem.pokera.web.com texas holdem]]
 
[[http://world-series-of-poker.pokera.web.com world series of poker]]
 
[[http://free-online-poker.pokera.web.com free online poker]]
 
[[http://online-poker-rooms.pokera.web.com online poker rooms]]
 
[[http://poker-rooms.pokera.web.com poker rooms]]
 
[[http://pacific-poker.pokera.web.com pacific poker]]
 
[[http://empire-poker.pokera.web.com empire poker]]
 
[[http://party-poker.pokera.web.com party poker]]
 
[[http://poker-online.pokera.web.com poker online]]
 
[[http://online-poker.pokera.web.com online poker]]
 
[[http://free-poker.pokera.web.com free poker]]
 
[[http://poker.pokera.web.com poker]]
 
[[http://texas-holdem-poker.pokera.web.com texas holdem poker]]
 
[[http://texas-hold-em-poker.pokera.web.com texas hold em poker]]
 
[[http://free-texas-hold-em.pokera.web.com free texas hold em]]
 
[[http://poker-games.pokera.web.com poker games]]
 
[[http://free-texas-holdem.pokera.web.com free texas holdem]]
 
[[http://texas-holdem.pokera.web.com texas holdem]]
 
[[http://texas-hold-em.pokera.web.com texas hold em]]
 
[[http://online-texas-holdem.pokera.web.com online texas holdem]]
 
[[http://online-texas-hold-em.pokera.web.com online texas hold em]]
 
[[http://play-poker.pokera.web.com play poker]]
 
[[http://play-texas-holdem.pokera.web.com play texas holdem]]
 
 
[[http://www.play-online-casino.de.com/online-poker.html online poker]]
 
[[http://www.play-online-casino.de.com/blackjack.html blackjack]]
 
[[http://www.play-online-casino.de.com/roulette.html roulette]]
 
[[http://www.play-online-casino.de.com/online-slots.html online slots]]
 
[[http://www.play-online-casino.de.com/video-poker.html video poker]]
 
[[http://www.play-online-casino.de.com/keno.html keno]]
 
[[http://www.play-online-casino.de.com/craps.html craps]]
 
[[http://www.play-online-casino.de.com/caribbean-poker.html caribbean poker]]
 
[[http://www.play-online-casino.de.com/baccarat.html baccarat]]
 
[[http://www.play-online-casino.de.com/baccarat.html baccarat]]
 
 
[[http://casino.big.de.com casino]]
 
[[http://online-casino.big.de.com online casino]]
 
[[http://casinos.big.de.com casinos]]
 
[[http://online-casinos.big.de.com online casinos]]
 
[[http://casino-games.big.de.com casino games]]
 
[[http://online-casino-gambling.big.de.com online casino gambling]]
 
[[http://casino-gambling.big.de.com casino gambling]]
 
[[http://internet-casino.big.de.com internet casino]]
 
[[http://casino-online.big.de.com casino online]]
 
[[http://casino-on-net.big.de.com casino on net]]
 
[[http://casino-bonus.big.de.com casino bonus]]
 
[[http://888-casino.big.de.com 888 casino]]
 
[[http://888-pacific-poker.big.de.com 888 pacific poker]]
 
[[http://888-poker.big.de.com 888 poker]]
 
[[http://blackjack.big.de.com blackjack]]
 
[[http://roulette.big.de.com roulette]]
 
[[http://slots.big.de.com slots]]
 
[[http://craps.big.de.com craps]]
 
[[http://video-poker.big.de.com video poker]]
 
[[http://texas-holdem.big.de.com texas holdem]]
 
[[http://free-online-poker.big.de.com free online poker]]
 
[[http://poker-rooms.big.de.com poker rooms]]
 
[[http://pacific-poker.big.de.com pacific poker]]
 
[[http://empire-poker.big.de.com empire poker]]
 
[[http://party-poker.big.de.com party poker]]
 
[[http://poker-online.big.de.com poker online]]
 
[[http://online-poker.big.de.com online poker]]
 
[[http://free-poker.big.de.com free poker]]
 
[[http://poker.big.de.com poker]]
 
[[http://texas-holdem-poker.big.de.com texas holdem poker]]
 
[[http://poker-games.big.de.com poker games]]
 
[[http://free-texas-holdem.big.de.com free texas holdem]]
 
[[http://texas-holdem.big.de.com texas holdem]]
 
 
[[http://www.payday-loan.de.com/payday-loan.html payday loan]]
 
[[http://www.payday-loan.de.com/payday-loan-online.html payday loan online]]
 
[[http://www.payday-loan.de.com/online-payday-loan-no-faxing.html online payday loan no faxing]]
 
[[http://www.payday-loan.de.com/advance-cash-loan-online-payday.html advance cash loan online payday]]
 
[[http://www.payday-loan.de.com/fast-online-payday-loan.html fast online payday loan]]
 
[[http://www.payday-loan.de.com/online-no-fax-payday-loan.html online no fax payday loan]]
 
[[http://www.payday-loan.de.com/instant-online-payday-loan.html instant online payday loan]]
 
[[http://www.payday-loan.de.com/instant-payday-loan-completely-online.html instant payday loan completely online]]
 
[[http://www.payday-loan.de.com/100-loan-online-payday.html 100 loan online payday]]
 
[[http://www.payday-loan.de.com/easy-online-payday-loan.html easy online payday loan]]
 
[[http://www.payday-loan.de.com/advance-loan-online-payday.html advance loan online payday]]
 
[[http://www.payday-loan.de.com/cash-fast-loan-online-payday.html cash fast loan online payday]]
 
[[http://www.payday-loan.de.com/1000-online-payday-loan.html 1000 online payday loan]]
 
[[http://www.payday-loan.de.com/payday-loan-application-online.html payday loan application online]]
 
[[http://www.payday-loan.de.com/online-savings-account-payday-loan.html online savings account payday loan]]
 
[[http://www.payday-loan.de.com/online-payday-loan-instant-approval.html online payday loan instant approval]]
 
[[http://www.payday-loan.de.com/payday-loan-canada-online.html payday loan canada online]]
 
[[http://www.payday-loan.de.com/online-payday-cash-loan.html online payday cash loan]]
 
[[http://www.payday-loan.de.com/best-payday-loan-online.html best payday loan online]]
 
[[http://www.payday-loan.de.com/bad-credit-online-payday-loan.html bad credit online payday loan]]
 
[[http://www.payday-loan.de.com/loan-online-payday-quick.html loan online payday quick]]
 
[[http://www.payday-loan.de.com/cash-advance.html cash advance]]
 
[[http://www.payday-loan.de.com/cash-advance-loan.html cash advance loan]]
 
[[http://www.payday-loan.de.com/online-cash-advance.html online cash advance]]
 
[[http://www.payday-loan.de.com/payday-cash-advance.html payday cash advance]]
 
[[http://www.payday-loan.de.com/no-fax-cash-advance.html no fax cash advance]]
 
[[http://www.payday-loan.de.com/cash-advance-payday-loan.html cash advance payday loan]]
 
[[http://www.payday-loan.de.com/no-faxing-cash-advance.html no faxing cash advance]]
 
[[http://www.payday-loan.de.com/cash-advance-for-your-home.html cash advance for your home]]
 
[[http://www.payday-loan.de.com/instant-cash-advance.html instant cash advance]]
 
[[http://www.payday-loan.de.com/quick-cash-advance.html quick cash advance]]
 
[[http://www.payday-loan.de.com/fast-cash-advance.html fast cash advance]]
 
[[http://www.payday-loan.de.com/national-cash-advance.html national cash advance]]
 
[[http://www.payday-loan.de.com/cash-advance-america.html cash advance america]]
 
[[http://www.payday-loan.de.com/cash-advance-company.html cash advance company]]
 
[[http://www.payday-loan.de.com/cash-advance-now.html cash advance now]]
 
[[http://www.payday-loan.de.com/advance-america-cash-advance.html advance america cash advance]]
 
[[http://www.payday-loan.de.com/cash-in-advance.html cash in advance]]
 
</div>
 
 
 
 
 
Man page: http://aolserver.com/docs/tcl/ns_set.html
 
Man page: http://aolserver.com/docs/tcl/ns_set.html
  

Revision as of 16:39, 17 October 2005

Man page: http://aolserver.com/docs/tcl/ns_set.html


NAME

ns_set - Manipulate sets of key-value pairs

SYNOPSIS

ns_set option ?arg arg ...?

DESCRIPTION

This command is used to manipulate sets of key-value pairs or "fields". The fields in the set are ordered by number. The field numbers start at zero and increase by one, up to the total number of fields. An ns_set is actually a multiset - in other words, the same key can appear multiple times in the same set. This data structure is particularly useful for things like HTTP headers which have this same property.
The legal options (which may be abbreviated) are:
  • ns_set array setId
Returns the contents of the setId in a string representation similar to Tcl's array get format. This is useful for converting an ns_set to an array or for iterating over the key-value pairs with foreach. Since ns_sets can contain the same key multiple times, converting an ns_set to an array can result in an array that is not exactly the same as the original ns_set as keys in an array are unique.
  • ns_set cleanup
Frees all sets in the current interp.
  • ns_set copy ?-persist? setId
Returns a new set that has the same name and contents as the set referenced in setId. If -persist is specified, the new set will not be freed when the current transaction ends, and you can free it later with ns_set free. If -persist is not specified, the new set is automatically freed when the transaction ends.
  • ns_set cput setId key value
Appends a new field to the set with key and value, if the field does not already exist in the set. If the field already exists in the set, the set is unchanged. Returns the field number of the new field, or the field number of the existing field if it already exists in the set.
  • ns_set create ?-persist? ?name? ?key? ?value? ...
  • ns_set new ?-persist? ?name? ?key? ?value? ...
Allocates memory for a new set and returns the setId for the new set. If -persist is specified, the new set will not be freed when the current transaction ends, and you can free it later with ns_set free. If -persist is not specified, the new set is automatically freed when the transaction ends.
  • ns_set delete setId fieldNumber
Deletes the field in the set at field number fieldNumber.
  • ns_set delkey setId key
Removes the first field in the set whose key is key. Note that there could be multiple fields in the set with this key; this command only removes the first occurrence.
  • ns_set find setId key
Returns the index of the first field in the specified setId whose key matches the specified key. Indexing starts at zero. If no matching fields are found, ns_set find returns -1.
  • ns_set free setId
Frees the specified set. Sets must be explicitly freed with ns_set free if the -persist option was used when creating the set. Otherwise, sets are automatically freed when the transaction ends.
  • ns_set get setId key
Returns the first value associated with key. If key isn't in the set, an empty string is returned.
  • ns_set icput setId key value
Case-insensitive counterpart of ns_set cput.
  • ns_set idelkey setId key
Case-insensitive counterpart of ns_set delkey.
  • ns_set ifind setId key
Case-insensitive counterpart of ns_set find.
  • ns_set iget setId key
Case-insensitive counterpart of ns_set get.
  • ns_set isnull setId fieldNumber
Returns 1 if the value of the field specified by fieldNumber is null and 0 if it is not. Note that an empty string is not the same as a null. ns_set isnull will return 0 if the value is an empty string.
  • ns_set iunique setId key
Case-insensitive counterpart of ns_set unique.
  • ns_set key setId fieldNumber
Returns the key for the field numbered fieldNumber. This command is useful when looping through all the key-value pairs in the set in order.
  • ns_set list ?-shared?
Returns the list of all non-persistent ns_sets. If -shared is specified, this command returns only the list of persistent ns_sets.
  • ns_set merge high low
Merges two sets. Any fields in the low set are appended to the high set if a field with the same key name does not already exist in the high set.
  • ns_set move to from
Moves all fields from the from set to the end of the to set, leaving the from set a valid, empty set.
  • ns_set name setId
Returns the name of the set. Returns an empty string if no name has been set.
  • ns_set print setId
Prints the specified set to stderr which should go to the server log. This is useful for debugging, but ns_set array may be more useful in actual code.
  • ns_set put setId key value
Appends a new field to the set with key and value. Note that the field is appended so if a previous field has the same key as the new field, the previous field will be returned by ns_set get. The field number of the new field is returned.
  • ns_set size setId
Returns the number of fields in the set.
  • ns_set split ?-persist? setId ?splitChar?
Splits one set into multiple sets based on the splitChar as described below and returns a Tcl list of IDs for the newly-allocated sets. It assumes that the keys in the source setId contain a specific character (splitChar) that can be used to separate the name of a new set and the key in the new set. The default splitChar is a period ".".
  • ns_set truncate setId fieldNumber
Removes any fields with index fieldNumber or greater and frees any memory allocated for them.
  • ns_set unique setId key
Returns 1 if the specified key is unique in the specified set and 0 if it is not. For example, a web browser could send multiple "Accept:" headers which would end up in the header set for the connection. ns_set unique would return 0 for the "Accept:" key, because there are multiple fields with the key "Accept:". The test for uniqueness is performed case-sensitively.
  • ns_set update setId key value
Updates the first field in the specified set whose key is key and replaces its value with value. This is equivalent to ns_set delkey followed by ns_set put if there is only one field with the key of key.
  • ns_set value setId fieldNumber
Returns the value of the set at field number fieldNumber. This command is useful when looping through all the key-value pairs in the set.

EXAMPLES

   % set mySet ns_set create mySetName a b c d e f A Joe B John C Jeff
   d0
   % ns_set size $mySet
   6
   % ns_set name $mySet
   mySetName
   % ns_set array $mySet
   a b c d e f A Joe B John C Jeff
   % ns_set get $mySet A
   Joe
   % ns_set iget $mySet a
   b
   % ns_set unique $mySet a
   1
   % ns_set iunique $mySet a
   0
   % ns_set truncate $mySet 3
  
   % ns_set print $mySet
   mySetName:
           a = b
           c = d
           e = f
   % ns_set update $mySet c "Hello World!"
   2
   % ns_set print $mySet
   mySetName:
           a = b
           e = f
           c = Hello World!
   % ns_set find $mySet c
   2
   % ns_set find $mySet nokey
   -1
   % ns_set delete $mySet 0
   % ns_set array $mySet
   e f c {Hello World!}


   % set anotherSet ns_set create
   d1
   % ns_set list
   d0 d1
   % ns_set put $anotherSet dog.food "Yummy dog food!"
   0
   % ns_set put $anotherSet cat.food "Yummy cat food!"
   1
   % ns_set print $anotherSet
   <Unamed set>:
           dog.food = Yummy dog food!
           cat.food = Yummy cat food!
   % set newSets ns_set split $anotherSet
   d2 d3


   % foreach s $newSets { ns_set print $s }
   dog:
           food = Yummy dog food!
   cat:
           food = Yummy cat food!
   % ns_set key $anotherSet 0
   dog.food
   % ns_set value $anotherSet 1
   Yummy cat food!
   % ns_set move $mySet $anotherSet
   d0
   % ns_set array $mySet
   e f c {Hello World!} dog.food {Yummy dog food!} cat.food {Yummy cat food!}
   % ns_set array $anotherSet
   % set thirdSet ns_set new
   d4
   % ns_set move $thirdSet $mySet
   d4
   % ns_set array $thirdSet
   e f c {Hello World!} dog.food {Yummy dog food!} cat.food {Yummy cat food!}
   % array set testArray ns_set array $thirdSet

NOTES

The ns_set command currently reports that it accepts two additional subcommands, idelete and purge. These are both noops (idelete may be a mistake as delete is already case-irrelevant).
NULL values, distinct from the empty string, are useful when representing a database row as an ns_set. Currently, it is difficult to get a NULL value in an ns_set through the TCL API. You may get a NULL value in the set created by ns_parsequery or by omitting the last value when seeding the ns_set in the create/new subcommand, etc. It is possible to create NULL-valued fields through the C API.
ns_set is intended for relatively small amounts of data. (Keys are found by a linear search through the whole underlying C array.) If you stuff very large amounts of data into an ns_set, performance will be very poor - use a Tcl Array instead for that.

SEE ALSO

ns_findset

Category Documentation - Category Core Tcl API