Difference between revisions of "Python built-in Lianja/VFP functions"

From Lianjapedia
Jump to: navigation, search
(Functions)
(Functions)
Line 53: Line 53:
 
|valign="top"|kvs_getrange()||valign="top"|kvsid as numeric,<br>offset as numeric,<br>count as numeric||valign="top"|Fetch a range of key/value pairs (offset starts at 1). Returns an array of two elements, key and value.
 
|valign="top"|kvs_getrange()||valign="top"|kvsid as numeric,<br>offset as numeric,<br>count as numeric||valign="top"|Fetch a range of key/value pairs (offset starts at 1). Returns an array of two elements, key and value.
 
|-
 
|-
|valign="top"|kvs_getRange()||valign="top"| ||valign="top"|Fetch a range of key/value pairs (offset starts at 1). Returns an array of two elements, key and value.
+
|valign="top"|kvs_getRange()||valign="top"|kvsid as numeric,<br>offset as numeric,<br>count as numeric||valign="top"|Fetch a range of key/value pairs (offset starts at 1). Returns an array of two elements, key and value.
 
|-
 
|-
|valign="top"|kvs_info()||valign="top"| ||valign="top"|Displays information about the specified KVS file.
+
|valign="top"|kvs_info()||valign="top"|kvsid as numeric||valign="top"|Displays information about the specified KVS file.
 
|-
 
|-
|valign="top"|kvs_isvalid()||valign="top"| ||valign="top"|Check validity of the given ksvid.
+
|valign="top"|kvs_isvalid()||valign="top"|kvsid as numeric||valign="top"|Check validity of the given ksvid.
 
|-
 
|-
|valign="top"|kvs_keys()||valign="top"| ||valign="top"|Fetch all keys for the specified key. keyPattern may end in * to match wildcard keys.
+
|valign="top"|kvs_keys()||valign="top"|kvsid as numeric<br>[, key as string &#124; keyPattern as string]||valign="top"|Fetch all keys for the specified key. keyPattern may end in * to match wildcard keys.
 
|-
 
|-
|valign="top"|kvs_list()||valign="top"| ||valign="top"|List the key/values in the store to the console (useful during development for debugging).
+
|valign="top"|kvs_list()||valign="top"|kvsid as numeric||valign="top"|List the key/values in the store to the console (useful during development for debugging).
 
|-
 
|-
|valign="top"|kvs_listlog()||valign="top"| ||valign="top"|List binary transaction log associated with the store to the console (useful during development for debugging).
+
|valign="top"|kvs_listlog()||valign="top"|kvsid as numeric||valign="top"|List binary transaction log associated with the store to the console (useful during development for debugging).
 
|-
 
|-
|valign="top"|kvs_listLog()||valign="top"| ||valign="top"|List binary transaction log associated with the store to the console (useful during development for debugging).
+
|valign="top"|kvs_listLog()||valign="top"|kvsid as numeric||valign="top"|List binary transaction log associated with the store to the console (useful during development for debugging).
 
|-
 
|-
|valign="top"|kvs_loadfromfile()||valign="top"| ||valign="top"|Load key/value pairs from the specified file.
+
|valign="top"|kvs_loadfromfile()||valign="top"|kvsid as numeric,<br>filename as string||valign="top"|Load key/value pairs from the specified file.
 
|-
 
|-
|valign="top"|kvs_loadFromFile()||valign="top"| ||valign="top"|Load key/value pairs from the specified file.
+
|valign="top"|kvs_loadFromFile()||valign="top"|kvsid as numeric,<br>filename as string||valign="top"|Load key/value pairs from the specified file.
 
|-
 
|-
|valign="top"|kvs_max()||valign="top"| ||valign="top"|Returns max key.
+
|valign="top"|kvs_max()||valign="top"|kvsid as numeric||valign="top"|Returns max key.
 
|-
 
|-
|valign="top"|kvs_min()||valign="top"| ||valign="top"|Returns min key.
+
|valign="top"|kvs_min()||valign="top"|kvsid as numeric||valign="top"|Returns min key.
 
|-
 
|-
|valign="top"|kvs_next()||valign="top"| ||valign="top"|Position on next key/value pair returns an array of two elements: key and value.
+
|valign="top"|kvs_next()||valign="top"|kvsid as numeric||valign="top"|Position on next key/value pair returns an array of two elements: key and value.
 
|-
 
|-
|valign="top"|kvs_open()||valign="top"| ||valign="top"|Open an existing KVS. shared allows the KVS to be opened shared/exclusive.
+
|valign="top"|kvs_open()||valign="top"|kvsfilename as string<br>[, shared as logical]||valign="top"|Open an existing KVS. shared allows the KVS to be opened shared/exclusive.
 
|-
 
|-
 
|valign="top"|kvs_rebuild()||valign="top"| ||valign="top"|Rebuild the KVS file from the binary transaction log.
 
|valign="top"|kvs_rebuild()||valign="top"| ||valign="top"|Rebuild the KVS file from the binary transaction log.

Revision as of 11:03, 5 March 2024

Under construction

Overview

See Also

Lianja/KVS (Key-Value Store)

Functions

The following LianjaScript functions are built into Lianja Python.

The function names are case-sensitive - in some cases more than one format is supported.

Function Arguments Description
createObject()
die()
echo()
filetostr()
getparameter()
getParameter()
kvs_add() kvsid as numeric,
key as string | key as numeric,
value as objectname | value as arrayname | value as expression
Add key/value for the specified key. If the value is an object or array it is automatically JSON encoded.
To load the contents of a text file, you can use the filetostr() function which is built-in in Lianja/Python.
kvs_add(k, key, filetostr("filename.txt") )
kvs_clear() kvsid as numeric Remove all key/value pairs from the store.
kvs_close() kvsid as numeric Close the KVS.
kvs_contains() kvsid as numeric,
key as string | key as numeric
Returns true if key contained in the store.
kvs_count() kvsid as numeric Returns count of number of key/value pairs in the store.
kvs_create() kvsfilename as string,
keylen as numeric
[, enablelogging as logical]
Create a new KVS with keys of keylen length. Returns a numeric kvsid.
kvs_generate() kvsid as numeric,
count as numeric
Generate count new key/value pairs.
kvs_get() kvsid as numeric,
key as string | key as numeric
[, default as string
[, membername as string]]
Fetch value for the specified key. If the value is an object then membername specifies a member (property) to return.
kvs_getall() kvsid as numeric
[, key as string | keyPattern as string]
Fetch all keys/values for the specified key. keyPattern may end in * to match wildcard keys. Returns a dynarray of arrays.
kvs_getAll() kvsid as numeric
[, key as string | keyPattern as string]
Fetch all keys/values for the specified key. keyPattern may end in * to match wildcard keys. Returns a dynarray of arrays.
kvs_getrange() kvsid as numeric,
offset as numeric,
count as numeric
Fetch a range of key/value pairs (offset starts at 1). Returns an array of two elements, key and value.
kvs_getRange() kvsid as numeric,
offset as numeric,
count as numeric
Fetch a range of key/value pairs (offset starts at 1). Returns an array of two elements, key and value.
kvs_info() kvsid as numeric Displays information about the specified KVS file.
kvs_isvalid() kvsid as numeric Check validity of the given ksvid.
kvs_keys() kvsid as numeric
[, key as string | keyPattern as string]
Fetch all keys for the specified key. keyPattern may end in * to match wildcard keys.
kvs_list() kvsid as numeric List the key/values in the store to the console (useful during development for debugging).
kvs_listlog() kvsid as numeric List binary transaction log associated with the store to the console (useful during development for debugging).
kvs_listLog() kvsid as numeric List binary transaction log associated with the store to the console (useful during development for debugging).
kvs_loadfromfile() kvsid as numeric,
filename as string
Load key/value pairs from the specified file.
kvs_loadFromFile() kvsid as numeric,
filename as string
Load key/value pairs from the specified file.
kvs_max() kvsid as numeric Returns max key.
kvs_min() kvsid as numeric Returns min key.
kvs_next() kvsid as numeric Position on next key/value pair returns an array of two elements: key and value.
kvs_open() kvsfilename as string
[, shared as logical]
Open an existing KVS. shared allows the KVS to be opened shared/exclusive.
kvs_rebuild() Rebuild the KVS file from the binary transaction log.
kvs_remove() Remove the specified key.
kvs_removefirst() Use for queue. Returns an array of two elements: key and value.
kvs_removeFirst() Use for queue. Returns an array of two elements: key and value.
kvs_removelast() Use for stack. Returns an array of two elements: key and value.
kvs_removeLast() Use for stack. Returns an array of two elements: key and value.
kvs_removerange() Fetch a range of key/value pairs (offset starts at 1).
kvs_removeRange() Fetch a range of key/value pairs (offset starts at 1).
kvs_rewind() Position on first key/value pair. Returns an array of two elements: key and value.
kvs_savetofile() Save key/value pairs to the specified file.
kvs_saveToFile() Save key/value pairs to the specified file.
kvs_set() Add/update key/value for the specified key. If the value is an object or array, it is automatically JSON encoded.
kvs_update() Update value for the specified key. If the value is an object or array, it is automatically JSON encoded.
kvs_values() Fetch all values for the specified key. keyPattern may end in * to match wildcard keys.
move_uploaded_file()
odata_Create()
odata_Delete()
odata_Read()
odata_Update()
openDatabase()
strtofile()
unlink()

Desktop Only Functions

The following LianjaScript functions are built into Lianja Python for desktop Apps only.

Function Arguments Description
bindEvent() tbc tbc.
clear_events() none Stops event processing started with read_events().
debug() text as string Writes the specified text to the debug file (set debug on).
debugout() text as string Writes the specified text to the Troubleshooter Debugout Tab.
inputBox() [prompt as string] Display a box prompting for input. The prompt can optionally be specified; the default prompt is 'Enter value:'
messageBox() message as string
[, options as numeric
[, title as string]]
Display a message in a box with an optional title.
See MESSAGEBOX() for the numeric options to customize the buttons and icon and for the return values.
read_events() none Suspends execution until a clear_events() is executed.