wizards/source/sfdatabases/SF_Database.xba |    2 +-
 wizards/source/sfdatabases/SF_Dataset.xba  |    7 ++++---
 2 files changed, 5 insertions(+), 4 deletions(-)

New commits:
commit 07036eea5089feae511145412d7105cb76c1955a
Author:     Jean-Pierre Ledure <j...@ledure.be>
AuthorDate: Thu Nov 30 17:11:13 2023 +0100
Commit:     Jean-Pierre Ledure <j...@ledure.be>
CommitDate: Fri Dec 1 13:43:45 2023 +0100

    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 <j...@ledure.be>
    Tested-by: Jenkins

diff --git a/wizards/source/sfdatabases/SF_Database.xba 
b/wizards/source/sfdatabases/SF_Database.xba
index fa5d0778b873..ff0eafc5b783 100644
--- a/wizards/source/sfdatabases/SF_Database.xba
+++ b/wizards/source/sfdatabases/SF_Database.xba
@@ -28,7 +28,7 @@ Option Explicit
 &apos;&apos;&apos;             Transaction handling
 &apos;&apos;&apos;                     Changes to data remain reversible until 
the moment the running script instructs the database to commit them.
 &apos;&apos;&apos;                     The implicit (default) behaviour is 
that commit takes place after the execution of every single SQL statement.
-&apos;&apos;&apos;                     The choice can be made 
(SetTranactionMode()) to take commitments manually.
+&apos;&apos;&apos;                     The choice can be made 
(SetTransactionMode()) to take commitments manually.
 &apos;&apos;&apos;                     The Commit() and Rollback() statements 
delimit transactions.
 &apos;&apos;&apos;
 &apos;&apos;&apos;             Service invocation and usage:
diff --git a/wizards/source/sfdatabases/SF_Dataset.xba 
b/wizards/source/sfdatabases/SF_Dataset.xba
index e9eb050d93f0..02b3d35affd9 100644
--- a/wizards/source/sfdatabases/SF_Dataset.xba
+++ b/wizards/source/sfdatabases/SF_Dataset.xba
@@ -585,6 +585,7 @@ Check:
                If Not ScriptForge.SF_Utils._Validate(Header, 
&quot;Header&quot;, ScriptForge.V_BOOLEAN) Then GoTo Finally
                If Not ScriptForge.SF_Utils._Validate(MaxRows, 
&quot;MaxRows&quot;, ScriptForge.V_NUMERIC) Then GoTo Finally
        End If
+       If MaxRows &lt; 0 Then MaxRows = 1
 
 Try:
        With _RowSet
@@ -608,7 +609,7 @@ Try:
                        End If
 
                        &apos;  Load data
-                       Do While bRead And (MaxRows = 0 Or lRows &lt; 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 &lt; MaxRows - 1 Then 
bRead = .next() Else bRead = False
                        Loop
 
                Else
@@ -1343,7 +1344,7 @@ Try:
                                        &apos;  Field names
                                        sFields = sFields &amp; &quot;,&quot; 
&amp; .Name
                                        &apos;  Updatable field names
-                                       If Not _ReadOnly And 
.isDefinitelyWritable And Not .IsAutoIncrement Then sUpdatableFields = 
sUpdatableFields &amp; &quot;,&quot; &amp; .Name
+                                       If Not _ReadOnly And .IsWritable And 
Not .IsAutoIncrement Then sUpdatableFields = sUpdatableFields &amp; 
&quot;,&quot; &amp; .Name
                                        &apos;  Default values
                                        _DefaultValues(i) = 
_ConvertDefaultValue(oColumn)
                                        &apos;  AutoValue

Reply via email to