[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - connectivity/source

2022-08-15 Thread Caolán McNamara (via logerrit)
 connectivity/source/cpool/ZConnectionPool.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit d42910a040ab71e0441299caf6b017989f295131
Author: Caolán McNamara 
AuthorDate: Thu Aug 11 11:04:14 2022 +0200
Commit: Xisco Fauli 
CommitDate: Mon Aug 15 12:28:51 2022 +0200

connectivity: avoid divide by zero in calculateTimeOuts

See 
https://crashreport.libreoffice.org/stats/signature/connectivity::OConnectionPool::propertyChange(com::sun::star::beans::PropertyChangeEvent%20const%20&)

To reproduce this, blow away your config and start writer, visit tools,
options, base, connections and enable connection pooling enabled, find
com.sun.star.sdbcx.comp.hdqldb.Driver and "enable pooling for this
driver" and "apply" with the default 120 seconds, ok and exit

then open a database (based on hsqldb) and click on "tables" (to start a
connection) that default 120 seconds is the input for calculateTimeOuts
(this becomes a final m_nALiveCount of 10 by the divide by 20), now
visit the options again and change the 120 to something else and ok and
the input for calculateTimeOuts is the old "10" calculated before and
not the new expected value.

The reason appears to be in OConnectionPool::propertyChange, it expects
to get the new value of the property from evt.NewValue but it gets an
empty Any so the m_nALiveCount is not actually changed, so the
assumption it was set and will be >= 20 and sanely divisible by 20
doesn't hold.

For this easy fix, fetch the new value explicitly from the config

Change-Id: Ie91bf5328634f9aafbda1814b10c29b86a3f9cbe
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138119
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/connectivity/source/cpool/ZConnectionPool.cxx 
b/connectivity/source/cpool/ZConnectionPool.cxx
index cc90fa464e16..23e6dda1d226 100644
--- a/connectivity/source/cpool/ZConnectionPool.cxx
+++ b/connectivity/source/cpool/ZConnectionPool.cxx
@@ -282,7 +282,7 @@ void SAL_CALL OConnectionPool::propertyChange( const 
PropertyChangeEvent& evt )
 {
 if(TIMEOUT_NODENAME == evt.PropertyName)
 {
-evt.NewValue >>= m_nALiveCount;
+OPoolCollection::getNodeValue(TIMEOUT_NODENAME, m_xDriverNode) >>= 
m_nALiveCount;
 calculateTimeOuts();
 }
 }


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - connectivity/source

2022-08-07 Thread Rene Engelhard (via logerrit)
 connectivity/source/drivers/evoab2/EApi.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 4316171fc89c0b19a1be0e09773d985018a5d22d
Author: Rene Engelhard 
AuthorDate: Sun Aug 7 11:04:15 2022 +0200
Commit: Caolán McNamara 
CommitDate: Sun Aug 7 17:59:54 2022 +0200

add libebook-1.2.so.21

comparing the Debian packages of 3.44.1 and 3.45.2 the actual headers
didn't change, so no code changes needed afaics

Change-Id: Ifae6395831ca538bb1699a7f2ba4cb504e552baa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137825
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/connectivity/source/drivers/evoab2/EApi.cxx 
b/connectivity/source/drivers/evoab2/EApi.cxx
index 8f6a6f7083d0..9ec8e0d44e32 100644
--- a/connectivity/source/drivers/evoab2/EApi.cxx
+++ b/connectivity/source/drivers/evoab2/EApi.cxx
@@ -21,6 +21,7 @@
 #define  DECLARE_FN_POINTERS 1
 #include "EApi.h"
 static const char *eBookLibNames[] = {
+"libebook-1.2.so.21", // evolution-data-server 3.45.2+
 "libebook-1.2.so.20", // evolution-data-server 3.33.2+
 "libebook-1.2.so.19", // evolution-data-server 3.24+
 "libebook-1.2.so.16"


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - connectivity/source

2022-06-30 Thread Christian Lohmaier (via logerrit)
 connectivity/source/drivers/macab/MacabAddressBook.cxx |7 +++
 1 file changed, 7 insertions(+)

New commits:
commit d4b9f5219fa9aa9426f9815f1844c178a934205f
Author: Christian Lohmaier 
AuthorDate: Wed Jun 29 13:50:30 2022 +0200
Commit: Adolfo Jayme Barrientos 
CommitDate: Thu Jun 30 09:20:22 2022 +0200

related tdf#126961 don't crash when access to the macOS address book is 
denied

quick'n'dirty fix, ideally the user should get a message to reset the
privacy setting and try again...

Change-Id: I51cb852e305e285c87ff3a0e15b5198a2b1c5970
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136620
Tested-by: Jenkins
Reviewed-by: Christian Lohmaier 
(cherry picked from commit 5ab29d945a18824eec53426edece4f19a02610ed)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136640
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/connectivity/source/drivers/macab/MacabAddressBook.cxx 
b/connectivity/source/drivers/macab/MacabAddressBook.cxx
index a14b7abee9b9..02d4faf74290 100644
--- a/connectivity/source/drivers/macab/MacabAddressBook.cxx
+++ b/connectivity/source/drivers/macab/MacabAddressBook.cxx
@@ -82,6 +82,13 @@ MacabAddressBook::MacabAddressBook( )
m_xMacabRecords(nullptr),
m_bRetrievedGroups(false)
 {
+if(m_aAddressBook == nullptr)
+{
+// TODO: tell the user to reset the permission via "tccutil reset 
AddressBook"
+// or the system preferences and try again, this time granting the 
access
+throw RuntimeException(
+"failed to access the macOS address book - permission not 
granted?" );
+}
 }
 
 


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - connectivity/source

2022-06-09 Thread Julien Nabet (via logerrit)
 connectivity/source/drivers/firebird/PreparedStatement.cxx |   35 -
 1 file changed, 34 insertions(+), 1 deletion(-)

New commits:
commit 605298a6e06ccb02b206f90fb9d0b8f831349fd8
Author: Julien Nabet 
AuthorDate: Tue Jun 7 22:57:43 2022 +0200
Commit: Caolán McNamara 
CommitDate: Thu Jun 9 09:44:51 2022 +0200

tdf#149470: Firebird, Clob may need several segments to store a very long 
input

Change-Id: I85c7789f46d834d2ae1b251f915382f833bd529d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135480
Reviewed-by: Julien Nabet 
(cherry picked from commit a943e7ddd13315b18d7b33cd1b2f852144f54344)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135392
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/connectivity/source/drivers/firebird/PreparedStatement.cxx 
b/connectivity/source/drivers/firebird/PreparedStatement.cxx
index 392785b9c816..3209f9d02aea 100644
--- a/connectivity/source/drivers/firebird/PreparedStatement.cxx
+++ b/connectivity/source/drivers/firebird/PreparedStatement.cxx
@@ -52,6 +52,8 @@ using namespace com::sun::star::util;
 
 
IMPLEMENT_SERVICE_INFO(OPreparedStatement,"com.sun.star.sdbcx.firebird.PreparedStatement","com.sun.star.sdbc.PreparedStatement");
 
+constexpr size_t MAX_SIZE_SEGMENT = 65535; // max value of a segment of CLOB, 
if we want more than 65535 bytes, we need more segments
+
 
 OPreparedStatement::OPreparedStatement( Connection* _pConnection,
 const OUString& sql)
@@ -663,10 +665,41 @@ void OPreparedStatement::setClob( sal_Int32 
nParameterIndex, const OUString& rSt
 OString sData = OUStringToOString(
 rStr,
 RTL_TEXTENCODING_UTF8);
-ISC_STATUS aErr = isc_put_segment( m_statusVector,
+size_t nDataSize = sData.getLength();
+ISC_STATUS aErr = 0;
+// we can't store  more than MAX_SIZE_SEGMENT in a segment
+if (nDataSize <= MAX_SIZE_SEGMENT)
+{
+aErr = isc_put_segment( m_statusVector,
 ,
 sData.getLength(),
 sData.getStr() );
+}
+else
+{
+// if we need more, let's split the input and first let's calculate 
the nb of entire chunks needed
+size_t nNbEntireChunks = nDataSize / MAX_SIZE_SEGMENT;
+for (size_t i = 0; i < nNbEntireChunks; ++i)
+{
+OString strCurrentChunk = sData.copy(i * MAX_SIZE_SEGMENT, 
MAX_SIZE_SEGMENT);
+aErr = isc_put_segment( m_statusVector,
+,
+strCurrentChunk.getLength(),
+strCurrentChunk.getStr() );
+if (aErr)
+break;
+}
+size_t nRemainingBytes = nDataSize - (nNbEntireChunks * 
MAX_SIZE_SEGMENT);
+if (nRemainingBytes && !aErr)
+{
+// then copy the remaining
+OString strCurrentChunk = sData.copy(nNbEntireChunks * 
MAX_SIZE_SEGMENT, nRemainingBytes);
+aErr = isc_put_segment( m_statusVector,
+,
+strCurrentChunk.getLength(),
+strCurrentChunk.getStr() );
+}
+}
 
 // We need to make sure we close the Blob even if there are errors, hence 
evaluate
 // errors after closing.


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - connectivity/source

2022-04-11 Thread Caolán McNamara (via logerrit)
 connectivity/source/drivers/dbase/DTable.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 73ee783b6cacceffe79c1772ab861019652ddb98
Author: Caolán McNamara 
AuthorDate: Sat Apr 9 09:56:23 2022 +0100
Commit: Caolán McNamara 
CommitDate: Mon Apr 11 17:15:19 2022 +0200

ofz#46526 Abrt

Change-Id: Iaec536b0989c4ec11b39b1534c7798e46715d7a0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132704
Reviewed-by: Michael Stahl 
Tested-by: Jenkins

diff --git a/connectivity/source/drivers/dbase/DTable.cxx 
b/connectivity/source/drivers/dbase/DTable.cxx
index c5da1d6b2477..2665469076d9 100644
--- a/connectivity/source/drivers/dbase/DTable.cxx
+++ b/connectivity/source/drivers/dbase/DTable.cxx
@@ -946,7 +946,7 @@ bool ODbaseTable::fetchRow(OValueRefRow& _rRow, const 
OSQLColumns & _rCols, bool
 {
 case DataType::DATE:
 {
-if (aStr.getLength() != nLen)
+if (nLen < 8 || aStr.getLength() != nLen)
 {
 (*_rRow)[i]->setNull();
 break;


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - connectivity/source

2022-04-01 Thread Julien Nabet (via logerrit)
 connectivity/source/drivers/firebird/PreparedStatement.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 3507f6e6513cb53e404f2e33d5500fdeb2b7788d
Author: Julien Nabet 
AuthorDate: Fri Apr 1 19:40:21 2022 +0200
Commit: Adolfo Jayme Barrientos 
CommitDate: Fri Apr 1 23:19:48 2022 +0200

tdf#148310: Firebird: copy complete rows, CLOB field, last character lost

off by 1 pb.

Indeed we got:
610 sal_Int64 nCharWritten = 1; // XClob is indexed from 1
offapi/com/sun/star/sdbc/XClob.idl indeed indicates:
114 The substring begins at position pos and has up
115 to
116 length
117 consecutive characters.
118 
119 @param pos
120 the starting position, 1-based
121 @param length
122 the length of the substring
123 @returns
124 the substring
125 @throws SQLException
126 if a database access error occurs.
127  */
128 string getSubString([in]hyper pos, [in]long length) raises 
(SQLException);

but if the string to copy has length 1, we never enter:
while ( nLen > nCharWritten )
=> we must change this into: while ( nLen >= nCharWritten )
also number of remaining characters to take into account at each loop must 
be adapted too:
sal_Int64 nCharRemain = nLen - nCharWritten;  => would be 0
into:
sal_Int64 nCharRemain = nLen - nCharWritten + 1;

Change-Id: I7697c8312024818f73a19c39f694cf209f494d71
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132443
Tested-by: Jenkins
Reviewed-by: Julien Nabet 
(cherry picked from commit da81a880df76bebb6d9fbc770c313381a3c33268)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132378
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/connectivity/source/drivers/firebird/PreparedStatement.cxx 
b/connectivity/source/drivers/firebird/PreparedStatement.cxx
index a3abf2d68cc8..392785b9c816 100644
--- a/connectivity/source/drivers/firebird/PreparedStatement.cxx
+++ b/connectivity/source/drivers/firebird/PreparedStatement.cxx
@@ -612,9 +612,9 @@ void SAL_CALL OPreparedStatement::setClob(sal_Int32 
nParameterIndex, const Refer
 sal_Int64 nCharWritten = 1; // XClob is indexed from 1
 ISC_STATUS aErr = 0;
 sal_Int64 nLen = xClob->length();
-while ( nLen > nCharWritten )
+while ( nLen >= nCharWritten )
 {
-sal_Int64 nCharRemain = nLen - nCharWritten;
+sal_Int64 nCharRemain = nLen - nCharWritten + 1;
 constexpr sal_uInt16 MAX_SIZE = SAL_MAX_UINT16 / 4;
 sal_uInt16 nWriteSize = std::min(nCharRemain, MAX_SIZE);
 OString sData = OUStringToOString(


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - connectivity/source

2022-03-14 Thread Julien Nabet (via logerrit)
 connectivity/source/drivers/firebird/Catalog.hxx |1 +
 connectivity/source/drivers/firebird/Tables.cxx  |   10 +-
 2 files changed, 10 insertions(+), 1 deletion(-)

New commits:
commit 7dade11c99b412081eff0d5db49ede619e866737
Author: Julien Nabet 
AuthorDate: Sat Mar 12 13:59:48 2022 +0100
Commit: Xisco Fauli 
CommitDate: Mon Mar 14 13:57:06 2022 +0100

tdf#147309: Recreating a view with same name and in the same session fails 
(FB)

Since HSQLDB already worked, just do the same.

Change-Id: I44929cf36179cc3cdff6e61f05899c9a913c78b3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131442
Tested-by: Jenkins
Reviewed-by: Julien Nabet 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131447
Reviewed-by: Xisco Fauli 

diff --git a/connectivity/source/drivers/firebird/Catalog.hxx 
b/connectivity/source/drivers/firebird/Catalog.hxx
index b6bf02f6b69d..3ffb9238eda7 100644
--- a/connectivity/source/drivers/firebird/Catalog.hxx
+++ b/connectivity/source/drivers/firebird/Catalog.hxx
@@ -32,6 +32,7 @@ namespace connectivity::firebird
 virtual void refreshUsers() override;
 
 sdbcx::OCollection* getPrivateTables() const { return 
m_pTables.get(); }
+sdbcx::OCollection* getPrivateViews() const { return 
m_pViews.get(); }
 };
 
 } // namespace connectivity::firebird
diff --git a/connectivity/source/drivers/firebird/Tables.cxx 
b/connectivity/source/drivers/firebird/Tables.cxx
index 06e6806d0a4f..29662ef12643 100644
--- a/connectivity/source/drivers/firebird/Tables.cxx
+++ b/connectivity/source/drivers/firebird/Tables.cxx
@@ -9,6 +9,7 @@
 
 #include "Table.hxx"
 #include "Tables.hxx"
+#include "Views.hxx"
 #include "Catalog.hxx"
 #include "Util.hxx"
 
@@ -202,7 +203,14 @@ void Tables::dropObject(sal_Int32 nPosition, const 
OUString& sName)
 const OUString sQuoteString = m_xMetaData->getIdentifierQuoteString();
 
 m_xMetaData->getConnection()->createStatement()->execute(
-"DROP " + sType + ::dbtools::quoteName(sQuoteString,sName));
+"DROP " + sType + " " + ::dbtools::quoteName(sQuoteString,sName));
+
+if (sType == "VIEW")
+{
+Views* pViews = 
static_cast(static_cast(m_rParent).getPrivateViews());
+if ( pViews && pViews->hasByName(sName) )
+pViews->dropByNameImpl(sName);
+}
 }
 
 void connectivity::firebird::Tables::appendNew(const OUString& _rsNewTable)


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - connectivity/source

2022-02-28 Thread Caolán McNamara (via logerrit)
 connectivity/source/inc/odbc/OResultSetMetaData.hxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 45f3a8b7abb5a5e39eb9f49f4395eeac8bfb2394
Author: Caolán McNamara 
AuthorDate: Sat Feb 26 15:12:37 2022 +
Commit: Michael Stahl 
CommitDate: Mon Feb 28 11:44:40 2022 +0100

cid#1500433 Using a moved object

Change-Id: I150cd0f021aeb1aefe411f19dfcac111ac35b295
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130555
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/connectivity/source/inc/odbc/OResultSetMetaData.hxx 
b/connectivity/source/inc/odbc/OResultSetMetaData.hxx
index 6c1acc13bfb9..ea32a453e99a 100644
--- a/connectivity/source/inc/odbc/OResultSetMetaData.hxx
+++ b/connectivity/source/inc/odbc/OResultSetMetaData.hxx
@@ -62,7 +62,7 @@ namespace connectivity::odbc
 :m_vMapping(std::move(_vMapping))
 ,m_aStatementHandle( _pStmt )
 ,m_pConnection(_pConnection)
-,m_nColCount(_vMapping.size()-1)
+,m_nColCount(m_vMapping.size()-1)
 ,m_bUseODBC2Types(false)
 {}
 virtual ~OResultSetMetaData() override;


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - connectivity/source

2022-02-07 Thread Caolán McNamara (via logerrit)
 connectivity/source/drivers/firebird/PreparedStatement.cxx |6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit 07950568c85ff209c34d2ce962f6950c8d27ca90
Author: Caolán McNamara 
AuthorDate: Mon Feb 7 12:17:03 2022 +
Commit: Caolán McNamara 
CommitDate: Mon Feb 7 18:04:57 2022 +0100

fix big-endian hsql to firebird migration

Change-Id: I047d2366ad80eca701924cb0f66b6b1bcfdcac5b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129565
Reviewed-by: Michael Stahl 
Tested-by: Jenkins

diff --git a/connectivity/source/drivers/firebird/PreparedStatement.cxx 
b/connectivity/source/drivers/firebird/PreparedStatement.cxx
index 04e65b9c5e95..a3abf2d68cc8 100644
--- a/connectivity/source/drivers/firebird/PreparedStatement.cxx
+++ b/connectivity/source/drivers/firebird/PreparedStatement.cxx
@@ -209,7 +209,8 @@ void SAL_CALL OPreparedStatement::setString(sal_Int32 
nParameterIndex,
 {
 str = str.copy(0, max_varchar_len);
 }
-const auto nLength = str.getLength();
+const sal_uInt16 nLength = str.getLength();
+static_assert(sizeof(nLength) == 2, "must match dest memcpy len");
 memcpy(pVar->sqldata, , 2);
 // Actual data
 memcpy(pVar->sqldata + 2, str.getStr(), str.getLength());
@@ -910,7 +911,7 @@ void SAL_CALL OPreparedStatement::setBytes(sal_Int32 
nParameterIndex,
 {
 xBytesCopy.realloc( nMaxSize );
 }
-const auto nSize = xBytesCopy.getLength();
+const sal_uInt16 nSize = xBytesCopy.getLength();
 // 8000 corresponds to value from lcl_addDefaultParameters
 // in dbaccess/source/filter/hsqldb/createparser.cxx
 if (nSize > 8000)
@@ -918,6 +919,7 @@ void SAL_CALL OPreparedStatement::setBytes(sal_Int32 
nParameterIndex,
 free(pVar->sqldata);
 pVar->sqldata = static_cast(malloc(sizeof(char) * 
nSize + 2));
 }
+static_assert(sizeof(nSize) == 2, "must match dest memcpy len");
 // First 2 bytes indicate string size
 memcpy(pVar->sqldata, , 2);
 // Actual data


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - connectivity/source

2022-01-17 Thread Eike Rathke (via logerrit)
 connectivity/source/parse/sqlnode.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 2492429199670e30d89a81e0e227ae894764baee
Author: Eike Rathke 
AuthorDate: Mon Jan 17 15:43:07 2022 +0100
Commit: Xisco Fauli 
CommitDate: Mon Jan 17 20:34:26 2022 +0100

Resolves: tdf#146757 Use correct format index keys instead of wrong hack

The hack worked by accident as long as the internal index
constants didn't change. Which was the case with

commit f7d0c6b42a0a5ec98876006cd5048589219be741
CommitDate: Thu Sep 23 20:28:42 2021 +0200

Sort ZF_STANDARD_NEWEXTENDED_DATE_... into ZF_STANDARD_DATE category

convertDateString()
Standard + 36 == old ZF_STANDARD_DATE + 6 => DATE_SYS_DDMM
unchanged

convertDateTimeString()
Standard + 51 == old ZF_STANDARD_DATETIME + 1 => 
DATETIME_SYS_DDMM_HHMMSS
became wrong nothing (no format assigned, empty DATE slot)

convertTimeString()
Standard + 41 == old ZF_STANDARD_TIME + 1 => TIME_HHMMSS
became wrong ZF_STANDARD_DATE_SYS_D (DATE_SYS_D)

So time 08:00 double 0.3... was converted to string
"30 December 1899" which then numeric was 0.

Change-Id: I642e0a977d4e167f78537d20624e86721e518c54
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128507
Reviewed-by: Eike Rathke 
Tested-by: Jenkins
(cherry picked from commit 0d6ab8d4ea7226db53d07dc158e176fe962fd8d9)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128527
Reviewed-by: Julien Nabet 
Reviewed-by: Lionel Mamane 

diff --git a/connectivity/source/parse/sqlnode.cxx 
b/connectivity/source/parse/sqlnode.cxx
index 02056253c300..5247457d5b3d 100644
--- a/connectivity/source/parse/sqlnode.cxx
+++ b/connectivity/source/parse/sqlnode.cxx
@@ -217,7 +217,7 @@ OUString OSQLParseNode::convertDateString(const 
SQLParseNodeParameter& rParam, c
 Reference< XNumberFormatTypes > xTypes(xSupplier->getNumberFormats(), 
UNO_QUERY);
 
 double fDate = 
DBTypeConversion::toDouble(aDate,DBTypeConversion::getNULLDate(xSupplier));
-sal_Int32 nKey = xTypes->getStandardIndex(rParam.rLocale) + 36; // XXX hack
+sal_Int32 nKey = 
xTypes->getFormatIndex(NumberFormatIndex::DATE_SYS_DDMM, rParam.rLocale);
 return rParam.xFormatter->convertNumberToString(nKey, fDate);
 }
 
@@ -229,7 +229,7 @@ OUString OSQLParseNode::convertDateTimeString(const 
SQLParseNodeParameter& rPara
 Reference< XNumberFormatTypes >  xTypes(xSupplier->getNumberFormats(), 
UNO_QUERY);
 
 double fDateTime = 
DBTypeConversion::toDouble(aDate,DBTypeConversion::getNULLDate(xSupplier));
-sal_Int32 nKey = xTypes->getStandardIndex(rParam.rLocale) + 51; // XXX hack
+sal_Int32 nKey = 
xTypes->getFormatIndex(NumberFormatIndex::DATETIME_SYS_DDMM_HHMMSS, 
rParam.rLocale);
 return rParam.xFormatter->convertNumberToString(nKey, fDateTime);
 }
 
@@ -242,7 +242,7 @@ OUString OSQLParseNode::convertTimeString(const 
SQLParseNodeParameter& rParam, c
 Reference< XNumberFormatTypes >  xTypes(xSupplier->getNumberFormats(), 
UNO_QUERY);
 
 double fTime = DBTypeConversion::toDouble(aTime);
-sal_Int32 nKey = xTypes->getStandardIndex(rParam.rLocale) + 41; // XXX hack
+sal_Int32 nKey = xTypes->getFormatIndex(NumberFormatIndex::TIME_HHMMSS, 
rParam.rLocale);
 return rParam.xFormatter->convertNumberToString(nKey, fTime);
 }
 


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - connectivity/source

2022-01-12 Thread Julien Nabet (via logerrit)
 connectivity/source/drivers/evoab2/NResultSet.cxx |   14 +-
 connectivity/source/drivers/evoab2/NResultSetMetaData.cxx |   10 +-
 connectivity/source/drivers/evoab2/NStatement.cxx |   14 +++---
 3 files changed, 17 insertions(+), 21 deletions(-)

New commits:
commit 880c58db42192ebe9718a59aff44cf4d083f4049
Author: Julien Nabet 
AuthorDate: Sun Dec 12 11:59:53 2021 +0100
Commit: Christian Lohmaier 
CommitDate: Wed Jan 12 19:57:45 2022 +0100

tdf#38235: fix sort failure for Evolution

Several issues to deal with:
1) The initial pb:
"Error setting the source criteria. The column  XXX must be visible as a 
column. SQL status: 01000, Error code 1000."
=>
OEvoabResultSetMetaData::getColumnLabel was returning the nickname of the 
column with g_param_spec_get_nick
we just want the column name to display and to use

2) SQL parsing in OCommonStatement::orderByAnalysis
2 "sub-issues":
  a) ENSURE_OR_THROW was testing SQL_ISRULE( pAscDesc, opt_asc_desc )
opt_asc_desc is defined in connectivity/source/parse/sqlbison.y with:
opt_asc_desc:
{$$ = SQL_NEW_RULE;}
|   SQL_TOKEN_ASC
|   SQL_TOKEN_DESC
;
not sure if it should be kept but for DESC I had to use this:
SQL_ISTOKEN(pAscDesc, DESC)

  b) Retrieve of ascending
By default ascending is at true but then we tested the node with:
if  ( ( pAscDesc->count() == 1 ) &&  SQL_ISTOKEN( pAscDesc->getChild( 0 ), 
DESC )
But when we use DESC, it's directly a TOKEN so just this should suffice:
bool bAscending = !SQL_ISTOKEN(pAscDesc, DESC);

3) CompareContacts wasn't taking into account bAscending
since we use comparison function for g_slist_sort_with_data, I only used
int nOrder = 1;
// if descending sort, reverse order
if (!sortCol.bAscending)
nOrder = -1;
and multiply the result with this to have the ad hoc order

Change-Id: I3c360a5ef9cf0dc737a7ce4a138d2d2586abdca9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126698
Tested-by: Jenkins
Reviewed-by: Julien Nabet 
(cherry picked from commit ab864bd178a44208c98a2fd1b1248df5f1db1fc9)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126967
Reviewed-by: Christian Lohmaier 

diff --git a/connectivity/source/drivers/evoab2/NResultSet.cxx 
b/connectivity/source/drivers/evoab2/NResultSet.cxx
index 6df2d806ab3c..e6a43dab7687 100644
--- a/connectivity/source/drivers/evoab2/NResultSet.cxx
+++ b/connectivity/source/drivers/evoab2/NResultSet.cxx
@@ -308,6 +308,10 @@ static int CompareContacts( gconstpointer _lhs, 
gconstpointer _rhs, gpointer _us
 for ( const auto& sortCol : rCompData.rSortOrder )
 {
 sal_Int32 nField = sortCol.nField;
+int nOrder = 1;
+// if descending sort, reverse order
+if (!sortCol.bAscending)
+nOrder = -1;
 GType eFieldType = evoab::getGFieldType( nField );
 
 bool success =  getValue( lhs, nField, eFieldType, , 
bLhsNull )
@@ -317,9 +321,9 @@ static int CompareContacts( gconstpointer _lhs, 
gconstpointer _rhs, gpointer _us
 return 0;
 
 if ( bLhsNull && !bRhsNull )
-return -1;
+return -1 * nOrder;
 if ( !bLhsNull && bRhsNull )
-return 1;
+return 1 * nOrder;
 if ( bLhsNull && bRhsNull )
 continue;
 
@@ -329,16 +333,16 @@ static int CompareContacts( gconstpointer _lhs, 
gconstpointer _rhs, gpointer _us
 sRhs = valueToOUString( aRhsValue );
 sal_Int32 nCompResult = 
rCompData.aIntlWrapper.getCaseCollator()->compareString( sLhs, sRhs );
 if ( nCompResult != 0 )
-return nCompResult;
+return nCompResult * nOrder;
 continue;
 }
 
 bLhs = valueToBool( aLhsValue );
 bRhs = valueToBool( aRhsValue );
 if ( bLhs && !bRhs )
-return -1;
+return -1 * nOrder;
 if ( !bLhs && bRhs )
-return 1;
+return 1 * nOrder;
 continue;
 }
 
diff --git a/connectivity/source/drivers/evoab2/NResultSetMetaData.cxx 
b/connectivity/source/drivers/evoab2/NResultSetMetaData.cxx
index a980c2067041..a2ce922ff193 100644
--- a/connectivity/source/drivers/evoab2/NResultSetMetaData.cxx
+++ b/connectivity/source/drivers/evoab2/NResultSetMetaData.cxx
@@ -101,15 +101,7 @@ OUString SAL_CALL 
OEvoabResultSetMetaData::getColumnTypeName( sal_Int32 nColumnN
 
 OUString SAL_CALL OEvoabResultSetMetaData::getColumnLabel( sal_Int32 
nColumnNum )
 {
-sal_uInt32 nField = m_aEvoabFields[nColumnNum - 1];
-const ColumnProperty *pSpecs = getField(nField);
-GParamSpec *pSpec = pSpecs->pField;
-OUString aLabel;
-
-if( pSpec )
-aLabel = OStringToOUString( g_param_spec_get_nick( pSpec ),
- 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - connectivity/source

2022-01-05 Thread Julien Nabet (via logerrit)
 connectivity/source/drivers/firebird/DatabaseMetaData.cxx |7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit d12094654d83f28b292200367939ca7e6144732b
Author: Julien Nabet 
AuthorDate: Wed Dec 29 18:16:29 2021 +0100
Commit: Adolfo Jayme Barrientos 
CommitDate: Wed Jan 5 13:32:07 2022 +0100

tdf#146471: Firebird: impossible to delete an external table

See https://bugs.documentfoundation.org/show_bug.cgi?id=146471#c1
for full explanations

Change-Id: Ie75669cf951429654ff8e6c28508b9fee2ee03bb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127715
Reviewed-by: Julien Nabet 
(cherry picked from commit 13de0ade50bec34be612ba4a3196c2efd9ce3b4e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127584
Reviewed-by: Lionel Mamane 
Tested-by: Jenkins

diff --git a/connectivity/source/drivers/firebird/DatabaseMetaData.cxx 
b/connectivity/source/drivers/firebird/DatabaseMetaData.cxx
index f63468f0813f..262b6112c5b8 100644
--- a/connectivity/source/drivers/firebird/DatabaseMetaData.cxx
+++ b/connectivity/source/drivers/firebird/DatabaseMetaData.cxx
@@ -1339,8 +1339,10 @@ uno::Reference< XResultSet > SAL_CALL 
ODatabaseMetaData::getTables(
 // TODO: GLOBAL TEMPORARY, LOCAL TEMPORARY, ALIAS, SYNONYM
 if (!types.hasElements() || (types.getLength() == 1 && 
types[0].match(wld)))
 {
+// from Firebird: src/jrd/constants.h
+// rel_persistent = 0, rel_view = 1, rel_external = 2
 // All table types? I.e. includes system tables.
-queryBuf.append("(RDB$RELATION_TYPE = 0 OR RDB$RELATION_TYPE = 1) ");
+queryBuf.append("(RDB$RELATION_TYPE = 0 OR RDB$RELATION_TYPE = 1 OR 
RDB$RELATION_TYPE = 2) ");
 }
 else
 {
@@ -1406,7 +1408,8 @@ uno::Reference< XResultSet > SAL_CALL 
ODatabaseMetaData::getTables(
 }
 else
 {
-if (nTableType == 0)
+// see above about src/jrd/constants.h
+if (nTableType == 0 || nTableType == 2)
 sTableType = "TABLE";
 }
 


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - connectivity/source

2022-01-04 Thread Julien Nabet (via logerrit)
 connectivity/source/drivers/mysqlc/mysqlc_general.cxx|3 
 connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx |   32 
+-
 2 files changed, 33 insertions(+), 2 deletions(-)

New commits:
commit 6f9278886eec76fdba19e2763c194fc129a2a42e
Author: Julien Nabet 
AuthorDate: Mon Jan 3 21:19:56 2022 +0100
Commit: Julien Nabet 
CommitDate: Tue Jan 4 20:26:51 2022 +0100

tdf#146432: fix crash with REGEXP_REPLACE() executed in query editor to 
MariaDB

See bt here:
https://bugs.documentfoundation.org/attachment.cgi?id=177292

Noticing:

warn:legacy.osl:7697:7697:connectivity/source/drivers/mysqlc/mysqlc_general.cxx:188:
 mysqlToOOOType: unhandled case, falling back to VARCHAR
I found REGEXP_REPLACE returned a MYSQL_TYPE_LONG_BLOB and some locations 
should be taught about it.

Also, let's also deal with MYSQL_TYPE_TINY_BLOB and MYSQL_TYPE_MEDIUM_BLOB

Change-Id: Ib7fd6ef747ce1b1851c788d2bb5a1d4ec673aee1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127919
(cherry picked from commit e43573aae0fa07d170fb042b7184156c851c1f77)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127952
Reviewed-by: Lionel Mamane 
Tested-by: Jenkins

diff --git a/connectivity/source/drivers/mysqlc/mysqlc_general.cxx 
b/connectivity/source/drivers/mysqlc/mysqlc_general.cxx
index 35ecfee84750..17b118c531a9 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_general.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_general.cxx
@@ -164,6 +164,9 @@ sal_Int32 mysqlToOOOType(int eType, int charsetnr) noexcept
 return css::sdbc::DataType::VARCHAR;
 
 case MYSQL_TYPE_BLOB:
+case MYSQL_TYPE_TINY_BLOB:
+case MYSQL_TYPE_MEDIUM_BLOB:
+case MYSQL_TYPE_LONG_BLOB:
 if (charsetnr == 63)
 return css::sdbc::DataType::LONGVARBINARY;
 return css::sdbc::DataType::LONGVARCHAR;
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx 
b/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx
index 8360700434fc..14fdab939bc7 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx
@@ -107,12 +107,24 @@ bool OPreparedResultSet::fetchResult()
 }
 for (sal_Int32 i = 0; i < m_nColumnCount; ++i)
 {
+bool bIsBlobType = false;
+switch (m_aFields[i].type)
+{
+case MYSQL_TYPE_BLOB:
+case MYSQL_TYPE_TINY_BLOB:
+case MYSQL_TYPE_MEDIUM_BLOB:
+case MYSQL_TYPE_LONG_BLOB:
+bIsBlobType = true;
+break;
+default:
+bIsBlobType = false;
+}
 m_aMetaData[i].is_null = false;
 m_aMetaData[i].length = 0l;
 m_aMetaData[i].error = false;
 
 m_aData[i].is_null = _aMetaData[i].is_null;
-m_aData[i].buffer_length = m_aFields[i].type == MYSQL_TYPE_BLOB ? 0 : 
m_aFields[i].length;
+m_aData[i].buffer_length = bIsBlobType ? 0 : m_aFields[i].length;
 m_aData[i].length = _aMetaData[i].length;
 m_aData[i].error = _aMetaData[i].error;
 m_aData[i].buffer = nullptr;
@@ -322,8 +334,21 @@ template <> OUString 
OPreparedResultSet::retrieveValue(sal_Int32 column)
 {
 // redirect call to the appropriate method if needed
 // BLOB can be simply read out as string
+bool bIsBlobType = false;
+switch (m_aFields[column - 1].type)
+{
+case MYSQL_TYPE_BLOB:
+case MYSQL_TYPE_TINY_BLOB:
+case MYSQL_TYPE_MEDIUM_BLOB:
+case MYSQL_TYPE_LONG_BLOB:
+bIsBlobType = true;
+break;
+default:
+bIsBlobType = false;
+}
+
 if (getTypeFromMysqlType(m_aFields[column - 1].type) != 
std::type_index(typeid(OUString))
-&& m_aFields[column - 1].type != MYSQL_TYPE_BLOB)
+&& !bIsBlobType)
 return getRowSetValue(column).getString();
 const char* sStr = static_cast(m_aData[column - 1].buffer);
 
@@ -363,6 +388,9 @@ ORowSetValue OPreparedResultSet::getRowSetValue(sal_Int32 
nColumnIndex)
 case MYSQL_TYPE_NEWDECIMAL:
 return getString(nColumnIndex);
 case MYSQL_TYPE_BLOB:
+case MYSQL_TYPE_TINY_BLOB:
+case MYSQL_TYPE_MEDIUM_BLOB:
+case MYSQL_TYPE_LONG_BLOB:
 throw SQLException("Column with type BLOB cannot be converted", 
*this, "22000", 1,
Any());
 default:


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - connectivity/source

2022-01-04 Thread Krzysztof Hałasa (via logerrit)
 connectivity/source/drivers/mysqlc/mysqlc_connection.cxx |   10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

New commits:
commit 0c5e0dcd19403f967bc1ae46ebb8649b27b29b86
Author: Krzysztof Hałasa 
AuthorDate: Wed Dec 29 11:37:26 2021 +0100
Commit: Xisco Fauli 
CommitDate: Tue Jan 4 11:58:59 2022 +0100

tdf#134982: use the right protocol for Mysql/Mariadb

Thank you Krzysztof Hałasa for the patch!

Change-Id: Ib7532a716b7e0fa73f309e0a4f9af9e663e0d3df
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127673
Reviewed-by: Lionel Mamane 
Reviewed-by: Adolfo Jayme Barrientos 
Tested-by: Jenkins
(cherry picked from commit 0143ec4d3d567edf16371c1d3c3981890b71)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127786
Reviewed-by: Xisco Fauli 

diff --git a/connectivity/source/drivers/mysqlc/mysqlc_connection.cxx 
b/connectivity/source/drivers/mysqlc/mysqlc_connection.cxx
index 4cf9e916f3df..4d11c893eb13 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_connection.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_connection.cxx
@@ -73,9 +73,6 @@ void OConnection::construct(const OUString& url, const 
Sequence&
 mysql_library_init(0, nullptr, nullptr);
 mysql_init(_mysql);
 
-// use TCP as connection
-mysql_protocol_type protocol = MYSQL_PROTOCOL_TCP;
-mysql_options(_mysql, MYSQL_OPT_PROTOCOL, );
 OString charset_name{ "utf8mb4" };
 mysql_options(_mysql, MYSQL_SET_CHARSET_NAME, charset_name.getStr());
 
@@ -164,15 +161,22 @@ void OConnection::construct(const OUString& url, const 
Sequence&
 OString pass_str = OUStringToOString(aPass, m_settings.encoding);
 OString schema_str = OUStringToOString(aDbName, m_settings.encoding);
 OString socket_str;
+
+// use TCP as connection by default
+mysql_protocol_type protocol = MYSQL_PROTOCOL_TCP;
 if (unixSocketPassed)
 {
 socket_str = OUStringToOString(sUnixSocket, m_settings.encoding);
+protocol = MYSQL_PROTOCOL_SOCKET;
 }
 else if (namedPipePassed)
 {
 socket_str = OUStringToOString(sNamedPipe, m_settings.encoding);
+protocol = MYSQL_PROTOCOL_PIPE;
 }
 
+mysql_options(_mysql, MYSQL_OPT_PROTOCOL, );
+
 // flags can also be passed as last parameter
 if (!mysql_real_connect(_mysql, host_str.getStr(), user_str.getStr(), 
pass_str.getStr(),
 schema_str.getStr(), nPort, socket_str.getStr(),


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - connectivity/source

2021-12-27 Thread Julien Nabet (via logerrit)
 connectivity/source/drivers/firebird/PreparedStatement.cxx |6 ++
 1 file changed, 6 insertions(+)

New commits:
commit e6b65a50ed745914ac16fb239a593581d3432173
Author: Julien Nabet 
AuthorDate: Mon Dec 27 16:58:05 2021 +0100
Commit: Julien Nabet 
CommitDate: Mon Dec 27 19:26:10 2021 +0100

tdf#130595: Parameter query with :parameter IS NULL doesn't work

Problematic SQL here:
SELECT * FROM "Table1" WHERE "Name" = :name OR :name IS NULL

Firebird considers there are 2 parameters.

When providing an empty string, no pb, OPreparedStatement::setNull is 
called which is ok for both parameters

When providing a non empty string, we go to OPreparedStatement::setString. 
For first param no pb
but for second param, sql type is SQL_NULL so it must be taken into account
See 
https://www.firebirdsql.org/file/documentation/html/en/refdocs/fblangref25/firebird-25-language-reference.html#fblangref25-datatypes-special-sqlnull
for full details

Change-Id: I80dff259d85957e8547c098e4c48b642cce26804
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127571
Reviewed-by: Lionel Mamane 
Tested-by: Jenkins

diff --git a/connectivity/source/drivers/firebird/PreparedStatement.cxx 
b/connectivity/source/drivers/firebird/PreparedStatement.cxx
index 8d08a207a67c..04e65b9c5e95 100644
--- a/connectivity/source/drivers/firebird/PreparedStatement.cxx
+++ b/connectivity/source/drivers/firebird/PreparedStatement.cxx
@@ -262,6 +262,12 @@ void SAL_CALL OPreparedStatement::setString(sal_Int32 
nParameterIndex,
 setBoolean(nParameterIndex, boolValue);
 break;
 }
+case SQL_NULL:
+{
+// See 
https://www.firebirdsql.org/file/documentation/html/en/refdocs/fblangref25/firebird-25-language-reference.html#fblangref25-datatypes-special-sqlnull
+pVar->sqldata = nullptr;
+break;
+}
 default:
 ::dbtools::throwSQLException(
 "Incorrect type for setString",


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - connectivity/source

2021-12-27 Thread Julien Nabet (via logerrit)
 connectivity/source/drivers/firebird/Util.cxx |6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit 6d82b1f0c6deaaf55df762dbfda03eae21ff82c2
Author: Julien Nabet 
AuthorDate: Mon Dec 27 11:34:27 2021 +0100
Commit: Julien Nabet 
CommitDate: Mon Dec 27 15:40:01 2021 +0100

Related tdf#130595: SQL_NULL means pVar->sqldata = nullptr

Fix this assertion:
0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:49
1  0x7fcc7f2b2536 in __GI_abort () at abort.c:79
2  0x7fcc7f2b241f in __assert_fail_base
   (fmt=0x7fcc7f418998 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", 
assertion=0x7fcc614a5de7 "false", file=0x7fcc614b3542 
"/home/julien/lo/libreoffice/connectivity/source/drivers/firebird/Util.cxx", 
line=346, function=) at assert.c:92
3  0x7fcc7f2c1212 in __GI___assert_fail
   (assertion=0x7fcc614a5de7 "false", file=0x7fcc614b3542 
"/home/julien/lo/libreoffice/connectivity/source/drivers/firebird/Util.cxx", 
line=346, function=0x7fcc614b3865 "void 
connectivity::firebird::mallocSQLVAR(XSQLDA *)") at assert.c:101
4  0x7fcc6149c715 in connectivity::firebird::mallocSQLVAR(XSQLDA*) 
(pSqlda=0x5bca950) at connectivity/source/drivers/firebird/Util.cxx:346
5  0x7fcc61470722 in 
connectivity::firebird::OPreparedStatement::ensurePrepared() (this=0x5bc6a10) 
at connectivity/source/drivers/firebird/PreparedStatement.cxx:110
6  0x7fcc614714df in 
connectivity::firebird::OPreparedStatement::getMetaData() (this=0x5bc6a10) at 
connectivity/source/drivers/firebird/PreparedStatement.cxx:147
7  0x7fcc6147165d in non-virtual thunk to 
connectivity::firebird::OPreparedStatement::getMetaData() () at 
connectivity/source/drivers/firebird/PreparedStatement.cxx:154
8  0x7fcc66694776 in dbaccess::OPreparedStatement::getMetaData() 
(this=0x5bc6cc0) at dbaccess/source/core/api/preparedstatement.cxx:178
9  0x7fcc6669480d in non-virtual thunk to 
dbaccess::OPreparedStatement::getMetaData() () at 
dbaccess/source/core/api/preparedstatement.cxx:179
10 0x7fcc667711bd in dbaccess::OSingleSelectQueryComposer::getColumns() 
(this=0x5bb99f0) at dbaccess/source/core/api/SingleSelectQueryComposer.cxx:824

Change-Id: I285c9bcd0b1fd059994d339ae4d419dec516f220
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127551
Tested-by: Jenkins
Reviewed-by: Julien Nabet 
(cherry picked from commit abaf2b4ac7faada914885d95c49b554f576d7cee)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127567
Reviewed-by: Lionel Mamane 

diff --git a/connectivity/source/drivers/firebird/Util.cxx 
b/connectivity/source/drivers/firebird/Util.cxx
index 2d694eac94ec..344c0164ac66 100644
--- a/connectivity/source/drivers/firebird/Util.cxx
+++ b/connectivity/source/drivers/firebird/Util.cxx
@@ -342,8 +342,9 @@ void firebird::mallocSQLVAR(XSQLDA* pSqlda)
 case SQL_BOOLEAN:
 pVar->sqldata = static_cast(malloc(sizeof(sal_Bool)));
 break;
+// See 
https://www.firebirdsql.org/file/documentation/html/en/refdocs/fblangref25/firebird-25-language-reference.html#fblangref25-datatypes-special-sqlnull
 case SQL_NULL:
-assert(false); // TODO: implement
+pVar->sqldata = nullptr;
 break;
 case SQL_QUAD:
 assert(false); // TODO: implement
@@ -388,7 +389,8 @@ void firebird::freeSQLVAR(XSQLDA* pSqlda)
 }
 break;
 case SQL_NULL:
-assert(false); // TODO: implement
+// See SQL_NULL case in mallocSQLVAR
+assert(pVar->sqldata == nullptr);
 break;
 case SQL_QUAD:
 assert(false); // TODO: implement


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - connectivity/source

2021-12-19 Thread Julien Nabet (via logerrit)
 connectivity/source/drivers/flat/EDatabaseMetaData.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 7f791573ff32bfb5bdd082b9a23413da6ff26b76
Author: Julien Nabet 
AuthorDate: Sat Dec 18 19:19:28 2021 +0100
Commit: Caolán McNamara 
CommitDate: Sun Dec 19 16:46:56 2021 +0100

Regression from e01786898406130aa81eadc32f7bc2fad65c5344

author  Julien Nabet   2021-05-14 18:46:57 +0200
committer   Julien Nabet   2021-05-14 23:09:11 
+0200
commit  e01786898406130aa81eadc32f7bc2fad65c5344 (patch)
tree6852a41ac21a081114f51f5c0272249eb5f962d6
parent  be96aa21aed3069775609780566541b3631cbbe1 (diff)
Directly initialize vector in connectivity (part 3)

Change-Id: Ib4097b3425e07de73abbc47ffefebb06b1458308
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127053
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/connectivity/source/drivers/flat/EDatabaseMetaData.cxx 
b/connectivity/source/drivers/flat/EDatabaseMetaData.cxx
index 7150973069d9..b711645b591e 100644
--- a/connectivity/source/drivers/flat/EDatabaseMetaData.cxx
+++ b/connectivity/source/drivers/flat/EDatabaseMetaData.cxx
@@ -53,7 +53,7 @@ Reference< XResultSet > 
OFlatDatabaseMetaData::impl_getTypeInfo_throw(  )
 
 static ODatabaseMetaDataResultSet::ORows aRows = []()
 {
-ODatabaseMetaDataResultSet::ORows tmp(10);
+ODatabaseMetaDataResultSet::ORows tmp;
 ODatabaseMetaDataResultSet::ORow aRow
 {
  ODatabaseMetaDataResultSet::getEmptyValue() ,


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - connectivity/source

2021-12-16 Thread Julien Nabet (via logerrit)
 connectivity/source/drivers/evoab2/EApi.cxx  |   54 --
 connectivity/source/drivers/evoab2/EApi.h|2 
 connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx |  121 +++---
 connectivity/source/drivers/evoab2/NResultSet.cxx|  125 ---
 4 files changed, 39 insertions(+), 263 deletions(-)

New commits:
commit 674c6bf89a2ed89c889ef3f93639f8d5cddabd5c
Author: Julien Nabet 
AuthorDate: Wed Dec 15 22:45:47 2021 +0100
Commit: Caolán McNamara 
CommitDate: Thu Dec 16 14:37:42 2021 +0100

tdf#137101: fix e_book_client_connect_direct_sync signature in Evolution

since it changed in 2015, see all details from tdf#137101
Thank you to krumelmonster for having spotted this!

+ some cleanup to remove all eds_check_version calls
and dependencies

Change-Id: Iaf2437f8f5c04ab9674a380dac1dfb16ec8c7201
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126898
Tested-by: Jenkins
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 
(cherry picked from commit 0661c796c767802c114441ad9a17fd0979d72ef4)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126929

diff --git a/connectivity/source/drivers/evoab2/EApi.cxx 
b/connectivity/source/drivers/evoab2/EApi.cxx
index 6df2c45d4aef..8f6a6f7083d0 100644
--- a/connectivity/source/drivers/evoab2/EApi.cxx
+++ b/connectivity/source/drivers/evoab2/EApi.cxx
@@ -23,16 +23,7 @@
 static const char *eBookLibNames[] = {
 "libebook-1.2.so.20", // evolution-data-server 3.33.2+
 "libebook-1.2.so.19", // evolution-data-server 3.24+
-"libebook-1.2.so.16",
-"libebook-1.2.so.15",
-"libebook-1.2.so.14", // bumped again (evolution-3.6)
-"libebook-1.2.so.13", // bumped again (evolution-3.4)
-"libebook-1.2.so.12", // bumped again
-"libebook-1.2.so.10", // bumped again
-"libebook-1.2.so.9",  // evolution-2.8
-"libebook-1.2.so.5",  // evolution-2.4 and 2.6+
-"libebook-1.2.so.3",  // evolution-2.2
-"libebook.so.8"   // evolution-2.0
+"libebook-1.2.so.16"
 };
 
 typedef void (*SymbolFunc) ();
@@ -69,20 +60,6 @@ const ApiMap aCommonApiMap[] =
 { "e_book_query_field_exists", reinterpret_cast(_book_query_field_exists) }
 };
 
-//< 3.6 api
-const ApiMap aOldApiMap[] =
-{
-{ "e_book_get_addressbooks", reinterpret_cast(_book_get_addressbooks) },
-{ "e_book_get_uri", reinterpret_cast(_book_get_uri) },
-{ "e_book_authenticate_user", reinterpret_cast(_book_authenticate_user) },
-{ "e_source_group_peek_base_uri", reinterpret_cast(_source_group_peek_base_uri) },
-{ "e_source_peek_name", reinterpret_cast(_source_peek_name) },
-{ "e_source_get_property", reinterpret_cast(_source_get_property) },
-{ "e_source_list_peek_groups", reinterpret_cast(_source_list_peek_groups) },
-{ "e_source_group_peek_sources", reinterpret_cast(_source_group_peek_sources) }
-};
-
-//>= 3.6 api
 const ApiMap aNewApiMap[] =
 {
 { "e_source_registry_list_sources", reinterpret_cast(_source_registry_list_sources) },
@@ -99,12 +76,6 @@ const ApiMap aNewApiMap[] =
 { "e_client_util_free_object_slist", reinterpret_cast(_client_util_free_object_slist) }
 };
 
-//== indirect read access (3.6 only)
-const ApiMap aClientApiMap36[] =
-{
-{ "e_book_client_new", reinterpret_cast(_book_client_new) }
-};
-
 //>= direct read access API (>= 3.8)
 const ApiMap aClientApiMap38[] =
 {
@@ -140,33 +111,14 @@ bool EApiInit()
 
 if (tryLink( aModule, eBookLibNames[ j ], aCommonApiMap))
 {
-if (eds_check_version( 3, 6, 0 ) != nullptr)
+if (tryLink( aModule, eBookLibNames[ j ], aNewApiMap))
 {
-if (tryLink( aModule, eBookLibNames[ j ], aOldApiMap))
+if (tryLink( aModule, eBookLibNames[ j ], aClientApiMap38))
 {
 aModule.release();
 return true;
 }
 }
-else if (tryLink( aModule, eBookLibNames[ j ], aNewApiMap))
-{
-if (eds_check_version( 3, 7, 6 ) != nullptr)
-{
-if (tryLink( aModule, eBookLibNames[ j ], aClientApiMap36))
-{
-aModule.release();
-return true;
-}
-}
-else
-{
-if (tryLink( aModule, eBookLibNames[ j ], aClientApiMap38))
-{
-aModule.release();
-return true;
-}
-}
-}
 }
 }
 fprintf( stderr, "Can find no compliant libebook client libraries\n" );
diff --git a/connectivity/source/drivers/evoab2/EApi.h 
b/connectivity/source/drivers/evoab2/EApi.h
index 4d17922aab30..9a2138eb2a26 100644
--- a/connectivity/source/drivers/evoab2/EApi.h
+++ b/connectivity/source/drivers/evoab2/EApi.h
@@ -146,7 +146,7 @@ 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - connectivity/source

2021-12-13 Thread Julien Nabet (via logerrit)
 connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 80eb86b7e697751d24ca12310e6b6e23a1bb54cf
Author: Julien Nabet 
AuthorDate: Sat Dec 11 15:59:53 2021 +0100
Commit: Xisco Fauli 
CommitDate: Mon Dec 13 11:34:02 2021 +0100

Fix regression in connectivity/evoab2

Regression from 46d3e84d7a131f7c72cb536ab2f314cb55ffc155
Directly initialize vector in connectivity (part 2)

Pinpointed thanks to this log:

warn:dbaccess:612118:612118:dbaccess/source/core/dataaccess/connection.cxx:344: 
DBG_UNHANDLED_EXCEPTION in OConnection exception: 
com.sun.star.sdbc.SQLException message: Invalid descriptor index. 
/home/julien/lo/libreoffice/connectivity/source/commontools/dbexception.cxx:365 
SQLState: 07009 ErrorCode: 0
wrapped: void message: 
/home/julien/lo/libreoffice/tools/source/debug/debug.cxx:104
when launching Base then connecting to Evolution local.

Change-Id: Id4cb0fc322b0df24ed2b2d89a5595f4841db1845
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126672
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx 
b/connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx
index a671ceb233a8..81b5c8c0e325 100644
--- a/connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx
+++ b/connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx
@@ -989,7 +989,7 @@ Reference< XResultSet > SAL_CALL 
OEvoabDatabaseMetaData::getTableTypes(  )
 
 // here we fill the rows which should be visible when ask for data from 
the resultset returned here
 auto nNbTypes = SAL_N_ELEMENTS(sTableTypes);
-ODatabaseMetaDataResultSet::ORows aRows(nNbTypes);
+ODatabaseMetaDataResultSet::ORows aRows;
 for(std::size_t i=0;i < nNbTypes;++i)
 {
 // bound row
@@ -1010,7 +1010,7 @@ Reference< XResultSet > 
OEvoabDatabaseMetaData::impl_getTypeInfo_throw(  )
 
 static ODatabaseMetaDataResultSet::ORows aRows = []()
 {
-ODatabaseMetaDataResultSet::ORows tmp(2);
+ODatabaseMetaDataResultSet::ORows tmp;
 ODatabaseMetaDataResultSet::ORow aRow
 {
  ODatabaseMetaDataResultSet::getEmptyValue() ,