# 22. Virtuoso Functions Guide - dict_new

Chapter Contents | Prev | Next
Keyword Search:
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_duplicate
dict_get
dict_list_keys
dict_new
dict_put
dict_remove
dict_to_vector
Encoding & Decoding
File Manipulation
Free Text
Hashing / Cryptographic
LDAP
Locale
Mail
Miscellaneous
Number
Remote SQL Data Source
Replication
SOAP
SQL
String
Transaction
Type Mapping
UDDI
User Defined Types & The CLR
Virtuoso Java PL API
Virtuoso Server Extension Interface (VSEI)
Web Server & Internet
XML
XPATH & XQUERY
Functions Index

## dict_new

Creates a new dictionary to store key-value pairs.
dictionary dict_new ([in size integer]);
Description

This function creates a new dictionary. A dictionary is a memory-resident hash table that can store an arbitrary number of key-value pairs. Both key and dependent part can be of any type, including vectors. Two keys of different data types are always considered as different even if SQL '=' operator return 'true', e.g. integer zero and double precision 0.0 are two different keys. Vectors are equivalent if their corresponding members are either equal scalars or equivalent vectors. XML entities are equivalent if they refer to the same node or attribute in the same document.

Dictionary objects are always passed by reference, even if dictionary is passed as an 'in' argument of a function. If value of a variable is a dictionary and it is assigned to other variable then both variables refer to the same internal hashtable. To create two really independent dictionary objects, use

dict_duplicate ().

Parameters
size – The guessed side of hashtable. oversstimation of the size will result in needless memory consumption whereas underscore leads to a bit slower insertion, because the internal hash table will grow dynamically. The simplest approach is to omit the parameter at all if you don't know the number of keys to be stored.
Return Types

The function returns a new empty dictionary object.

See Also

dict_put

dict_get

dict_remove

dict_duplicate

dict_to_vector

dict_list_keys