diff options
author | Jean-Pierre Ledure <jp@ledure.be> | 2023-11-11 17:02:38 +0100 |
---|---|---|
committer | Jean-Pierre Ledure <jp@ledure.be> | 2023-11-11 18:20:15 +0100 |
commit | 7b2a6f04443c5d80ce681e5f1c89bf140fdb5c3a (patch) | |
tree | 7b0a11529000b44b09c78dc6a79062773590e11e /wizards/source/sfdatabases/script.xlb | |
parent | c45779ce3d1b95abd037d3d4d706aca511dfdc24 (diff) |
ScriptForge (SFDatabases) new Dataset service
A dataset represents a set of tabular data
stored/produced by a database.
To use datasets, the database instance must exist
but the Base document may not be open.
A Dataset instance is create either with
- the (new) database.CreateDataset() method
- from an existing dataset with the (new)
dataset.CreateDataset() method.
The proposed API supports next main purposes:
- browse for- and backward thru the dataset to get its content
- update any record with new values
- create new records or delete some.
In summary, the AKA "CRUD" operations
(create, read, update, delete).
The originality of the proposed API is the use
of a dense syntax to make insertions and updates
easy and readable:
Example:
(BASIC)
Dim newID As Long
newID = dataset.Insert("LastName", "Doe", "FirstName", "John")
' ... is equivalent to:
Dim dict As Object, newID As Long
Set dict = CreateScriptService("ScriptForge.Dictionary")
dict.Add("LastName", "Doe")
dict.Add("FirstName", "John")
newID = dataset.Insert(dict)
(PYTHON) - next statements are equivalent
newid = dataset.Insert('LastName', 'Doe', 'FirstName', 'John')
newid = dataset.Insert({'LastName': 'Doe', 'FirstName': 'John'})
newid = dataset.Insert(dict(LastName = 'Doe', FirstName = 'John'))
newid = dataset.Insert(LastName = 'Doe', FirstName = 'John')
You will notice that the returned value is the AutoValue primery
key (when it exists) which makes it reuse as a foreign key
immediate.
The API is fully available both in Basic and Python user scripts.
The new service will require its inclusion in the user documentation.
Change-Id: I4f834c4234e5b96ec8fddfffbad791ecf31899df
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159325
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Diffstat (limited to 'wizards/source/sfdatabases/script.xlb')
-rw-r--r-- | wizards/source/sfdatabases/script.xlb | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/wizards/source/sfdatabases/script.xlb b/wizards/source/sfdatabases/script.xlb index 15d7cbdbe978..8e12f56515d5 100644 --- a/wizards/source/sfdatabases/script.xlb +++ b/wizards/source/sfdatabases/script.xlb @@ -5,4 +5,5 @@ <library:element library:name="__License"/> <library:element library:name="SF_Database"/> <library:element library:name="SF_Datasheet"/> + <library:element library:name="SF_Dataset"/> </library:library>
\ No newline at end of file |