# 22. Virtuoso Functions Guide - dict_to_vector

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_to_vector

Returns a get_keyword style vector of all items stored in the given dictionary.
vector dict_to_vector (inout dict dictionary, in destructive any);
Description

The function returns an array of all data stored in the given dictionary, every pair is represented as two consecutive element of the resulting array. Thus the dictionary of N pairs is converted into a vector of length 2N where keys are at positions 0, 2, 4, ..., 2N-1 and corresponding dependent data are at positions 1, 3, 5, ..., 2N. If keys are all scalars of same type then get_keyword function can be used to search in the resulting array.

If the destructive parameter is nonzero then the function may avoid copying of keys to the resulting array by moving them out from the dictionary. This is faster but the dictionary will become empty at the end of the operation. The destructive parameter does not have any effect if the dictionary is used as a value of more than one variable. Thus it is safe to make this parameter nonzero as soon as the variable passed to the function as dict is no longer in use after the function call and there's no need to inspect the whole program to check if other variables may be affected.

Parameters
dict – The dictionary to scan.
destructive – Flag that indicates whether the dictionary can be cleaned during the operation.
Return Types

The function returns a vector of even length.

See Also

dict_new

dict_put

dict_get

dict_remove

dict_duplicate

dict_list_keys