connectivity/source/drivers/firebird/ResultSet.cxx |   23 ++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

New commits:
commit 61560ae7d6f00ba6b410f7779e9a46cf692a5400
Author:     Julien Nabet <serval2...@yahoo.fr>
AuthorDate: Sun Nov 15 15:45:26 2020 +0100
Commit:     Julien Nabet <serval2...@yahoo.fr>
CommitDate: Mon Nov 16 20:56:29 2020 +0100

    tdf#121886: Firebird Datatype Image(BLOB) is not working properly
    
    with Form or Report image controls.
    
    Implements getBytes at least when LONGVARBINARY corresponds to a BLOB
    Change-Id: I7e4e99b537333558d5c3dcd172dc54e73472553b
    
    Change-Id: I86c20310235fb4902633fab058066a1f2d62a600
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105899
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>
    Reviewed-by: Julien Nabet <serval2...@yahoo.fr>

diff --git a/connectivity/source/drivers/firebird/ResultSet.cxx 
b/connectivity/source/drivers/firebird/ResultSet.cxx
index 9409701d431f..e1b5107ae42c 100644
--- a/connectivity/source/drivers/firebird/ResultSet.cxx
+++ b/connectivity/source/drivers/firebird/ResultSet.cxx
@@ -665,10 +665,27 @@ sal_Int8 SAL_CALL OResultSet::getByte(sal_Int32 
nColumnIndex)
     return safelyRetrieveValue< ORowSetValue >(nColumnIndex);
 }
 
-Sequence< sal_Int8 > SAL_CALL OResultSet::getBytes(sal_Int32)
+Sequence< sal_Int8 > SAL_CALL OResultSet::getBytes(sal_Int32 nColumnIndex)
 {
-    return Sequence< sal_Int8 >(); // TODO: implement
-    //return safelyRetrieveValue(columnIndex);
+    // &~1 to remove the "can contain NULL" indicator
+    int aSqlType = m_pSqlda->sqlvar[nColumnIndex-1].sqltype & ~1;
+    if ( aSqlType == SQL_BLOB )
+    {
+        Reference< XBlob> xBlob = getBlob(nColumnIndex);
+        if (xBlob.is())
+        {
+            sal_Int32 aBlobLength = static_cast<sal_Int32>(xBlob->length());
+            return xBlob->getBytes(1, aBlobLength);
+        }
+        else
+            return Sequence< sal_Int8 >();
+    }
+    // TODO implement SQL_VARYING and SQL_TEXT
+    // as it's the counterpart as OPreparedStatement::setBytes
+    else
+    {
+        return Sequence< sal_Int8 >(); // TODO: implement
+    }
 }
 
 sal_Int16 SAL_CALL OResultSet::getShort(sal_Int32 columnIndex)
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to