ScriptForge (SF_Dataset) fix GetRows() in chunks
Two bugs are fixed with this commit: 1. when rows in a dataset are read in chunks, one record is skipped errorneously between every two successive chunks. 2. In updatable datasets, the updatable fields need to be identified. This is done at dataset creation. Before: the IsDefinitelyWritable criterion was used, valid for Firebird, not for HSQL After: the IsWritable criterion is used, valid for both. The correction in Basic is valid as well for Python. Documentation is unchanged. Change-Id: I990c02aaa8a93123a7e669b1294605fa19780167 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160163 Reviewed-by: Jean-Pierre Ledure <jp@ledure.be> Tested-by: Jenkins
This commit is contained in:
parent
c89c4ebe49
commit
07036eea50
2 changed files with 5 additions and 4 deletions
|
@ -28,7 +28,7 @@ Option Explicit
|
|||
''' Transaction handling
|
||||
''' Changes to data remain reversible until the moment the running script instructs the database to commit them.
|
||||
''' The implicit (default) behaviour is that commit takes place after the execution of every single SQL statement.
|
||||
''' The choice can be made (SetTranactionMode()) to take commitments manually.
|
||||
''' The choice can be made (SetTransactionMode()) to take commitments manually.
|
||||
''' The Commit() and Rollback() statements delimit transactions.
|
||||
'''
|
||||
''' Service invocation and usage:
|
||||
|
|
|
@ -585,6 +585,7 @@ Check:
|
|||
If Not ScriptForge.SF_Utils._Validate(Header, "Header", ScriptForge.V_BOOLEAN) Then GoTo Finally
|
||||
If Not ScriptForge.SF_Utils._Validate(MaxRows, "MaxRows", ScriptForge.V_NUMERIC) Then GoTo Finally
|
||||
End If
|
||||
If MaxRows < 0 Then MaxRows = 1
|
||||
|
||||
Try:
|
||||
With _RowSet
|
||||
|
@ -608,7 +609,7 @@ Try:
|
|||
End If
|
||||
|
||||
' Load data
|
||||
Do While bRead And (MaxRows = 0 Or lRows < MaxRows - 1)
|
||||
Do While bRead
|
||||
lRows = lRows + 1
|
||||
If lRows = 0 Then
|
||||
ReDim vResult(0 To lRows, 0 To lCols)
|
||||
|
@ -618,7 +619,7 @@ Try:
|
|||
For i = 0 To lCols
|
||||
vResult(lRows, i) = _ParentDatabase._GetColumnValue(_RowSet, i + 1)
|
||||
Next i
|
||||
bRead = .next()
|
||||
If MaxRows = 0 Or lRows < MaxRows - 1 Then bRead = .next() Else bRead = False
|
||||
Loop
|
||||
|
||||
Else
|
||||
|
@ -1343,7 +1344,7 @@ Try:
|
|||
' Field names
|
||||
sFields = sFields & "," & .Name
|
||||
' Updatable field names
|
||||
If Not _ReadOnly And .isDefinitelyWritable And Not .IsAutoIncrement Then sUpdatableFields = sUpdatableFields & "," & .Name
|
||||
If Not _ReadOnly And .IsWritable And Not .IsAutoIncrement Then sUpdatableFields = sUpdatableFields & "," & .Name
|
||||
' Default values
|
||||
_DefaultValues(i) = _ConvertDefaultValue(oColumn)
|
||||
' AutoValue
|
||||
|
|
Loading…
Reference in a new issue