summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2020-11-15 15:45:26 +0100
committerJulien Nabet <serval2412@yahoo.fr>2020-11-16 20:56:29 +0100
commit61560ae7d6f00ba6b410f7779e9a46cf692a5400 (patch)
tree9967d319242b254443d8fa792d1554413e7f3d74
parent17244646ff52dcb2a5d043e9a9ce0eaa8d23414d (diff)
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.grandin@collabora.co.uk> Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
-rw-r--r--connectivity/source/drivers/firebird/ResultSet.cxx23
1 files changed, 20 insertions, 3 deletions
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)