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

Jean-Pierre Ledure jp at ledure.be
Sun Nov 15 08:36:10 PST 2015


 wizards/source/access2base/Utils.xba |   19 ++++++-------------
 1 file changed, 6 insertions(+), 13 deletions(-)

New commits:
commit 001174135b03adc513777453875a49ae23c60cae
Author: Jean-Pierre Ledure <jp at ledure.be>
Date:   Sun Nov 15 17:30:12 2015 +0100

    Access2Base - Return null values correctly in Recordset.GetRows method
    
    Use .wasNull() rather than not trustable .IsNullable() in _getResultSetColumnValue routine
    
    Change-Id: I1d1783841414193347cca588209153b5aa9b56cd

diff --git a/wizards/source/access2base/Utils.xba b/wizards/source/access2base/Utils.xba
index 3a2420e..dcc1b4c 100644
--- a/wizards/source/access2base/Utils.xba
+++ b/wizards/source/access2base/Utils.xba
@@ -191,20 +191,17 @@ REM Modified from Roberto Benitez's BaseTools
 REM get the data for the column specified by ColIndex
 REM get type name from metadata
 	
-Dim vValue As Variant, sType As String, vDateTime As Variant
-Dim bNullable As Boolean, bNull As Boolean, oValue As Object
+Dim vValue As Variant, sType As String, vDateTime As Variant, oValue As Object
 
 	On Local Error Goto 0			'	Disable error handler
 	vValue = Null					'	Default value if error
 	sType = poResultSet.MetaData.getColumnTypeName(piColIndex)
 	With poResultSet
-		bNullable = ( .MetaData.IsNullable(piColIndex) = com.sun.star.sdbc.ColumnValue.NULLABLE )
 		Select Case sType
 			Case "ARRAY":							vValue = .getArray(piColIndex)
 			Case "BINARY", "VARBINARY", "LONGVARBINARY"
 													Set oValue = .getBinaryStream(piColIndex)
-													If bNullable Then bNull = .wasNull()
-													If Not bNull Then vValue = CLng(oValue.getLength())		'	Return length, not content
+													If Not .wasNull() Then vValue = CLng(oValue.getLength())		'	Return length, not content
 													oValue.closeInput()
 			Case "BLOB":							vValue = .getBlob(piColIndex)
 			Case "BIT", "BOOLEAN":					vValue = .getBoolean(piColIndex)
@@ -212,8 +209,7 @@ Dim bNullable As Boolean, bNull As Boolean, oValue As Object
 			Case "BYTES":							vValue = .getBytes(piColIndex)
 			Case "CLOB":							vValue = .getClob(piColIndex)
 			Case "DATE":							vDateTime = .getDate(piColIndex)
-													If bNullable Then bNull = .wasNull()
-													If Not bNull Then vValue = DateSerial(CInt(vDateTime.Year), CInt(vDateTime.Month), CInt(vDateTime.Day))
+													If Not .wasNull() Then vValue = DateSerial(CInt(vDateTime.Year), CInt(vDateTime.Month), CInt(vDateTime.Day))
 			Case "DOUBLE", "REAL":					vValue = .getDouble(piColIndex)
 			Case "FLOAT":							vValue = .getFloat(piColIndex)
 			Case "INTEGER", "SMALLINT":				vValue = .getInt(piColIndex)
@@ -225,18 +221,15 @@ Dim bNullable As Boolean, bNull As Boolean, oValue As Object
 			Case "SHORT", "TINYINT":				vValue = .getShort(piColIndex)
 			Case "CHAR", "VARCHAR", "LONGVARCHAR":	vValue = .getString(piColIndex)
 			Case "TIME":							vDateTime = .getTime(piColIndex)
-													If bNullable Then bNull = .wasNull()
-													If Not bNull Then vValue = TimeSerial(vDateTime.Hours, vDateTime.Minutes, vDateTime.Seconds)', vDateTime.HundredthSeconds)
+													If Not .wasNull() Then vValue = TimeSerial(vDateTime.Hours, vDateTime.Minutes, vDateTime.Seconds)', vDateTime.HundredthSeconds)
 			Case "TIMESTAMP":						vDateTime = .getTimeStamp(piColIndex)
-													If bNullable Then bNull = .wasNull()
-													If Not bNull Then vValue = DateSerial(CInt(vDateTime.Year), CInt(vDateTime.Month), CInt(vDateTime.Day)) _
+													If Not .wasNull() Then vValue = DateSerial(CInt(vDateTime.Year), CInt(vDateTime.Month), CInt(vDateTime.Day)) _
 																+ TimeSerial(vDateTime.Hours, vDateTime.Minutes, vDateTime.Seconds)', vDateTime.HundredthSeconds)
 			Case Else
 				vValue = .getString(piColIndex)						'GIVE STRING A TRY
 				If IsNumeric(vValue) Then vValue = Val(vValue)		'Required when type = "", sometimes numeric fields are returned as strings (query/MSAccess)
 		End Select
-		If bNullable Then bNull = .wasNull()
-		If bNull Then vValue = Null
+		If .wasNull() Then vValue = Null
 	End With
 	
 	_getResultSetColumnValue = vValue


More information about the Libreoffice-commits mailing list