summaryrefslogtreecommitdiff
path: root/wizards
diff options
context:
space:
mode:
authorJean-Pierre Ledure <jp@ledure.be>2015-11-15 17:30:12 +0100
committerJean-Pierre Ledure <jp@ledure.be>2015-11-15 17:30:12 +0100
commit001174135b03adc513777453875a49ae23c60cae (patch)
treedd128612bc73fd6f03c3f6f1cb8a8cf675a91b44 /wizards
parent44aa71792bace19bfee54ccf95126ca964fabccf (diff)
Access2Base - Return null values correctly in Recordset.GetRows method
Use .wasNull() rather than not trustable .IsNullable() in _getResultSetColumnValue routine Change-Id: I1d1783841414193347cca588209153b5aa9b56cd
Diffstat (limited to 'wizards')
-rw-r--r--wizards/source/access2base/Utils.xba19
1 files changed, 6 insertions, 13 deletions
diff --git a/wizards/source/access2base/Utils.xba b/wizards/source/access2base/Utils.xba
index 3a2420e3c22c..dcc1b4cfe400 100644
--- a/wizards/source/access2base/Utils.xba
+++ b/wizards/source/access2base/Utils.xba
@@ -191,20 +191,17 @@ REM Modified from Roberto Benitez&apos;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 &apos; Disable error handler
vValue = Null &apos; 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 &quot;ARRAY&quot;: vValue = .getArray(piColIndex)
Case &quot;BINARY&quot;, &quot;VARBINARY&quot;, &quot;LONGVARBINARY&quot;
Set oValue = .getBinaryStream(piColIndex)
- If bNullable Then bNull = .wasNull()
- If Not bNull Then vValue = CLng(oValue.getLength()) &apos; Return length, not content
+ If Not .wasNull() Then vValue = CLng(oValue.getLength()) &apos; Return length, not content
oValue.closeInput()
Case &quot;BLOB&quot;: vValue = .getBlob(piColIndex)
Case &quot;BIT&quot;, &quot;BOOLEAN&quot;: vValue = .getBoolean(piColIndex)
@@ -212,8 +209,7 @@ Dim bNullable As Boolean, bNull As Boolean, oValue As Object
Case &quot;BYTES&quot;: vValue = .getBytes(piColIndex)
Case &quot;CLOB&quot;: vValue = .getClob(piColIndex)
Case &quot;DATE&quot;: 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 &quot;DOUBLE&quot;, &quot;REAL&quot;: vValue = .getDouble(piColIndex)
Case &quot;FLOAT&quot;: vValue = .getFloat(piColIndex)
Case &quot;INTEGER&quot;, &quot;SMALLINT&quot;: vValue = .getInt(piColIndex)
@@ -225,18 +221,15 @@ Dim bNullable As Boolean, bNull As Boolean, oValue As Object
Case &quot;SHORT&quot;, &quot;TINYINT&quot;: vValue = .getShort(piColIndex)
Case &quot;CHAR&quot;, &quot;VARCHAR&quot;, &quot;LONGVARCHAR&quot;: vValue = .getString(piColIndex)
Case &quot;TIME&quot;: vDateTime = .getTime(piColIndex)
- If bNullable Then bNull = .wasNull()
- If Not bNull Then vValue = TimeSerial(vDateTime.Hours, vDateTime.Minutes, vDateTime.Seconds)&apos;, vDateTime.HundredthSeconds)
+ If Not .wasNull() Then vValue = TimeSerial(vDateTime.Hours, vDateTime.Minutes, vDateTime.Seconds)&apos;, vDateTime.HundredthSeconds)
Case &quot;TIMESTAMP&quot;: 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)&apos;, vDateTime.HundredthSeconds)
Case Else
vValue = .getString(piColIndex) &apos;GIVE STRING A TRY
If IsNumeric(vValue) Then vValue = Val(vValue) &apos;Required when type = &quot;&quot;, 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