Kaydet (Commit) fd336cf9 authored tarafından Jean-Pierre Ledure's avatar Jean-Pierre Ledure

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
üst bfd2e828
...@@ -523,86 +523,87 @@ Dim oParent As Object ...@@ -523,86 +523,87 @@ Dim oParent As Object
With com.sun.star.sdbc.DataType With com.sun.star.sdbc.DataType
If IsNull(pvValue) Then If IsNull(pvValue) Then
If Column.IsNullable = com.sun.star.sdbc.ColumnValue.NULLABLE Then Column.updateNull() Else Goto Trace_Null If Column.IsNullable = com.sun.star.sdbc.ColumnValue.NULLABLE Then Column.updateNull() Else Goto Trace_Null
End If Else
Select Case Column.Type Select Case Column.Type
Case .BIT, .BOOLEAN Case .BIT, .Boolean
If Not Utils._CheckArgument(pvValue, iArgNr, vbBoolean, , False) Then Goto Trace_Error_Value If Not Utils._CheckArgument(pvValue, iArgNr, vbBoolean, , False) Then Goto Trace_Error_Value
Column.updateBoolean(pvValue) Column.updateBoolean(pvValue)
Case .TINYINT Case .TINYINT
If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value 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 If pvValue < -128 Or pvValue > +127 Then Goto Trace_Error_Value
Column.updateShort(CInt(pvValue)) Column.updateShort(CInt(pvValue))
Case .SMALLINT Case .SMALLINT
If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value 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 If pvValue < -32768 Or pvValue > 32767 Then Goto trace_Error_Value
Column.updateInt(CLng(pvValue)) Column.updateInt(CLng(pvValue))
Case .INTEGER Case .Integer
If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value 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 If pvValue < -2147483648 Or pvValue > 2147483647 Then Goto trace_Error_Value
Column.updateInt(CLng(pvValue)) Column.updateInt(CLng(pvValue))
Case .BIGINT Case .BIGINT
If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value 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 Column.updateLong(pvValue) ' No proper type conversion for HYPER data type
Case .FLOAT Case .FLOAT
If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value 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 If Abs(pvValue) < 3.402823E38 And Abs(pvValue) > 1.401298E-45 Then Column.updateFloat(CSng(pvValue)) Else Goto trace_Error_Value
Case .REAL, .DOUBLE Case .REAL, .Double
If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value 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 '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)) Column.updateDouble(CDbl(pvValue))
Case .NUMERIC, .DECIMAL Case .NUMERIC, .DECIMAL
If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value
If Utils._hasUNOProperty(Column, "Scale") Then If Utils._hasUNOProperty(Column, "Scale") Then
If Column.Scale > 0 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 '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)) Column.updateDouble(CDbl(pvValue))
Else
Column.updateString(CStr(pvValue))
End If
Else Else
Column.updateString(CStr(pvValue)) Column.updateString(CStr(pvValue))
End If End If
Else Case .CHAR, .VARCHAR, .LONGVARCHAR
Column.updateString(CStr(pvValue)) If Not Utils._CheckArgument(pvValue, iArgNr, vbString, , False) Then Goto Trace_Error_Value
End If Column.updateString(pvValue) ' vbString
Case .CHAR, .VARCHAR, .LONGVARCHAR Case .Date
If Not Utils._CheckArgument(pvValue, iArgNr, vbString, , False) Then Goto Trace_Error_Value If Not Utils._CheckArgument(pvValue, iArgNr, vbDate, , False) Then Goto Trace_Error_Value
Column.updateString(pvValue) ' vbString vTemp = New com.sun.star.util.Date
Case .DATE With vTemp
If Not Utils._CheckArgument(pvValue, iArgNr, vbDate, , False) Then Goto Trace_Error_Value .Day = Day(pvValue)
vTemp = New com.sun.star.util.Date .Month = Month(pvValue)
With vTemp .Year = Year(pvValue)
.Day = Day(pvValue) End With
.Month = Month(pvValue) Column.updateDate(vTemp)
.Year = Year(pvValue) Case .TIME
End With If Not Utils._CheckArgument(pvValue, iArgNr, vbDate, , False) Then Goto Trace_Error_Value
Column.updateDate(vTemp) vTemp = New com.sun.star.util.Time
Case .TIME With vTemp
If Not Utils._CheckArgument(pvValue, iArgNr, vbDate, , False) Then Goto Trace_Error_Value .Hours = Hour(pvValue)
vTemp = New com.sun.star.util.Time .Minutes = Minute(pvValue)
With vTemp .Seconds = Second(pvValue)
.Hours = Hour(pvValue) '.HundredthSeconds = 0 ' replaced with Long nanoSeconds in LO 4.1 ??
.Minutes = Minute(pvValue) End With
.Seconds = Second(pvValue) Column.updateTime(vTemp)
'.HundredthSeconds = 0 ' replaced with Long nanoSeconds in LO 4.1 ?? Case .TIMESTAMP
End With If Not Utils._CheckArgument(pvValue, iArgNr, vbDate, , False) Then Goto Trace_Error_Value
Column.updateTime(vTemp) vTemp = New com.sun.star.util.DateTime
Case .TIMESTAMP With vTemp
If Not Utils._CheckArgument(pvValue, iArgNr, vbDate, , False) Then Goto Trace_Error_Value .Day = Day(pvValue)
vTemp = New com.sun.star.util.DateTime .Month = Month(pvValue)
With vTemp .Year = Year(pvValue)
.Day = Day(pvValue) .Hours = Hour(pvValue)
.Month = Month(pvValue) .Minutes = Minute(pvValue)
.Year = Year(pvValue) .Seconds = Second(pvValue)
.Hours = Hour(pvValue) '.HundredthSeconds = 0
.Minutes = Minute(pvValue) End With
.Seconds = Second(pvValue) Column.updateTimestamp(vTemp)
'.HundredthSeconds = 0 ' Case .BINARY, .VARBINARY, .LONGVARBINARY
End With ' Case .BLOB
Column.updateTimestamp(vTemp) ' Case .CLOB
' Case .BINARY, .VARBINARY, .LONGVARBINARY Case Else
' Case .BLOB Goto trace_Error
' Case .CLOB End Select
Case Else End If
Goto trace_Error
End Select
End With End With
Case Else Case Else
Goto Trace_Error Goto Trace_Error
......
...@@ -8,7 +8,7 @@ REM ============================================================================ ...@@ -8,7 +8,7 @@ REM ============================================================================
Option Explicit Option Explicit
REM Access2Base ----------------------------------------------------- REM Access2Base -----------------------------------------------------
Global Const Access2Base_Version = "1.1.0f" Global Const Access2Base_Version = "1.1.0g"
REM AcCloseSave REM AcCloseSave
REM ----------------------------------------------------------------- REM -----------------------------------------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment