diff options
author | Jean-Pierre Ledure <jp@ledure.be> | 2014-09-13 15:40:29 +0200 |
---|---|---|
committer | Jean-Pierre Ledure <jp@ledure.be> | 2014-09-13 15:43:19 +0200 |
commit | fd336cf92e53059cd03b6bbc9792691c0e5debbc (patch) | |
tree | 3422d7ad97dcf2fab302099b7f4ebf08dd95e6f6 /wizards/source | |
parent | bfd2e82881c38a9fc448e92acfaf98174dac19cc (diff) |
Access2Base - PATCH-01 Field.setValue
setValue gives erroneously an error message when argument is Null and field is nullable
https://forum.openoffice.org/en/forum/viewtopic.php?f=47&t=61447&sid=48e231a12084933d9da1b47e50b186ea#p323714
Change-Id: Ic96e50f4c752f5fa38e8f40e80692f166fd88e4a
Diffstat (limited to 'wizards/source')
-rw-r--r-- | wizards/source/access2base/Field.xba | 155 | ||||
-rw-r--r-- | wizards/source/access2base/acConstants.xba | 2 |
2 files changed, 79 insertions, 78 deletions
diff --git a/wizards/source/access2base/Field.xba b/wizards/source/access2base/Field.xba index 4bd9154f42e2..179bf166adc4 100644 --- a/wizards/source/access2base/Field.xba +++ b/wizards/source/access2base/Field.xba @@ -523,86 +523,87 @@ Dim oParent As Object With com.sun.star.sdbc.DataType If IsNull(pvValue) Then If Column.IsNullable = com.sun.star.sdbc.ColumnValue.NULLABLE Then Column.updateNull() Else Goto Trace_Null - End If - Select Case Column.Type - Case .BIT, .BOOLEAN - If Not Utils._CheckArgument(pvValue, iArgNr, vbBoolean, , False) Then Goto Trace_Error_Value - Column.updateBoolean(pvValue) - Case .TINYINT - If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value - If pvValue < -128 Or pvValue > +127 Then Goto Trace_Error_Value - Column.updateShort(CInt(pvValue)) - Case .SMALLINT - If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value - If pvValue < -32768 Or pvValue > 32767 Then Goto trace_Error_Value - Column.updateInt(CLng(pvValue)) - Case .INTEGER - If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value - If pvValue < -2147483648 Or pvValue > 2147483647 Then Goto trace_Error_Value - Column.updateInt(CLng(pvValue)) - Case .BIGINT - If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value - Column.updateLong(pvValue) ' No proper type conversion for HYPER data type - Case .FLOAT - If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value - If Abs(pvValue) < 3.402823E38 And Abs(pvValue) > 1.401298E-45 Then Column.updateFloat(CSng(pvValue)) Else Goto trace_Error_Value - Case .REAL, .DOUBLE - If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value - 'If Abs(pvValue) < 1.79769313486232E308 And Abs(pvValue) > 4.94065645841247E-307 Then Column.updateDouble(CDbl(pvValue)) Else Goto trace_Error_Value - Column.updateDouble(CDbl(pvValue)) - Case .NUMERIC, .DECIMAL - If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value - If Utils._hasUNOProperty(Column, "Scale") Then - If Column.Scale > 0 Then - 'If Abs(pvValue) < 1.79769313486232E308 And Abs(pvValue) > 4.94065645841247E-307 Then Column.updateDouble(CDbl(pvValue)) Else Goto trace_Error_Value - Column.updateDouble(CDbl(pvValue)) + Else + Select Case Column.Type + Case .BIT, .Boolean + If Not Utils._CheckArgument(pvValue, iArgNr, vbBoolean, , False) Then Goto Trace_Error_Value + Column.updateBoolean(pvValue) + Case .TINYINT + If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value + If pvValue < -128 Or pvValue > +127 Then Goto Trace_Error_Value + Column.updateShort(CInt(pvValue)) + Case .SMALLINT + If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value + If pvValue < -32768 Or pvValue > 32767 Then Goto trace_Error_Value + Column.updateInt(CLng(pvValue)) + Case .Integer + If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value + If pvValue < -2147483648 Or pvValue > 2147483647 Then Goto trace_Error_Value + Column.updateInt(CLng(pvValue)) + Case .BIGINT + If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value + Column.updateLong(pvValue) ' No proper type conversion for HYPER data type + Case .FLOAT + If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value + If Abs(pvValue) < 3.402823E38 And Abs(pvValue) > 1.401298E-45 Then Column.updateFloat(CSng(pvValue)) Else Goto trace_Error_Value + Case .REAL, .Double + If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value + 'If Abs(pvValue) < 1.79769313486232E308 And Abs(pvValue) > 4.94065645841247E-307 Then Column.updateDouble(CDbl(pvValue)) Else Goto trace_Error_Value + Column.updateDouble(CDbl(pvValue)) + Case .NUMERIC, .DECIMAL + If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value + If Utils._hasUNOProperty(Column, "Scale") Then + If Column.Scale > 0 Then + 'If Abs(pvValue) < 1.79769313486232E308 And Abs(pvValue) > 4.94065645841247E-307 Then Column.updateDouble(CDbl(pvValue)) Else Goto trace_Error_Value + Column.updateDouble(CDbl(pvValue)) + Else + Column.updateString(CStr(pvValue)) + End If Else Column.updateString(CStr(pvValue)) End If - Else - Column.updateString(CStr(pvValue)) - End If - Case .CHAR, .VARCHAR, .LONGVARCHAR - If Not Utils._CheckArgument(pvValue, iArgNr, vbString, , False) Then Goto Trace_Error_Value - Column.updateString(pvValue) ' vbString - Case .DATE - If Not Utils._CheckArgument(pvValue, iArgNr, vbDate, , False) Then Goto Trace_Error_Value - vTemp = New com.sun.star.util.Date - With vTemp - .Day = Day(pvValue) - .Month = Month(pvValue) - .Year = Year(pvValue) - End With - Column.updateDate(vTemp) - Case .TIME - If Not Utils._CheckArgument(pvValue, iArgNr, vbDate, , False) Then Goto Trace_Error_Value - vTemp = New com.sun.star.util.Time - With vTemp - .Hours = Hour(pvValue) - .Minutes = Minute(pvValue) - .Seconds = Second(pvValue) - '.HundredthSeconds = 0 ' replaced with Long nanoSeconds in LO 4.1 ?? - End With - Column.updateTime(vTemp) - Case .TIMESTAMP - If Not Utils._CheckArgument(pvValue, iArgNr, vbDate, , False) Then Goto Trace_Error_Value - vTemp = New com.sun.star.util.DateTime - With vTemp - .Day = Day(pvValue) - .Month = Month(pvValue) - .Year = Year(pvValue) - .Hours = Hour(pvValue) - .Minutes = Minute(pvValue) - .Seconds = Second(pvValue) - '.HundredthSeconds = 0 - End With - Column.updateTimestamp(vTemp) -' Case .BINARY, .VARBINARY, .LONGVARBINARY -' Case .BLOB -' Case .CLOB - Case Else - Goto trace_Error - End Select + Case .CHAR, .VARCHAR, .LONGVARCHAR + If Not Utils._CheckArgument(pvValue, iArgNr, vbString, , False) Then Goto Trace_Error_Value + Column.updateString(pvValue) ' vbString + Case .Date + If Not Utils._CheckArgument(pvValue, iArgNr, vbDate, , False) Then Goto Trace_Error_Value + vTemp = New com.sun.star.util.Date + With vTemp + .Day = Day(pvValue) + .Month = Month(pvValue) + .Year = Year(pvValue) + End With + Column.updateDate(vTemp) + Case .TIME + If Not Utils._CheckArgument(pvValue, iArgNr, vbDate, , False) Then Goto Trace_Error_Value + vTemp = New com.sun.star.util.Time + With vTemp + .Hours = Hour(pvValue) + .Minutes = Minute(pvValue) + .Seconds = Second(pvValue) + '.HundredthSeconds = 0 ' replaced with Long nanoSeconds in LO 4.1 ?? + End With + Column.updateTime(vTemp) + Case .TIMESTAMP + If Not Utils._CheckArgument(pvValue, iArgNr, vbDate, , False) Then Goto Trace_Error_Value + vTemp = New com.sun.star.util.DateTime + With vTemp + .Day = Day(pvValue) + .Month = Month(pvValue) + .Year = Year(pvValue) + .Hours = Hour(pvValue) + .Minutes = Minute(pvValue) + .Seconds = Second(pvValue) + '.HundredthSeconds = 0 + End With + Column.updateTimestamp(vTemp) +' Case .BINARY, .VARBINARY, .LONGVARBINARY +' Case .BLOB +' Case .CLOB + Case Else + Goto trace_Error + End Select + End If End With Case Else Goto Trace_Error diff --git a/wizards/source/access2base/acConstants.xba b/wizards/source/access2base/acConstants.xba index 793f06ff4725..69e6e49903ad 100644 --- a/wizards/source/access2base/acConstants.xba +++ b/wizards/source/access2base/acConstants.xba @@ -8,7 +8,7 @@ REM ============================================================================ Option Explicit REM Access2Base ----------------------------------------------------- -Global Const Access2Base_Version = "1.1.0f" +Global Const Access2Base_Version = "1.1.0g" REM AcCloseSave REM ----------------------------------------------------------------- |