tdf#154285 Check upper bound of arguments in SbRtl_Minute function
[LibreOffice.git] / wizards / source / access2base / Recordset.xba
blobeaa186fa6985fee1f483864fff85476d07bc77bd
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
3 <script:module xmlns:script="http://openoffice.org/2000/script" script:name="Recordset" script:language="StarBasic">
4 REM =======================================================================================================================
5 REM === The Access2Base library is a part of the LibreOffice project. ===
6 REM === Full documentation is available on http://www.access2base.com ===
7 REM =======================================================================================================================
9 Option Compatible
10 Option ClassModule
12 Option Explicit
14 REM -----------------------------------------------------------------------------------------------------------------------
15 REM --- CLASS ROOT FIELDS ---
16 REM -----------------------------------------------------------------------------------------------------------------------
18 Private _Type As String &apos; Must be RECORDSET
19 Private _This As Object &apos; Workaround for absence of This builtin function
20 Private _Parent As Object
21 Private _Name As String &apos; Unique, generated
22 Private _Fields() As Variant
23 Private _ParentName As String
24 Private _ParentType As String
25 Private _ParentDatabase As Object
26 Private _ForwardOnly As Boolean
27 Private _PassThrough As Boolean
28 Private _ReadOnly As Boolean
29 Private _CommandType As Long
30 Private _Command As String
31 Private _DataSet As Boolean &apos; True if execute() successful
32 Private _BOF As Boolean
33 Private _EOF As Boolean
34 Private _Filter As String
35 Private _EditMode As Integer &apos; dbEditxxx constants
36 Private _BookmarkBeforeNew As Variant
37 Private _BookmarkLastModified As Variant
38 Private _IsClone As Boolean
39 Private _ManageChunks As Variant &apos; Array of ChunkDescriptors
40 Private RowSet As Object &apos; com.sun.star.comp.dba.ORowSet
42 Type ChunkDescriptor
43 ChunksRequested As Boolean
44 FieldName As String
45 ChunkType As Integer &apos; vbString or vbByte
46 FileName As String
47 FileHandler As Object
48 End Type
50 REM -----------------------------------------------------------------------------------------------------------------------
51 REM --- CONSTRUCTORS / DESTRUCTORS ---
52 REM -----------------------------------------------------------------------------------------------------------------------
53 Private Sub Class_Initialize()
54 _Type = OBJRECORDSET
55 Set _This = Nothing
56 Set _Parent = Nothing
57 _Name = &quot;&quot;
58 _Fields = Array()
59 _ParentName = &quot;&quot;
60 Set _ParentDatabase = Nothing
61 _ParentType = &quot;&quot;
62 _ForwardOnly = False
63 _PassThrough = False
64 _ReadOnly = False
65 _CommandType = 0
66 _Command = &quot;&quot;
67 _DataSet = False
68 _BOF = True
69 _EOF = True
70 _Filter = &quot;&quot;
71 _EditMode = dbEditNone
72 _BookmarkBeforeNew = Null
73 _BookmarkLastModified = Null
74 _IsClone = False
75 Set _ManageChunks = Array()
76 Set RowSet = Nothing
77 End Sub &apos; Constructor
79 REM -----------------------------------------------------------------------------------------------------------------------
80 Private Sub Class_Terminate()
81 On Local Error Resume Next
82 mClose()
83 End Sub
85 REM -----------------------------------------------------------------------------------------------------------------------
86 REM --- CLASS GET/LET/SET PROPERTIES ---
87 REM -----------------------------------------------------------------------------------------------------------------------
89 REM -----------------------------------------------------------------------------------------------------------------------
90 Property Get AbsolutePosition() As Variant
91 AbsolutePosition = _PropertyGet(&quot;AbsolutePosition&quot;)
92 End Property &apos; AbsolutePosition (get)
94 Property Let AbsolutePosition(ByVal pvValue As Variant)
95 Call _PropertySet(&quot;AbsolutePosition&quot;, pvValue)
96 End Property &apos; AbsolutePosition (set)
98 REM -----------------------------------------------------------------------------------------------------------------------
99 Property Get BOF() As Boolean
100 BOF = _PropertyGet(&quot;BOF&quot;)
101 End Property &apos; BOF (get)
103 REM -----------------------------------------------------------------------------------------------------------------------
104 Property Get Bookmark() As Variant
105 Bookmark = _PropertyGet(&quot;Bookmark&quot;)
106 End Property &apos; Bookmark (get)
108 Property Let Bookmark(ByVal pvValue As Variant)
109 Call _PropertySet(&quot;Bookmark&quot;, pvValue)
110 End Property &apos; Bookmark (set)
112 REM -----------------------------------------------------------------------------------------------------------------------
113 Property Get Bookmarkable() As Boolean
114 Bookmarkable = _PropertyGet(&quot;Bookmarkable&quot;)
115 End Property &apos; Bookmarkable (get)
117 REM -----------------------------------------------------------------------------------------------------------------------
118 Property Get EOF() As Boolean
119 EOF = _PropertyGet(&quot;EOF&quot;)
120 End Property &apos; EOF (get)
122 REM -----------------------------------------------------------------------------------------------------------------------
123 Property Get EditMode() As Integer
124 EditMode = _PropertyGet(&quot;EditMode&quot;)
125 End Property &apos; EditMode (get)
127 REM -----------------------------------------------------------------------------------------------------------------------
128 Property Get Filter() As Variant
129 Filter = _PropertyGet(&quot;Filter&quot;)
130 End Property &apos; Filter (get)
132 Property Let Filter(ByVal pvValue As Variant)
133 Call _PropertySet(&quot;Filter&quot;, pvValue)
134 End Property &apos; Filter (set)
136 REM -----------------------------------------------------------------------------------------------------------------------
137 Property Get LastModified() As Variant
138 &apos; DO NOT PUBLISH
139 LastModified = _PropertyGet(&quot;LastModified&quot;)
140 End Property &apos; LastModified (get)
142 REM -----------------------------------------------------------------------------------------------------------------------
143 Property Get Name() As String
144 Name = _PropertyGet(&quot;Name&quot;)
145 End Property &apos; Name (get)
147 REM -----------------------------------------------------------------------------------------------------------------------
148 Property Get ObjectType() As String
149 ObjectType = _PropertyGet(&quot;ObjectType&quot;)
150 End Property &apos; ObjectType (get)
152 REM -----------------------------------------------------------------------------------------------------------------------
153 Property Get RecordCount() As Long
154 RecordCount = _PropertyGet(&quot;RecordCount&quot;)
155 End Property &apos; RecordCount (get)
157 REM -----------------------------------------------------------------------------------------------------------------------
158 REM --- CLASS METHODS ---
159 REM -----------------------------------------------------------------------------------------------------------------------
161 REM -----------------------------------------------------------------------------------------------------------------------
162 Public Function AddNew() As Boolean
163 &apos; Initiates the creation of a new record
165 Const cstThisSub = &quot;Recordset.AddNew&quot;
166 Dim i As Integer, iFieldsCount As Integer, oField As Object
167 Dim sDefault As String, oColumn As Object
168 Dim iValue As Integer, lValue As Long, sgValue As Single, dbValue As Double, dValue As Date
169 Dim vTemp As Variant
170 If _ErrorHandler() Then On Local Error Goto Error_Function
171 Utils._SetCalledSub(cstThisSub)
172 AddNew = False
174 With RowSet
175 &apos;Is inserting a new row allowed ?
176 If _ForwardOnly Or _ReadOnly Then Goto Error_NoUpdate
177 If Not .CanUpdateInsertedRows Then Goto Error_NoUpdate
178 If Not .IsBookmarkable Then Goto Error_NoUpdate
179 If _EditMode &lt;&gt; dbEditNone Then CancelUpdate()
180 If _BOF And _EOF Then &apos; Records before first or after last do not have a bookmark
181 _BookmarkBeforeNew = &quot;_BOF_&quot;
182 ElseIf .isBeforeFirst() Then
183 _BookmarkBeforeNew = &quot;_BOF_&quot;
184 ElseIf .isAfterLast() Then
185 _BookmarkBeforeNew = &quot;_EOF_&quot;
186 Else
187 _BookmarkBeforeNew = .getBookmark()
188 End If
190 .moveToInsertRow()
192 &apos;Set all fields to their default value
193 iFieldsCount = Fields().Count
194 On Local Error Resume Next &apos; Do not stop if default setting fails
195 For i = 0 To iFieldsCount - 1
196 Set oField = Fields(i)
197 Set oColumn = oField.Column
198 sDefault = oField.DefaultValue
199 If sDefault = &quot;&quot; Then &apos; No default value
200 If oColumn.IsNullable = com.sun.star.sdbc.ColumnValue.NULLABLE Then oColumn.updateNull()
201 Else
202 With com.sun.star.sdbc.DataType
203 Select Case oColumn.Type
204 Case .BIT, .BOOLEAN
205 If sDefault = &quot;1&quot; Then oColumn.updateBoolean(True) Else oColumn.updateBoolean(False)
206 Case .TINYINT
207 iValue = CInt(sDefault)
208 If iValue &gt;= -128 And iValue &lt;= +127 Then oColumn.updateShort(iValue)
209 Case .SMALLINT
210 lValue = CLng(sDefault)
211 If lValue &gt;= -32768 And lValue &lt;= 32767 Then oColumn.updateInt(lValue)
212 Case .INTEGER
213 lValue = CLng(sDefault)
214 If lValue &gt;= -2147483648 And lValue &lt;= 2147483647 Then oColumn.updateInt(lValue)
215 Case .BIGINT
216 lValue = CLng(sDefault)
217 Column.updateLong(lValue) &apos; No proper type conversion for HYPER data type
218 Case .FLOAT
219 sgValue = CSng(sDefault)
220 If Abs(sgValue) &lt; 3.402823E38 And Abs(sgValue) &gt; 1.401298E-45 Then oColumn.updateFloat(sgValue)
221 Case .REAL, .DOUBLE
222 dbValue = CDbl(sDefault)
223 &apos;If Abs(dbValue) &lt; 1.79769313486232E308 And Abs(dbValue) &gt; 4.94065645841247E-307 Then oColumn.updateDouble(dbValue)
224 oColumn.updateDouble(dbValue)
225 Case .NUMERIC, .DECIMAL
226 dbValue = CDbl(sDefault)
227 If Utils._hasUNOProperty(Column, &quot;Scale&quot;) Then
228 If Column.Scale &gt; 0 Then
229 &apos;If Abs(dbValue) &lt; 1.79769313486232E308 And Abs(dbValue) &gt; 4.94065645841247E-307 Then oColumn.updateDouble(dbValue)
230 oColumn.updateDouble(dbValue)
231 Else
232 oColumn.updateString(sDefault)
233 End If
234 Else
235 oColumn.updateString(sDefault)
236 End If
237 Case .CHAR, .VARCHAR, .LONGVARCHAR
238 oColumn.updateString(sDefault) &apos; vbString
239 Case .DATE
240 dValue = DateValue(sDefault)
241 vTemp = New com.sun.star.util.Date
242 With vTemp
243 .Day = Day(dValue)
244 .Month = Month(dValue)
245 .Year = Year(dValue)
246 End With
247 oColumn.updateDate(vTemp)
248 Case .TIME
249 dValue = TimeValue(sDefault)
250 vTemp = New com.sun.star.util.Time
251 With vTemp
252 .Hours = Hour(dValue)
253 .Minutes = Minute(dValue)
254 .Seconds = Second(dValue)
255 &apos;.HundredthSeconds = 0
256 End With
257 oColumn.updateTime(vTemp)
258 Case .TIMESTAMP
259 dValue = DateValue(sDefault)
260 vTemp = New com.sun.star.util.DateTime
261 With vTemp
262 .Day = Day(dValue)
263 .Month = Month(dValue)
264 .Year = Year(dValue)
265 .Hours = Hour(dValue)
266 .Minutes = Minute(dValue)
267 .Seconds = Second(dValue)
268 &apos;.HundredthSeconds = 0
269 End With
270 oColumn.updateTimestamp(vTemp)
271 &apos; Case .BINARY, .VARBINARY, .LONGVARBINARY
272 &apos; Case .BLOB
273 &apos; Case .CLOB
274 Case Else
275 End Select
276 End With
277 End If
278 Next i
279 End With
280 If _ErrorHandler() Then On Local Error Goto Error_Function Else On Local Error Goto 0
282 _EditMode = dbEditAdd
283 AddNew = True
285 Exit_Function:
286 Utils._ResetCalledSub(cstThisSub)
287 Exit Function
288 Error_Function:
289 TraceError(TRACEABORT, Err, cstThisSub, Erl)
290 GoTo Exit_Function
291 Error_NoUpdate:
292 TraceError(TRACEFATAL, ERRNOTUPDATABLE, Utils._CalledSub(), 0)
293 Goto Exit_Function
294 End Function &apos; AddNew
296 REM -----------------------------------------------------------------------------------------------------------------------
297 Public Function CancelUpdate() As Boolean
298 &apos; Cancel any edit action
300 Const cstThisSub = &quot;Recordset.CancelUpdate&quot;
302 If _ErrorHandler() Then On Local Error Goto Error_Function
303 Utils._SetCalledSub(cstThisSub)
304 CancelUpdate = False
306 With RowSet
307 Select Case _EditMode
308 Case dbEditNone
309 Case dbEditAdd
310 _AppendChunkClose(True)
311 If Not IsNull(_BookmarkBeforeNew) Then
312 Select Case _BookmarkBeforeNew
313 Case &quot;_BOF_&quot; : .beforeFirst()
314 Case &quot;_EOF_&quot; : .afterLast()
315 Case Else : .moveToBookmark(_BookmarkBeforeNew)
316 End Select
317 End If
318 Case dbEditInProgress
319 .cancelRowUpdates()
320 _AppendChunkClose(True)
321 End Select
322 End With
324 _EditMode = dbEditNone
325 _BookmarkBeforeNew = Null
326 _BookmarkLastModified = Null
327 CancelUpdate = True
329 Exit_Function:
330 Utils._ResetCalledSub(cstThisSub)
331 Exit Function
332 Error_Function:
333 TraceError(TRACEABORT, Err, cstThisSub, Erl)
334 GoTo Exit_Function
335 End Function &apos; CancelUpdate
337 REM -----------------------------------------------------------------------------------------------------------------------
338 Public Function Clone() As Object
339 &apos; Duplicate an existing recordset
341 Const cstThisSub = &quot;Recordset.Clone&quot;
343 Const cstNull = -1
344 Dim iType As Integer, iOptions As Integer, iLockEdit As Integer
345 If _ErrorHandler() Then On Local Error Goto Error_Function
346 Utils._SetCalledSub(cstThisSub)
347 Set Clone = Nothing
349 If _IsClone Then Goto Error_Clone
350 If _ForwardOnly Then iType = dbOpenForwardOnly Else iType = cstNull
351 If _PassThrough Then iOptions = dbSQLPassThrough Else iOptions = cstNull
352 iLockEdit = dbReadOnly &apos; Always read-only
354 Set Clone = OpenRecordset(iType, iOptions, iLockEdit, True)
356 Exit_Function:
357 Utils._ResetCalledSub(cstThisSub)
358 Exit Function
359 Error_Function:
360 TraceError(TRACEABORT, Err, cstThisSub, Erl)
361 GoTo Exit_Function
362 Error_Clone:
363 TraceError(TRACEFATAL, ERRRECORDSETCLONE, Utils._CalledSub(), 0)
364 Goto Exit_Function
365 End Function &apos; Clone
367 REM -----------------------------------------------------------------------------------------------------------------------
368 Public Function mClose(ByVal Optional pbRemove As Boolean) As Variant
369 &apos; Dispose UNO objects
370 &apos; If pbRemove = True, remove recordset from Recordsets collection
372 Const cstThisSub = &quot;Recordset.Close&quot;
373 Dim i As Integer
375 If _ErrorHandler() Then On Local Error Goto Exit_Function &apos; Do not stop execution
376 Utils._SetCalledSub(cstThisSub)
377 If Not IsNull(RowSet) Then
378 RowSet.close()
379 RowSet.dispose()
380 End If
381 _ForwardOnly = False
382 _PassThrough = False
383 _ReadOnly = False
384 _CommandType = 0
385 _Command = &quot;&quot;
386 _ParentName = &quot;&quot;
387 _ParentType = &quot;&quot;
388 _DataSet = False
389 _BOF = True
390 _EOF = True
391 _Filter = &quot;&quot;
392 _EditMode = dbEditNone
393 _BookmarkBeforeNew = Null
394 _BookmarkLastModified = Null
395 _IsClone = False
396 For i = 0 To UBound(_Fields)
397 If Not IsNull(_Fields(i)) Then
398 _Fields(i).Dispose()
399 Set _Fields(i) = Nothing
400 End If
401 Next i
402 _Fields = Array()
403 Set RowSet = Nothing
404 If IsMissing(pbRemove) Then pbRemove = True
405 If pbRemove Then _ParentDatabase.RecordsetsColl.Remove(_Name)
406 Set _ParentDatabase = Nothing
408 Exit_Function:
409 Utils._ResetCalledSub(cstThisSub)
410 Exit Function
411 End Function &apos; Close
413 REM -----------------------------------------------------------------------------------------------------------------------
414 Public Function Delete() As Boolean
415 &apos; Deletes the current record
417 Const cstThisSub = &quot;Recordset.Delete&quot;
419 If _ErrorHandler() Then On Local Error Goto Error_Function
420 Utils._SetCalledSub(cstThisSub)
421 Delete = False
423 &apos;Is deleting a row allowed ?
424 If _ForwardOnly Or _ReadOnly Then Goto Error_NoUpdate
425 If _EditMode &lt;&gt; dbEditNone Then
426 CancelUpdate()
427 Goto Error_Sequence
428 End If
429 If RowSet.rowDeleted() Then Goto Error_RowDeleted
431 RowSet.deleteRow()
432 Delete = True
434 Exit_Function:
435 Utils._ResetCalledSub(cstThisSub)
436 Exit Function
437 Error_Function:
438 TraceError(TRACEABORT, Err, cstThisSub, Erl)
439 GoTo Exit_Function
440 Error_NoUpdate:
441 TraceError(TRACEFATAL, ERRNOTUPDATABLE, Utils._CalledSub(), 0)
442 Goto Exit_Function
443 Error_RowDeleted:
444 TraceError(TRACEFATAL, ERRROWDELETED, Utils._CalledSub(), 0)
445 Goto Exit_Function
446 Error_Sequence:
447 TraceError(TRACEFATAL, ERRUPDATESEQUENCE, Utils._CalledSub(), 0, 1)
448 Goto Exit_Function
449 End Function &apos; Delete
451 REM -----------------------------------------------------------------------------------------------------------------------
452 Public Function Edit() As Boolean
453 &apos; Updates the current record
455 Const cstThisSub = &quot;Recordset.Edit&quot;
457 If _ErrorHandler() Then On Local Error Goto Error_Function
458 Utils._SetCalledSub(cstThisSub)
459 Edit = False
461 &apos;Is updating a row allowed ?
462 If _ForwardOnly Or _ReadOnly Then Goto Error_NoUpdate
463 If _EditMode &lt;&gt; dbEditNone Then CancelUpdate()
464 If RowSet.rowDeleted() Then Goto Error_RowDeleted
466 _EditMode = dbEditInProgress
467 Edit = True
469 Exit_Function:
470 Utils._ResetCalledSub(cstThisSub)
471 Exit Function
472 Error_Function:
473 TraceError(TRACEABORT, Err, cstThisSub, Erl)
474 GoTo Exit_Function
475 Error_NoUpdate:
476 TraceError(TRACEFATAL, ERRNOTUPDATABLE, Utils._CalledSub(), 0)
477 Goto Exit_Function
478 Error_RowDeleted:
479 TraceError(TRACEFATAL, ERRROWDELETED, Utils._CalledSub(), 0)
480 Goto Exit_Function
481 End Function &apos; Edit
483 REM -----------------------------------------------------------------------------------------------------------------------
484 Public Function Fields(ByVal Optional pvIndex As Variant) As Object
486 If _ErrorHandler() Then On Local Error Goto Error_Function
487 Const cstThisSub = &quot;Recordset.Fields&quot;
488 Utils._SetCalledSub(cstThisSub)
490 Set Fields = Nothing
491 If Not IsMissing(pvIndex) Then
492 If Not Utils._CheckArgument(pvIndex, 1, Utils._AddNumeric(vbString)) Then Goto Exit_Function
493 End If
495 Dim sObjects() As String, sObjectName As String, oObject As Object
496 Dim i As Integer, oFields As Object, iIndex As Integer
498 &apos; No argument, return a collection
499 If IsMissing(pvIndex) Then
500 Set oObject = New Collect
501 Set oObject._This = oObject
502 oObject._CollType = COLLFIELDS
503 Set oObject._Parent = _This
504 oObject._Count = RowSet.getColumns().Count
505 Goto Exit_Function
506 End If
508 Set oFields = RowSet.getColumns()
509 sObjects = oFields.ElementNames()
511 &apos; Argument is the field name
512 If VarType(pvIndex) = vbString Then
513 iIndex = -1
514 &apos; Check existence of object and find its exact (case-sensitive) name
515 For i = 0 To UBound(sObjects)
516 If UCase(pvIndex) = UCase(sObjects(i)) Then
517 sObjectName = sObjects(i)
518 iIndex = i
519 Exit For
520 End If
521 Next i
522 If iIndex &lt; 0 Then Goto Trace_NotFound
523 &apos; Argument is numeric
524 Else
525 If pvIndex &lt; 0 Or pvIndex &gt; UBound(sObjects) Then Goto Trace_IndexError
526 sObjectName = sObjects(pvIndex)
527 iIndex = pvIndex
528 End If
530 &apos; Check if field object already buffered in _Fields() array
531 If UBound(_Fields) &lt; 0 Then &apos; Initialize _Fields
532 ReDim _Fields(0 To UBound(sObjects))
533 For i = 0 To UBound(sObjects)
534 Set _Fields(i) = Nothing
535 Next i
536 End If
537 If Not IsNull(_Fields(iIndex)) Then
538 Set oObject = _Fields(iIndex)
539 &apos; Otherwise create new field object
540 Else
541 Set oObject = New Field
542 Set oObject._This = oObject
543 oObject._Name = sObjectName
544 Set oObject.Column = oFields.getByName(sObjectName)
545 If Utils._hasUNOProperty(oObject.Column, &quot;Precision&quot;) Then oObject._Precision = oObject.Column.Precision
546 oObject._ParentName = _Name
547 oObject._ParentType = _Type
548 Set oObject._ParentDatabase = _ParentDatabase
549 Set oObject._ParentRecordset = _This
550 Set _Fields(iIndex) = oObject
551 End If
553 Exit_Function:
554 Set Fields = oObject
555 Set oObject = Nothing
556 Utils._ResetCalledSub(cstThisSub)
557 Exit Function
558 Error_Function:
559 TraceError(TRACEABORT, Err, cstThisSub, Erl)
560 GoTo Exit_Function
561 Trace_NotFound:
562 TraceError(TRACEFATAL, ERROBJECTNOTFOUND, Utils._CalledSub(), 0, , Array(_GetLabel(&quot;FIELD&quot;), pvIndex))
563 Goto Exit_Function
564 Trace_IndexError:
565 TraceError(TRACEFATAL, ERRCOLLECTION, Utils._CalledSub(), 0)
566 Goto Exit_Function
567 End Function &apos; Fields
569 REM -----------------------------------------------------------------------------------------------------------------------
570 Public Function getProperty(Optional ByVal pvProperty As Variant) As Variant
571 &apos; Return property value of psProperty property name
573 Const cstThisSub = &quot;Recordset.getProperty&quot;
574 Utils._SetCalledSub(cstThisSub)
575 If IsMissing(pvProperty) Then Call _TraceArguments()
576 getProperty = _PropertyGet(pvProperty)
577 Utils._ResetCalledSub(cstThisSub)
579 End Function &apos; getProperty
581 REM -----------------------------------------------------------------------------------------------------------------------
582 Public Function GetRows(ByVal Optional pvNumRows As variant, ByVal Optional pbStrDate As Boolean) As Variant
583 &apos; UNPUBLISHED - pbStrDate = True forces all dates to be converted into strings
585 If _ErrorHandler() Then On Local Error Goto Error_Function
586 Const cstThisSub = &quot;Recordset.GetRows&quot;
587 Utils._SetCalledSub(cstThisSub)
588 If IsMissing(pbStrDate) Then pbStrDate = False
590 Dim vMatrix() As Variant, lSize As Long, iNumFields As Integer, i As Integer
591 vMatrix() = Array()
592 If IsMissing(pvNumRows) Then Call _TraceArguments()
593 If Not Utils._CheckArgument(pvNumRows, 1, Utils._AddNumeric()) Then Goto Exit_Function
594 If pvNumRows &lt; 1 Then Goto Trace_Error
595 If IsNull(RowSet) Then Goto Trace_Closed
596 If Not _DataSet Then Goto Exit_Function
598 If _EditMode &lt;&gt; dbEditNone Then CancelUpdate()
600 If _EOF Then Goto Exit_Function
602 lSize = -1
603 iNumFields = RowSet.getColumns().Count - 1
604 If iNumFields &lt; 0 Then Goto Exit_Function
606 ReDim vMatrix(0 To iNumFields, 0 To pvNumRows - 1)
608 Do While Not _EOF And lSize &lt; pvNumRows - 1
609 lSize = lSize + 1
610 For i = 0 To iNumFields
611 vMatrix(i, lSize) = Utils._getResultSetColumnValue(RowSet, i + 1)
612 If pbStrDate And IsDate(vMatrix(i, lSize)) Then vMatrix(i, lSize) = _CStr(vMatrix(i, lSize))
613 Next i
614 _Move(&quot;NEXT&quot;)
615 Loop
616 If lSize &lt; pvNumRows - 1 Then &apos; Resize to number of fetched records
617 ReDim Preserve vMatrix(0 To iNumFields, 0 To lSize)
618 End If
620 Exit_Function:
621 GetRows() = vMatrix()
622 Utils._ResetCalledSub(cstThisSub)
623 Exit Function
624 Error_Function:
625 TraceError(TRACEABORT, Err, cstThisSub, Erl)
626 GoTo Exit_Function
627 Trace_Error:
628 TraceError(TRACEFATAL, ERRWRONGARGUMENT, Utils._CalledSub(), 0, , Array(1, pvNumRows))
629 Set Controls = Nothing
630 Goto Exit_Function
631 Trace_Closed:
632 TraceError(TRACEFATAL, ERRRECORDSETCLOSED, Utils._CalledSub(), 0)
633 Goto Exit_Function
634 End Function &apos; GetRows V1.1.0
636 REM -----------------------------------------------------------------------------------------------------------------------
637 Public Function hasProperty(ByVal Optional pvProperty As Variant) As Boolean
638 &apos; Return True if object has a valid property called pvProperty (case-insensitive comparison !)
640 Const cstThisSub = &quot;Recordset.hasProperty&quot;
641 Utils._SetCalledSub(cstThisSub)
642 If IsMissing(pvProperty) Then hasProperty = PropertiesGet._hasProperty(_Type, _PropertiesList()) Else hasProperty = PropertiesGet._hasProperty(_Type, _PropertiesList(), pvProperty)
643 Utils._ResetCalledSub(cstThisSub)
644 Exit Function
646 End Function &apos; hasProperty
648 REM -----------------------------------------------------------------------------------------------------------------------
649 Public Function Move(ByVal Optional pvRelative As Variant, ByVal Optional pvBookmark As variant) As Boolean
650 &apos; Move record pointer Relative rows vs. bookmark or current record
652 If IsMissing(pvRelative) Then Call _TraceArguments()
653 If Not Utils._CheckArgument(pvRelative, 1, Utils._AddNumeric()) Then Goto Exit_Function
655 If IsMissing(pvBookmark) Then Move = _Move(pvRelative) Else Move = _Move(pvRelative, pvBookmark)
657 Exit_Function:
658 Exit Function
659 End Function &apos; Move
661 REM -----------------------------------------------------------------------------------------------------------------------
662 Public Function MoveFirst() As Boolean
663 MoveFirst = _Move(&quot;First&quot;)
664 End Function &apos; MoveFirst
666 REM -----------------------------------------------------------------------------------------------------------------------
667 Public Function MoveLast() As Boolean
668 MoveLast = _Move(&quot;Last&quot;)
669 End Function &apos; MoveLast
671 REM -----------------------------------------------------------------------------------------------------------------------
672 Public Function MoveNext() As Boolean
673 MoveNext = _Move(&quot;Next&quot;)
674 End Function &apos; MoveNext
676 REM -----------------------------------------------------------------------------------------------------------------------
677 Public Function MovePrevious() As Boolean
678 MovePrevious = _Move(&quot;Previous&quot;)
679 End Function &apos; MovePrevious
681 REM -----------------------------------------------------------------------------------------------------------------------
682 Public Function OpenRecordset(ByVal Optional pvType As Variant _
683 , ByVal Optional pvOptions As Variant _
684 , ByVal Optional pvLockEdit As Variant _
685 , ByVal Optional pbClone As Boolean) As Object
686 &apos;Return a Recordset object based on current recordset object with filter addition
688 If _ErrorHandler() Then On Local Error Goto Error_Function
689 Dim cstThisSub As String
690 cstThisSub = Utils._PCase(_Type) &amp; &quot;.OpenRecordset&quot;
691 Utils._SetCalledSub(cstThisSub)
692 Set OpenRecordset = Nothing
693 Const cstNull = -1
695 Dim oObject As Object
696 Set oObject = Nothing
697 If IsMissing(pvType) Then
698 pvType = cstNull
699 Else
700 If Not Utils._CheckArgument(pvType, 1, Utils._AddNumeric(), Array(cstNull, dbOpenForwardOnly)) Then Goto Exit_Function
701 End If
702 If IsMissing(pvOptions) Then
703 pvOptions = cstNull
704 Else
705 If Not Utils._CheckArgument(pvOptions, 2, Utils._AddNumeric(), Array(cstNull, dbSQLPassThrough)) Then Goto Exit_Function
706 End If
707 If IsMissing(pvLockEdit) Then
708 pvLockEdit = cstNull
709 Else
710 If Not Utils._CheckArgument(pvLockEdit, 3, Utils._AddNumeric(), Array(cstNull, dbReadOnly)) Then Goto Exit_Function
711 End If
712 If IsMissing(pbClone) Then pbClone = False &apos; pbClone is a not published argument
714 Set oObject = New Recordset
715 With oObject
716 ._CommandType = _CommandType
717 ._Command = _Command
718 ._ParentName = _Name
719 ._ParentType = _Type
720 Set ._ParentDatabase = _ParentDatabase
721 Set ._This = oObject
722 ._ForwardOnly = ( pvType = dbOpenForwardOnly )
723 ._PassThrough = ( pvOptions = dbSQLPassThrough )
724 ._ReadOnly = ( (pvLockEdit = dbReadOnly) Or _ReadOnly )
725 Select Case True
726 Case pbClone : Call ._Initialize(, RowSet)
727 Case _Filter &lt;&gt; &quot;&quot; : Call ._Initialize(_Filter)
728 Case Else : Call ._Initialize()
729 End Select
730 End With
731 With _ParentDatabase
732 .RecordsetMax = .RecordsetMax + 1
733 oObject._Name = Format(.RecordsetMax, &quot;0000000&quot;)
734 .RecordsetsColl.Add(oObject, UCase(oObject._Name))
735 End With
737 If Not ( oObject._BOF And oObject._EOF ) Then oObject.MoveFirst() &apos; Do nothing if resultset empty
739 Exit_Function:
740 Set OpenRecordset = oObject
741 Set oObject = Nothing
742 Utils._ResetCalledSub(cstThisSub)
743 Exit Function
744 Error_Function:
745 TraceError(TRACEABORT, Err, Utils._CalledSub(), Erl)
746 GoTo Exit_Function
747 End Function &apos; OpenRecordset
749 REM -----------------------------------------------------------------------------------------------------------------------
750 Public Function Properties(ByVal Optional pvIndex As Variant) As Variant
751 &apos; Return
752 &apos; a Collection object if pvIndex absent
753 &apos; a Property object otherwise
755 Const cstThisSub = &quot;Recordset.Properties&quot;
756 Utils._SetCalledSub(cstThisSub)
757 Dim vProperty As Variant, vPropertiesList() As Variant, sObject As String
758 vPropertiesList = _PropertiesList()
759 sObject = Utils._PCase(_Type)
760 If IsMissing(pvIndex) Then
761 vProperty = PropertiesGet._Properties(sObject, _This, vPropertiesList)
762 Else
763 vProperty = PropertiesGet._Properties(sObject, _This, vPropertiesList, pvIndex)
764 vProperty._Value = _PropertyGet(vPropertiesList(pvIndex))
765 End If
766 Set vProperty._ParentDatabase = _ParentDatabase
768 Exit_Function:
769 Set Properties = vProperty
770 Utils._ResetCalledSub(cstThisSub)
771 Exit Function
772 End Function &apos; Properties
774 REM -----------------------------------------------------------------------------------------------------------------------
775 Public Function setProperty(ByVal Optional psProperty As String, ByVal Optional pvValue As Variant) As Boolean
776 &apos; Return True if property setting OK
777 Const cstThisSub = &quot;Recordset.setProperty&quot;
778 Utils._SetCalledSub(cstThisSub)
779 setProperty = _PropertySet(psProperty, pvValue)
780 Utils._ResetCalledSub(cstThisSub)
781 End Function
783 REM -----------------------------------------------------------------------------------------------------------------------
784 Public Function Update() As Boolean
785 &apos; Finalize the updates of the current record
787 Const cstThisSub = &quot;Recordset.Update&quot;
789 If _ErrorHandler() Then On Local Error Goto Error_Function
790 Utils._SetCalledSub(cstThisSub)
791 Update = False
793 &apos;Is updating a row allowed ?
794 If _ForwardOnly Or _ReadOnly Then Goto Error_NoUpdate
795 With RowSet
796 If .rowDeleted() Then Goto Error_RowDeleted
797 Select Case _EditMode
798 Case dbEditNone
799 Goto Trace_Error_Update
800 Case dbEditAdd
801 _AppendChunkClose(False)
802 If .IsNew And .IsModified Then .insertRow()
803 _BookmarkLastModified = .getBookmark()
804 If Not IsNull(_BookmarkBeforeNew) Then
805 Select Case _BookmarkBeforeNew
806 Case &quot;_BOF_&quot; : .beforeFirst()
807 Case &quot;_EOF_&quot; : .afterLast()
808 Case Else : .moveToBookmark(_BookmarkBeforeNew)
809 End Select
810 End If
811 Case dbEditInProgress
812 _AppendChunkClose(False)
813 If .IsModified Then
814 .updateRow()
815 _BookmarkLastModified = .getBookmark()
816 End If
817 End Select
818 End With
819 _EditMode = dbEditNone
820 Update = True
822 Exit_Function:
823 Utils._ResetCalledSub(cstThisSub)
824 Exit Function
825 Error_Function:
826 TraceError(TRACEABORT, Err, cstThisSub, Erl)
827 GoTo Exit_Function
828 Error_NoUpdate:
829 TraceError(TRACEFATAL, ERRNOTUPDATABLE, Utils._CalledSub(), 0)
830 Goto Exit_Function
831 Trace_Error_Update:
832 TraceError(TRACEFATAL, ERRUPDATESEQUENCE, Utils._CalledSub(), 0, 1)
833 Goto Exit_Function
834 Error_RowDeleted:
835 TraceError(TRACEFATAL, ERRROWDELETED, Utils._CalledSub(), 0)
836 Goto Exit_Function
837 End Function &apos; Update
839 REM -----------------------------------------------------------------------------------------------------------------------
840 REM --- PRIVATE FUNCTIONS ---
841 REM -----------------------------------------------------------------------------------------------------------------------
843 REM -----------------------------------------------------------------------------------------------------------------------
844 Public Function _AppendChunk(ByVal psFieldName As String, ByRef pvChunk As Variant, piChunkType) As Boolean
845 &apos; Write chunk at the end of the file dedicated to the given field
847 If _ErrorHandler() Then On Local Error GoTo Error_Function
848 Dim oFileAccess As Object
849 Dim i As Integer, oChunk As Object, iChunk As Integer
851 &apos; Do nothing if chunk meaningless
852 _AppendChunk = False
853 If IsNull(pvChunk) Then GoTo Exit_Function
854 If IsArray(pvChunk) Then
855 If UBound(pvChunk) &lt; LBound(pvChunk) Then GoTo Exit_Function &apos; Empty array
856 End If
858 &apos; Find or create relevant chunk entry
859 iChunk = -1
860 For i = 0 To UBound(_ManageChunks)
861 Set oChunk = _ManageChunks(i)
862 If oChunk.FieldName = psFieldName Then
863 iChunk = i
864 Exit For
865 End If
866 Next i
867 If iChunk = -1 Then
868 _AppendChunkInit(psFieldName)
869 iChunk = UBound(_ManageChunks)
870 End If
872 Set oChunk = _ManageChunks(iChunk)
873 With oChunk
874 If Not .ChunksRequested Then &apos; First chunk
875 .ChunksRequested = True
876 .ChunkType = piChunkType
877 .FileName = Utils._GetRandomFileName(_Name)
878 Set oFileAccess = CreateUnoService(&quot;com.sun.star.ucb.SimpleFileAccess&quot;)
879 .FileHandler = oFileAccess.openFileWrite(.FileName)
880 End If
881 .FileHandler.writeBytes(pvChunk)
882 End With
883 _AppendChunk = True
885 Exit_Function:
886 Exit Function
887 Error_Function:
888 TraceError(TRACEABORT, Err, &quot;Recordset._AppendChunk&quot;, Erl)
889 GoTo Exit_Function
890 End Function &apos; AppendChunk V1.5.0
892 REM -----------------------------------------------------------------------------------------------------------------------
893 Public Function _AppendChunkClose(ByVal pbCancel As Boolean) As Boolean
894 &apos; Stores file content to database field(s)
895 &apos; Called from Update() [pbCancel = False] or CancelUpdate() [pbCancel = True]
897 If _ErrorHandler() Then On Local Error GoTo Error_Function
898 Dim oFileAccess As Object, oStream As Object, lFileLength As Long, oField As Object
899 Dim i As Integer, oChunk As Object
901 _AppendChunkClose = False
902 For i = 0 To UBound(_ManageChunks)
903 Set oChunk = _ManageChunks(i)
904 With oChunk
905 If Not .ChunksRequested Then GoTo Exit_Function
906 If IsNull(.FileHandler) Then GoTo Exit_Function
907 .Filehandler.closeOutput
908 Set oFileAccess = CreateUnoService(&quot;com.sun.star.ucb.SimpleFileAccess&quot;)
909 &apos; Copy file to field
910 If Not pbCancel Then
911 Set oStream = oFileAccess.openFileRead(.FileName)
912 lFileLength = oStream.getLength()
913 If lFileLength &gt; 0 Then
914 Set oField = RowSet.getColumns.getByName(.FieldName)
915 Select Case .ChunkType
916 Case vbByte
917 oField.updateBinaryStream(oStream, lFileLength)
918 &apos; Case vbString &apos; DOES NOT WORK FOR CHARACTER TYPES
919 &apos; oField.updateCharacterStream(oStream, lFileLength)
920 End Select
921 End If
922 oStream.closeInput()
923 End If
924 If oFileAccess.exists(.FileName) Then oFileAccess.kill(.FileName)
925 End With
926 Next i
927 Set _ManageChunks = Array()
928 _AppendChunkClose = True
930 Exit_Function:
931 Exit Function
932 Error_Function:
933 TraceError(TRACEABORT, Err, &quot;Recordset._AppendChunkClose&quot;, Erl)
934 GoTo Exit_Function
935 End Function &apos; AppendChunkClose V1.5.0
937 REM -----------------------------------------------------------------------------------------------------------------------
938 Public Function _AppendChunkInit(psFieldName As String) As Boolean
939 &apos; Initialize chunks manager
941 Dim iSize As Integer
942 iSize = UBound(_ManageChunks) + 1
943 ReDim Preserve _ManageChunks(0 To iSize)
944 Set _ManageChunks(iSize) = New ChunkDescriptor
945 With _ManageChunks(iSize)
946 .ChunksRequested = False
947 .FieldName = psFieldName
948 .FileName = &quot;&quot;
949 Set .FileHandler = Nothing
950 End With
952 End Function &apos; AppendChunkInit V1.5.0
954 REM -----------------------------------------------------------------------------------------------------------------------
955 Public Sub _Initialize(ByVal Optional pvFilter As Variant, Optional poRowSet As Object)
956 &apos; Initialize new recordset
958 Dim sFilter As String
960 If _Command = &quot;&quot; Then Exit Sub
962 If _ErrorHandler() Then On Local Error Goto Error_Sub
963 If VarType(pvFilter) = vbError Then
964 sFilter = &quot;&quot;
965 ElseIf IsMissing(pvFilter) Then
966 sFilter = &quot;&quot;
967 Else
968 sFilter = pvFilter
969 End If
970 If Not IsMissing(poRowSet) Then &apos; Clone
971 Set RowSet = poRowSet.createResultSet()
972 _IsClone = True
973 RowSet.last() &apos; Solves bookmark desynchro when parent bookmark is used ?!?
974 Else
975 Set RowSet = CreateUnoService(&quot;com.sun.star.sdb.RowSet&quot;)
976 _IsClone = False
977 With RowSet
978 If IsNull(.ActiveConnection) Then Set .ActiveConnection = _ParentDatabase.Connection
979 .CommandType = _CommandType
980 .Command = _Command
981 If _ForwardOnly Then .ResultSetType = com.sun.star.sdbc.ResultSetType.FORWARD_ONLY _
982 Else .ResultSetType = com.sun.star.sdbc.ResultSetType.SCROLL_SENSITIVE
983 If _PassThrough Then .EscapeProcessing = False _
984 Else .EscapeProcessing = True
985 If _ReadOnly Then
986 .ResultSetConcurrency = com.sun.star.sdbc.ResultSetConcurrency.READ_ONLY
987 .TransactionIsolation = com.sun.star.sdbc.TransactionIsolation.READ_UNCOMMITTED &apos; Dirty read
988 Else
989 .ResultSetConcurrency = com.sun.star.sdbc.ResultSetConcurrency.UPDATABLE
990 .TransactionIsolation = com.sun.star.sdbc.TransactionIsolation.READ_COMMITTED
991 End If
992 End With
994 If sFilter &lt;&gt; &quot;&quot; Then &apos; Filter must be set before execute()
995 RowSet.Filter = sFilter
996 RowSet.ApplyFilter = True
997 End If
998 On Local Error Goto SQL_Error
999 RowSet.execute()
1000 On Local Error Goto Error_Sub
1001 End If
1002 _DataSet = True
1003 &apos;If the Recordset contains no records, the BOF and EOF properties are True, and there is no current record.
1004 _BOF = ( RowSet.IsRowCountFinal And RowSet.RowCount = 0 )
1005 _EOF = _BOF
1007 Exit_Sub:
1008 Exit Sub
1009 SQL_Error:
1010 TraceError(TRACEFATAL, ERRSQLSTATEMENT, Utils._CalledSub(), 0, , _Command)
1011 Goto Exit_Sub
1012 Error_Sub:
1013 TraceError(TRACEABORT, Err, &quot;Recordset._Initialize&quot;, Erl)
1014 GoTo Exit_Sub
1015 End Sub &apos; _Initialize
1017 REM -----------------------------------------------------------------------------------------------------------------------
1018 Public Function _Move(pvTarget As Variant, ByVal Optional pvBookmark As Variant, ByVal Optional pbAbsolute As Boolean) As Boolean
1019 &apos;Move to the first, last, next, or previous record in a specified Recordset object and make that record the current record.
1021 Dim cstThisSub As String
1022 cstThisSub = &quot;Recordset.Move&quot; &amp; Iif(VarType(pvTarget) = vbString, pvTarget, &quot;&quot;)
1023 Utils._SetCalledSub(cstThisSub)
1024 If _ErrorHandler() Then On Local Error Goto Error_Function
1026 If IsNull(RowSet) Then Goto Trace_Closed
1027 If Not _DataSet Then Goto Trace_NoData
1028 If _BOF And _EOF Then Goto Trace_NoData
1029 _Move = False
1030 CancelUpdate() &apos; Any Move cancels all updates, even Move(0) !
1032 Dim l As Long, lRow As Long
1033 With RowSet
1034 Select Case VarType(pvTarget)
1035 Case vbString
1036 Select Case UCase(pvTarget)
1037 Case &quot;FIRST&quot;
1038 If _ForwardOnly Then
1039 If Not ( .isBeforeFirst() Or .isFirst() ) Then
1040 Goto Trace_Forward
1041 Else
1042 .next()
1043 End If
1044 Else
1045 .first()
1046 End If
1047 Case &quot;LAST&quot;
1048 If _ForwardOnly Then
1049 If .isAfterLast() Then Goto Trace_Forward
1050 Do While Not ( .isRowCountFinal And .Row = .RowCount ) &apos; isLast() = True after reading of first records chunk
1051 .next()
1052 Loop
1053 Else
1054 .last()
1055 End If
1056 Case &quot;NEXT&quot;
1057 If _EOF Then Goto Trace_OutOfRange
1058 .next()
1059 Case &quot;PREVIOUS&quot;
1060 If _ForwardOnly Then Goto Trace_Forward
1061 If _BOF Then Goto Trace_OutOfRange
1062 .previous()
1063 End Select
1064 Case Else &apos; Relative or absolute move
1065 If IsMissing(pbAbsolute) Then pbAbsolute = False &apos; Relative move is default
1066 If _ForwardOnly And pvTarget &lt; 0 then Goto Trace_Forward
1067 If IsMissing(pvBookmark) Then
1068 If pvTarget = 0 Then Goto Exit_Function &apos; Do nothing
1069 If _ForwardOnly Then
1070 If pbAbsolute Then lRow = .getRow() Else lRow = 0
1071 For l = 1 To pvTarget - lRow
1072 If .isAfterLast() Then Exit For
1073 .next()
1074 Next l
1075 Else
1076 If pbAbsolute Then .absolute(pvTarget) Else .relative(pvTarget)
1077 End If
1078 Else &apos; Move is always relative when bookmark argument present
1079 If _ForwardOnly Then Goto Trace_Forward
1080 If pvTarget = 0 Then
1081 .moveToBookmark(pvBookmark)
1082 Else
1083 .moveRelativeToBookmark(pvBookmark, pvTarget)
1084 End If
1085 End If
1086 End Select
1088 _BOF = .isBeforeFirst() &apos; https://forum.openoffice.org/en/forum/viewtopic.php?f=47&amp;t=76640
1089 _EOF = .isAfterlast()
1090 If _BOF Or _EOF Then
1091 _Move = False
1092 Else
1093 If .rowDeleted() Then Goto Error_RowDeleted
1094 If .rowUpdated() Then .refreshRow()
1095 _Move = True
1096 End If
1097 End With
1099 Exit_Function:
1100 Utils._ResetCalledSub(cstThisSub)
1101 Exit Function
1102 Exit_Close: &apos; Force close of recordset when error raised
1103 mClose()
1104 Goto Exit_Function
1105 Error_Function:
1106 TraceError(TRACEABORT, Err, cstThisSub, Erl)
1107 GoTo Exit_Close
1108 Trace_Forward:
1109 TraceError(TRACEFATAL, ERRRECORDSETFORWARD, Utils._CalledSub(), 0)
1110 Goto Exit_Close
1111 Trace_NoData:
1112 TraceError(TRACEFATAL, ERRRECORDSETNODATA, Utils._CalledSub(), 0)
1113 Goto Exit_Close
1114 Trace_OutOfRange:
1115 TraceError(TRACEFATAL, ERRRECORDSETRANGE, Utils._CalledSub(), 0)
1116 Goto Exit_Close
1117 Error_RowDeleted:
1118 TraceError(TRACEFATAL, ERRROWDELETED, Utils._CalledSub(), 0)
1119 Goto Exit_Function
1120 Trace_Closed:
1121 TraceError(TRACEFATAL, ERRRECORDSETCLOSED, Utils._CalledSub(), 0)
1122 Goto Exit_Close
1123 End Function &apos; Move
1125 REM -----------------------------------------------------------------------------------------------------------------------
1126 Private Function _PropertiesList() As Variant
1128 _PropertiesList = Array(&quot;AbsolutePosition&quot;, &quot;BOF&quot;, &quot;Bookmarkable&quot;, &quot;Bookmark&quot;, &quot;EditMode&quot; _
1129 , &quot;EOF&quot;, &quot;Filter&quot;, &quot;LastModified&quot;, &quot;Name&quot;, &quot;ObjectType&quot; , &quot;RecordCount&quot; _
1132 End Function &apos; _PropertiesList
1134 REM -----------------------------------------------------------------------------------------------------------------------
1135 Private Function _PropertyGet(ByVal psProperty As String) As Variant
1136 &apos; Return property value of the psProperty property name
1138 If _ErrorHandler() Then On Local Error Goto Error_Function
1139 Dim cstThisSub As String
1140 cstThisSub = &quot;Recordset.get&quot;
1141 Utils._SetCalledSub(cstThisSub &amp; psProperty)
1143 _PropertyGet = EMPTY
1145 Select Case UCase(psProperty)
1146 Case UCase(&quot;AbsolutePosition&quot;)
1147 If IsNull(RowSet) Then Goto Trace_Closed
1148 With RowSet
1149 Select Case True
1150 Case _BOF And _EOF : _PropertyGet = -1
1151 Case .isBeforeFirst() Or .isAfterLast() : _PropertyGet = -1
1152 Case Else : _PropertyGet = .getRow() &apos; Not getRow() - 1 as MSAccess requires
1153 End Select
1154 End With
1155 Case UCase(&quot;BOF&quot;)
1156 If IsNull(RowSet) Then Goto Trace_Closed
1157 Select Case True
1158 Case _BOF And _EOF : _PropertyGet = True
1159 Case RowSet.isBeforeFirst() : _PropertyGet = True
1160 Case Else : _PropertyGet = False
1161 End Select
1162 Case UCase(&quot;Bookmarkable&quot;)
1163 If IsNull(RowSet) Then Goto Trace_Closed
1164 If _ForwardOnly Then _PropertyGet = False Else _PropertyGet = RowSet.IsBookmarkable
1165 Case UCase(&quot;Bookmark&quot;)
1166 If IsNull(RowSet) Then Goto Trace_Closed
1167 If RowSet.IsBookmarkable And Not _ForwardOnly Then
1168 If _BOF Or _EOF Then _PropertyGet = Null Else _PropertyGet = RowSet.getBookmark()
1169 Else
1170 _PropertyGet = Null
1171 If _ForwardOnly Then Goto Trace_Forward
1172 End If
1173 Case UCase(&quot;EditMode&quot;)
1174 If IsNull(RowSet) Then Goto Trace_Closed
1175 _PropertyGet = _EditMode
1176 Case UCase(&quot;EOF&quot;)
1177 If IsNull(RowSet) Then Goto Trace_Closed
1178 Select Case True
1179 Case _BOF And _EOF : _PropertyGet = True
1180 Case RowSet.isAfterLast() : _PropertyGet = True
1181 Case Else : _PropertyGet = False
1182 End Select
1183 Case UCase(&quot;Filter&quot;)
1184 If IsNull(RowSet) Then Goto Trace_Closed
1185 _PropertyGet = RowSet.Filter
1186 Case UCase(&quot;LastModified&quot;)
1187 If IsNull(RowSet) Then Goto Trace_Closed
1188 If RowSet.IsBookmarkable And Not _ForwardOnly Then
1189 _PropertyGet = _BookmarkLastModified
1190 Else
1191 _PropertyGet = Null
1192 If _ForwardOnly Then Goto Trace_Forward
1193 End If
1194 Case UCase(&quot;Name&quot;)
1195 _PropertyGet = _Name
1196 Case UCase(&quot;ObjectType&quot;)
1197 _PropertyGet = _Type
1198 Case UCase(&quot;RecordCount&quot;)
1199 If IsNull(RowSet) Then Goto Trace_Closed
1200 _PropertyGet = RowSet.RowCount
1201 Case Else
1202 Goto Trace_Error
1203 End Select
1205 Exit_Function:
1206 Utils._ResetCalledSub(cstThisSub &amp; psProperty)
1207 Exit Function
1208 Trace_Error:
1209 TraceError(TRACEFATAL, ERRPROPERTY, Utils._CalledSub(), 0, , psProperty)
1210 _PropertyGet = EMPTY
1211 Goto Exit_Function
1212 Trace_Forward:
1213 TraceError(TRACEFATAL, ERRRECORDSETFORWARD, Utils._CalledSub(), 0)
1214 Goto Exit_Function
1215 Trace_Closed:
1216 TraceError(TRACEFATAL, ERRRECORDSETCLOSED, Utils._CalledSub(), 0)
1217 Goto Exit_Function
1218 Error_Function:
1219 TraceError(TRACEABORT, Err, cstThisSub &amp; &quot;._PropertyGet&quot;, Erl)
1220 _PropertyGet = EMPTY
1221 GoTo Exit_Function
1222 End Function &apos; _PropertyGet
1224 REM -----------------------------------------------------------------------------------------------------------------------
1225 Private Function _PropertySet(ByVal psProperty As String, ByVal pvValue As Variant) As Boolean
1227 Dim cstThisSub As String
1228 cstThisSub = &quot;Recordset.set&quot;
1229 Utils._SetCalledSub(cstThisSub &amp; psProperty)
1230 If _ErrorHandler() Then On Local Error Goto Error_Function
1231 _PropertySet = True
1233 &apos;Execute
1234 Dim iArgNr As Integer
1235 Dim oObject As Object
1237 If _IsLeft(_A2B_.CalledSub, &quot;Recordset.&quot;) Then iArgNr = 1 Else iArgNr = 2
1238 Select Case UCase(psProperty)
1239 Case UCase(&quot;AbsolutePosition&quot;)
1240 If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value
1241 If pvValue &lt; 1 Then Goto Trace_Error_Value
1242 _Move(pvValue, , True)
1243 Case UCase(&quot;Bookmark&quot;)
1244 If IsNull(RowSet) Then Goto Trace_Closed
1245 _Move(0, pvValue)
1246 Case UCase(&quot;Filter&quot;)
1247 If IsNull(RowSet) Then Goto Trace_Closed
1248 If Not Utils._CheckArgument(pvValue, iArgNr, vbString, , False) Then Goto Trace_Error_Value
1249 _Filter = _ParentDatabase._ReplaceSquareBrackets(pvValue)
1250 Case Else
1251 Goto Trace_Error
1252 End Select
1254 Exit_Function:
1255 Utils._ResetCalledSub(cstThisSub &amp; psProperty)
1256 Exit Function
1257 Trace_Error:
1258 TraceError(TRACEFATAL, ERRPROPERTY, Utils._CalledSub(), 0, 1, psProperty)
1259 _PropertySet = False
1260 Goto Exit_Function
1261 Trace_Error_Value:
1262 TraceError(TRACEFATAL, ERRPROPERTYVALUE, Utils._CalledSub(), 0, 1, Array(pvValue, psProperty))
1263 _PropertySet = False
1264 Goto Exit_Function
1265 Trace_Closed:
1266 TraceError(TRACEFATAL, ERRRECORDSETCLOSED, Utils._CalledSub(), 0)
1267 Goto Exit_Function
1268 Error_Function:
1269 TraceError(TRACEABORT, Err, Utils._CalledSub(), Erl)
1270 _PropertySet = False
1271 GoTo Exit_Function
1272 End Function &apos; _PropertySet
1274 </script:module>