[Libreoffice-commits] core.git: wizards/source

Jean-Pierre Ledure jp at ledure.be
Sat Sep 13 06:43:44 PDT 2014


 wizards/source/access2base/Field.xba       |  155 ++++++++++++++---------------
 wizards/source/access2base/acConstants.xba |    2 
 2 files changed, 79 insertions(+), 78 deletions(-)

New commits:
commit fd336cf92e53059cd03b6bbc9792691c0e5debbc
Author: Jean-Pierre Ledure <jp at ledure.be>
Date:   Sat Sep 13 15:40:29 2014 +0200

    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

diff --git a/wizards/source/access2base/Field.xba b/wizards/source/access2base/Field.xba
index 4bd9154..179bf16 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 793f06f..69e6e49 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 -----------------------------------------------------------------


More information about the Libreoffice-commits mailing list