summaryrefslogtreecommitdiff
path: root/wizards/source/access2base/Field.xba
diff options
context:
space:
mode:
authorJean-Pierre Ledure <jp@ledure.be>2017-04-27 16:21:06 +0200
committerJean-Pierre Ledure <jp@ledure.be>2017-04-27 16:23:03 +0200
commite005b0a37feedffafc3fb89c61f054b692dc0c43 (patch)
treeb9d944983b22f632e6ef4873b37367fbfa697a55 /wizards/source/access2base/Field.xba
parent2762ee5fe356f0f56069165a4a1cd52a5a802134 (diff)
Access2Base - Optimize default value in field class
Buffer default value to optimize multiple records insertions Change-Id: Ia339e8f4b4d00419978503d6351b331a0b987826
Diffstat (limited to 'wizards/source/access2base/Field.xba')
-rw-r--r--wizards/source/access2base/Field.xba25
1 files changed, 18 insertions, 7 deletions
diff --git a/wizards/source/access2base/Field.xba b/wizards/source/access2base/Field.xba
index 5a7fcc4cd870..bae69310e92d 100644
--- a/wizards/source/access2base/Field.xba
+++ b/wizards/source/access2base/Field.xba
@@ -21,6 +21,8 @@ Private _ParentName As String
Private _ParentType As String
Private _ParentDatabase As Object
Private _ParentRecordset As Object
+Private _DefaultValue As String
+Private _DefaultValueSet As Boolean
Private Column As Object &apos; com.sun.star.sdb.OTableColumnWrapper
&apos; or org.openoffice.comp.dbaccess.OQueryColumn
&apos; or com.sun.star.sdb.ODataColumn
@@ -33,6 +35,8 @@ Private Sub Class_Initialize()
_Name = &quot;&quot;
_ParentName = &quot;&quot;
_ParentType = &quot;&quot;
+ _DefaultValue = &quot;&quot;
+ _DefaultValueSet = False
Set Column = Nothing
End Sub &apos; Constructor
@@ -379,7 +383,7 @@ Private Function _PropertiesList() As Variant
, &quot;Description&quot;, &quot;Name&quot;, &quot;ObjectType&quot;, &quot;Size&quot;, &quot;SourceField&quot;, &quot;SourceTable&quot; _
, &quot;TypeName&quot; _
)
- Case OBJRECORDSET
+ Case OBJRECORDSET
_PropertiesList = Array(&quot;DataType&quot;, &quot;DataUpdatable&quot;, &quot;dbType&quot;, &quot;DefaultValue&quot; _
, &quot;Description&quot; , &quot;FieldSize&quot;, &quot;Name&quot;, &quot;ObjectType&quot; _
, &quot;Size&quot;, &quot;SourceTable&quot;, &quot;TypeName&quot;, &quot;Value&quot; _
@@ -450,13 +454,18 @@ Const cstMaxBinlength = 2 * 65535
If Column.IsAutoIncrement Then _PropertyGet = False &apos; Forces False if auto-increment (MSAccess)
End If
Case UCase(&quot;DefaultValue&quot;)
- If Utils._hasUNOProperty(Column, &quot;DefaultValue&quot;) Then &apos; Default value in database set via SQL statement
- _PropertyGet = Column.DefaultValue
- ElseIf Utils._hasUNOProperty(Column, &quot;ControlDefault&quot;) Then &apos; Default value set in Base via table edition
- If IsEmpty(Column.ControlDefault) Then _PropertyGet = &quot;&quot; Else _PropertyGet = Column.ControlDefault
- Else
- _PropertyGet = &quot;&quot;
+ &apos; default value buffered to avoid multiple calls
+ If Not _DefaultValueSet Then
+ If Utils._hasUNOProperty(Column, &quot;DefaultValue&quot;) Then &apos; Default value in database set via SQL statement
+ _DefaultValue = Column.DefaultValue
+ ElseIf Utils._hasUNOProperty(Column, &quot;ControlDefault&quot;) Then &apos; Default value set in Base via table edition
+ If IsEmpty(Column.ControlDefault) Then _DefaultValue = &quot;&quot; Else _DefaultValue = Column.ControlDefault
+ Else
+ _DefaultValue = &quot;&quot;
+ End If
+ _DefaultValueSet = True
End If
+ _PropertyGet = _DefaultValue
Case UCase(&quot;Description&quot;)
bCond1 = Utils._hasUNOProperty(Column, &quot;Description&quot;)
bCond2 = Utils._hasUNOProperty(Column, &quot;HelpText&quot;)
@@ -631,6 +640,8 @@ Dim oParent As Object
If Not Utils._CheckArgument(pvValue, iArgNr, vbString, , False) Then Goto Trace_Error_Value
If Utils._hasUNOProperty(Column, &quot;ControlDefault&quot;) Then &apos; Default value set in Base via table edition
Column.ControlDefault = pvValue
+ _DefaultValue = pvValue
+ _DefaultValueSet = True
End If
Case UCase(&quot;Description&quot;)
If _ParentType &lt;&gt; OBJTABLEDEF Then Goto Trace_Error