diff options
author | Jean-Pierre Ledure <jp@ledure.be> | 2017-04-27 16:21:06 +0200 |
---|---|---|
committer | Jean-Pierre Ledure <jp@ledure.be> | 2017-04-27 16:23:03 +0200 |
commit | e005b0a37feedffafc3fb89c61f054b692dc0c43 (patch) | |
tree | b9d944983b22f632e6ef4873b37367fbfa697a55 /wizards/source/access2base/Field.xba | |
parent | 2762ee5fe356f0f56069165a4a1cd52a5a802134 (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.xba | 25 |
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 ' com.sun.star.sdb.OTableColumnWrapper ' or org.openoffice.comp.dbaccess.OQueryColumn ' or com.sun.star.sdb.ODataColumn @@ -33,6 +35,8 @@ Private Sub Class_Initialize() _Name = "" _ParentName = "" _ParentType = "" + _DefaultValue = "" + _DefaultValueSet = False Set Column = Nothing End Sub ' Constructor @@ -379,7 +383,7 @@ Private Function _PropertiesList() As Variant , "Description", "Name", "ObjectType", "Size", "SourceField", "SourceTable" _ , "TypeName" _ ) - Case OBJRECORDSET + Case OBJRECORDSET _PropertiesList = Array("DataType", "DataUpdatable", "dbType", "DefaultValue" _ , "Description" , "FieldSize", "Name", "ObjectType" _ , "Size", "SourceTable", "TypeName", "Value" _ @@ -450,13 +454,18 @@ Const cstMaxBinlength = 2 * 65535 If Column.IsAutoIncrement Then _PropertyGet = False ' Forces False if auto-increment (MSAccess) End If Case UCase("DefaultValue") - If Utils._hasUNOProperty(Column, "DefaultValue") Then ' Default value in database set via SQL statement - _PropertyGet = Column.DefaultValue - ElseIf Utils._hasUNOProperty(Column, "ControlDefault") Then ' Default value set in Base via table edition - If IsEmpty(Column.ControlDefault) Then _PropertyGet = "" Else _PropertyGet = Column.ControlDefault - Else - _PropertyGet = "" + ' default value buffered to avoid multiple calls + If Not _DefaultValueSet Then + If Utils._hasUNOProperty(Column, "DefaultValue") Then ' Default value in database set via SQL statement + _DefaultValue = Column.DefaultValue + ElseIf Utils._hasUNOProperty(Column, "ControlDefault") Then ' Default value set in Base via table edition + If IsEmpty(Column.ControlDefault) Then _DefaultValue = "" Else _DefaultValue = Column.ControlDefault + Else + _DefaultValue = "" + End If + _DefaultValueSet = True End If + _PropertyGet = _DefaultValue Case UCase("Description") bCond1 = Utils._hasUNOProperty(Column, "Description") bCond2 = Utils._hasUNOProperty(Column, "HelpText") @@ -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, "ControlDefault") Then ' Default value set in Base via table edition Column.ControlDefault = pvValue + _DefaultValue = pvValue + _DefaultValueSet = True End If Case UCase("Description") If _ParentType <> OBJTABLEDEF Then Goto Trace_Error |