Difference between revisions of "Python built-in Lianja/VFP functions"
From Lianjapedia
Yvonne.milne (Talk | contribs) |
Yvonne.milne (Talk | contribs) |
||
Line 3: | Line 3: | ||
==Functions== | ==Functions== | ||
− | The following LianjaScript functions are built into Lianja Python. The function names are case-sensitive. | + | The following LianjaScript functions are built into Lianja Python. |
+ | |||
+ | The function names are case-sensitive - in some cases more than one format is supported. | ||
{| class="wikitable" width="100%" | {| class="wikitable" width="100%" | ||
Line 22: | Line 24: | ||
|valign="top"|getParameter()||valign="top"| ||valign="top"| | |valign="top"|getParameter()||valign="top"| ||valign="top"| | ||
|- | |- | ||
− | |valign="top"|kvs_add()||valign="top"| ||valign="top"| | + | |valign="top"|kvs_add()||valign="top"|kvsid as numeric,<br>key as string | key as numeric,<br>value as objectname | value as arrayname | value as expression||valign="top"|Add key/value for the specified key. If the value is an object or array it is automatically JSON encoded.<br>To load the contents of a text file, you can use the filetostr() function which is built-in in Lianja/Python. |
+ | <pre> | ||
+ | kvs_add(k, key, filetostr("filename.txt") ) | ||
+ | </pre> | ||
|- | |- | ||
− | |valign="top"|kvs_clear()||valign="top"| ||valign="top"| | + | |valign="top"|kvs_clear()||valign="top"|kvsid as numeric||valign="top"|Remove all key/value pairs from the store. |
|- | |- | ||
− | |valign="top"|kvs_close()||valign="top"| ||valign="top"| | + | |valign="top"|kvs_close()||valign="top"|kvsid as numeric||valign="top"|Close the KVS. |
|- | |- | ||
− | |valign="top"|kvs_contains()||valign="top"| ||valign="top"| | + | |valign="top"|kvs_contains()||valign="top"|kvsid as numeric,<br>key as string | key as numeric||valign="top"|Returns true if key contained in the store. |
|- | |- | ||
− | |valign="top"|kvs_count()||valign="top"| ||valign="top"| | + | |valign="top"|kvs_count()||valign="top"|kvsid as numeric||valign="top"|Returns count of number of key/value pairs in the store. |
|- | |- | ||
− | |valign="top"|kvs_create()||valign="top"| ||valign="top"| | + | |valign="top"|kvs_create()||valign="top"|kvsfilename as string,<br>keylen as numeric<br>[, enablelogging as logical]||valign="top"|Create a new KVS with keys of keylen length. Returns a numeric kvsid. |
|- | |- | ||
− | |valign="top"|kvs_generate()||valign="top"| ||valign="top"| | + | |valign="top"|kvs_generate()||valign="top"|kvsid as numeric,<br>count as numeric||valign="top"|Generate count new key/value pairs. |
|- | |- | ||
− | |valign="top"|kvs_get()||valign="top"| ||valign="top"| | + | |valign="top"|kvs_get()||valign="top"|kvsid as numeric,<br>key as string | key as numeric<br>[, default as string<br>[, membername as string]]||valign="top"|Fetch value for the specified key. If the value is an object then membername specifies a member (property) to return. |
|- | |- | ||
− | |valign="top"|kvs_getall()||valign="top"| ||valign="top"| | + | |valign="top"|kvs_getall()||valign="top"| ||valign="top"|Fetch all keys/values for the specified key. keyPattern may end in * to match wildcard keys. Returns a dynarray of arrays. |
|- | |- | ||
− | |valign="top"|kvs_getAll()||valign="top"| ||valign="top"| | + | |valign="top"|kvs_getAll()||valign="top"| ||valign="top"|Fetch all keys/values for the specified key. keyPattern may end in * to match wildcard keys. Returns a dynarray of arrays. |
|- | |- | ||
− | |valign="top"|kvs_getrange()||valign="top"| ||valign="top"| | + | |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"| ||valign="top"| | + | |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_info()||valign="top"| ||valign="top"| | + | |valign="top"|kvs_info()||valign="top"| ||valign="top"|Displays information about the specified KVS file. |
|- | |- | ||
− | |valign="top"|kvs_isvalid()||valign="top"| ||valign="top"| | + | |valign="top"|kvs_isvalid()||valign="top"| ||valign="top"|Check validity of the given ksvid. |
|- | |- | ||
− | |valign="top"|kvs_keys()||valign="top"| ||valign="top"| | + | |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_list()||valign="top"| ||valign="top"| | + | |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_listlog()||valign="top"| ||valign="top"| | + | |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"| ||valign="top"| | + | |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_loadfromfile()||valign="top"| ||valign="top"| | + | |valign="top"|kvs_loadfromfile()||valign="top"| ||valign="top"|Load key/value pairs from the specified file. |
|- | |- | ||
− | |valign="top"|kvs_loadFromFile()||valign="top"| ||valign="top"| | + | |valign="top"|kvs_loadFromFile()||valign="top"| ||valign="top"|Load key/value pairs from the specified file. |
|- | |- | ||
− | |valign="top"|kvs_max()||valign="top"| ||valign="top"| | + | |valign="top"|kvs_max()||valign="top"| ||valign="top"|Returns max key. |
|- | |- | ||
− | |valign="top"|kvs_min()||valign="top"| ||valign="top"| | + | |valign="top"|kvs_min()||valign="top"| ||valign="top"|Returns min key. |
|- | |- | ||
− | |valign="top"|kvs_next()||valign="top"| ||valign="top"| | + | |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_open()||valign="top"| ||valign="top"| | + | |valign="top"|kvs_open()||valign="top"| ||valign="top"|Open an existing KVS. shared allows the KVS to be opened shared/exclusive. |
|- | |- | ||
− | |valign="top"|kvs_rebuild()||valign="top"| ||valign="top"| | + | |valign="top"|kvs_rebuild()||valign="top"| ||valign="top"|Rebuild the KVS file from the binary transaction log. |
|- | |- | ||
− | |valign="top"|kvs_remove()||valign="top"| ||valign="top"| | + | |valign="top"|kvs_remove()||valign="top"| ||valign="top"|Remove the specified key. |
|- | |- | ||
− | |valign="top"|kvs_removefirst()||valign="top"| ||valign="top"| | + | |valign="top"|kvs_removefirst()||valign="top"| ||valign="top"|Use for queue. Returns an array of two elements: key and value. |
|- | |- | ||
− | |valign="top"|kvs_removeFirst()||valign="top"| ||valign="top"| | + | |valign="top"|kvs_removeFirst()||valign="top"| ||valign="top"|Use for queue. Returns an array of two elements: key and value. |
|- | |- | ||
− | |valign="top"|kvs_removelast()||valign="top"| ||valign="top"| | + | |valign="top"|kvs_removelast()||valign="top"| ||valign="top"|Use for stack. Returns an array of two elements: key and value. |
|- | |- | ||
− | |valign="top"|kvs_removeLast()||valign="top"| ||valign="top"| | + | |valign="top"|kvs_removeLast()||valign="top"| ||valign="top"|Use for stack. Returns an array of two elements: key and value. |
|- | |- | ||
− | |valign="top"|kvs_removerange()||valign="top"| ||valign="top"| | + | |valign="top"|kvs_removerange()||valign="top"| ||valign="top"|Fetch a range of key/value pairs (offset starts at 1). |
|- | |- | ||
− | |valign="top"|kvs_removeRange()||valign="top"| ||valign="top"| | + | |valign="top"|kvs_removeRange()||valign="top"| ||valign="top"|Fetch a range of key/value pairs (offset starts at 1). |
|- | |- | ||
− | |valign="top"|kvs_rewind()||valign="top"| ||valign="top"| | + | |valign="top"|kvs_rewind()||valign="top"| ||valign="top"|Position on first key/value pair. Returns an array of two elements: key and value. |
|- | |- | ||
− | |valign="top"|kvs_savetofile()||valign="top"| ||valign="top"| | + | |valign="top"|kvs_savetofile()||valign="top"| ||valign="top"|Save key/value pairs to the specified file. |
|- | |- | ||
− | |valign="top"| | + | |valign="top"|kvs_saveToFile()||valign="top"| ||valign="top"|Save key/value pairs to the specified file. |
|- | |- | ||
− | |valign="top"|kvs_set()||valign="top"| ||valign="top"| | + | |valign="top"|kvs_set()||valign="top"| ||valign="top"|Add/update key/value for the specified key. If the value is an object or array, it is automatically JSON encoded. |
|- | |- | ||
− | |valign="top"|kvs_update()||valign="top"| ||valign="top"| | + | |valign="top"|kvs_update()||valign="top"| ||valign="top"|Update value for the specified key. If the value is an object or array, it is automatically JSON encoded. |
|- | |- | ||
− | |valign="top"|kvs_values()||valign="top"| ||valign="top"| | + | |valign="top"|kvs_values()||valign="top"| ||valign="top"|Fetch all values for the specified key. keyPattern may end in * to match wildcard keys. |
|- | |- | ||
|valign="top"|move_uploaded_file()||valign="top"| ||valign="top"| | |valign="top"|move_uploaded_file()||valign="top"| ||valign="top"| |
Revision as of 11:21, 4 March 2024
Under construction
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() | Fetch all keys/values for the specified key. keyPattern may end in * to match wildcard keys. Returns a dynarray of arrays. | |
kvs_getAll() | Fetch all keys/values for the specified key. keyPattern may end in * to match wildcard keys. Returns a dynarray of arrays. | |
kvs_getrange() | Fetch a range of key/value pairs (offset starts at 1). Returns an array of two elements, key and value. | |
kvs_getRange() | Fetch a range of key/value pairs (offset starts at 1). Returns an array of two elements, key and value. | |
kvs_info() | Displays information about the specified KVS file. | |
kvs_isvalid() | Check validity of the given ksvid. | |
kvs_keys() | Fetch all keys for the specified key. keyPattern may end in * to match wildcard keys. | |
kvs_list() | List the key/values in the store to the console (useful during development for debugging). | |
kvs_listlog() | List binary transaction log associated with the store to the console (useful during development for debugging). | |
kvs_listLog() | List binary transaction log associated with the store to the console (useful during development for debugging). | |
kvs_loadfromfile() | Load key/value pairs from the specified file. | |
kvs_loadFromFile() | Load key/value pairs from the specified file. | |
kvs_max() | Returns max key. | |
kvs_min() | Returns min key. | |
kvs_next() | Position on next key/value pair returns an array of two elements: key and value. | |
kvs_open() | 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. |