www.openlinksw.com
docs.openlinksw.com

Book Home

Contents
Preface

Virtuoso Functions Guide

Administration
Aggregate Functions
Array Manipulation
BPEL APIs
Backup
Compression
Cursor
Date & Time Manipulation
Debug
Dictionary Manipulation
dict_dec_or_remove
dict_duplicate
dict_get
dict_inc_or_put
dict_iter_next
dict_iter_rewind
dict_list_keys
dict_new
dict_put
dict_remove
dict_size
dict_to_vector
Encoding & Decoding
File Manipulation
Free Text
Hashing / Cryptographic
LDAP
Locale
Mail
Miscellaneous
Number
Phrases
RDF data
Remote SQL Data Source
Replication
SOAP
SQL
String
Transaction
Type Mapping
UDDI
User Defined Types & The CLR
VAD
Virtuoso Java PL API
Virtuoso Server Extension Interface (VSEI)
Web & Internet
XML
XPATH & XQUERY

Functions Index

dict_iter_rewind

Resets the iterator before fetching keys and values by dict_iter_next()
dict_iter_rewind (inout dict dictionary);
Description

The dictionary is always passed by reference, due to its (potentialy big) size. The reference variable contains not only pointer to the whole dictionary but also a forward-only iterator (a "cursor") that can be used to retrieve items of the dictionary one after the other. The function sets the iterator to the very first item of the dictionary.

Parameters
dict – The reference to a dictionary to use as an iterator
Return Types

The function returns an integer that is the expected number of items in the dictionary; the value may not match to the number of items retrieved later by dict_iter_next() if a dictionary is edited by some thread.

Example
Simplest read throughout the dictionary.

The procedure creates a dictionary, puts couple of items into it and then print them to the server's console

create function dict_iterator_test ()
{
  declare dict, dkey, dvalue any;
  dict := dict_new (10);
  dict_put (dict, 'a', 1); dict_put (dict, 'b', 2);
  dict_iter_rewind (dict);
  while (dict_iter_next (dict, dkey, dvalue))
    dbg_obj_princ (' key is ' dkey, ', corresponding value is ', dvalue);
}

See Also

dict_new

dict_zap

dict_put

dict_get

dict_remove

dict_inc_or_put

dict_dec_or_remove

dict_size

dict_duplicate

dict_to_vector

dict_list_keys

dict_destructive_list_rnd_keys

dict_iter_next