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
Virtuoso Java PL API
Virtuoso Server Extension Interface (VSEI)
Web & Internet
XML
XPATH & XQUERY

Functions Index

dict_dec_or_remove

Decrement a counter in a dictionary of counters or deletes it if it becomes zero or negative.
dict_dec_or_remove (inout dict dictionary, in key any, in value_decrement integer);
Description

The function checks whether dict contains key. If it isn't so then the function checks the datatype of the value associated with the key. An error 42000 is signalled in case of non-integer value or a negative integer value. If the value is positive and greater than value_decrement then value_decrement is subtracted from it and the result become the new value associated with key in dict. If the value is positive and less than or equal to value_decrement then key is removed from dict. If key is not in the dictionary then the dictionary remains unchanged.

Informally, the function reverts the effect of dict_inc_or_add.

Parameters
dict – Dictionary of counters. The NULL value is equivalent to an empty dictionary.
key – Key of a dictionary item to process.
value decrement – A nonnegative integer (typically 1) that is subtracted from the value associated with key.
Return Types

The function returns the changed value associated with the key, or zero in any other case.

See Also

dict_new

dict_zap

dict_put

dict_get

dict_remove

dict_inc_or_put

dict_size

dict_duplicate

dict_to_vector

dict_list_keys

dict_destructive_list_rnd_keys

dict_iter_rewind

dict_iter_next