forked from amazingfate/loongoffice
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
9 lines
541 B
XML
9 lines
541 B
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd">
|
|
<library:library xmlns:library="http://openoffice.org/2000/library" library:name="SFDatabases" library:readonly="false" library:passwordprotected="false">
|
|
<library:element library:name="SF_Register"/>
|
|
<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> |