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

2021-10-12 Thread Stephan Bergmann (via logerrit)
 connectivity/source/parse/sqlbison.y |6 ++
 1 file changed, 6 insertions(+)

New commits:
commit 774c446a4b555f910a62f24e34f5dddc2edd2a59
Author: Stephan Bergmann 
AuthorDate: Tue Sep 14 12:20:48 2021 +0200
Commit: Stephan Bergmann 
CommitDate: Tue Oct 12 15:15:47 2021 +0200

Adapt to Bison 3.8 internal yyn -> yyrule rename

see


"glr2.cc: log the execution of deferred actions" including "Rename argument 
yyn
as yyrule for clarity."

YYBISON was defined as 1 rather than as a representation of the Bison 
version
prior to


"yacc.c: provide the Bison version as an integral macro", which shouldn't 
be a
problem here.  And YYBISON is apparently completely undefined with
/usr/bin/bison on macOS.

(The preceding comment always mentioned "yyi" and "yyrmap" in apparent 
mismatch
with the actually used "yyn" and "yyr1" ever since
c25ec0608a167bcf1d891043f02273761c351701 "initial import", so just leave it
untouched.)

Change-Id: I4f901407aa21ed4abec84e661d813ee7599f02f0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122082
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 
(cherry picked from commit 45227d9b79dc4f2a2aa6874cd4e3c02b7934b197)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123408
Reviewed-by: Michael Stahl 

diff --git a/connectivity/source/parse/sqlbison.y 
b/connectivity/source/parse/sqlbison.y
index d14f36e7794f..c4be0bc00bd0 100644
--- a/connectivity/source/parse/sqlbison.y
+++ b/connectivity/source/parse/sqlbison.y
@@ -74,9 +74,15 @@ inline connectivity::OSQLInternalNode* newNode(const 
OUString& _newValue,
 
 // yyi is the internal number of the rule that is currently being reduced
 // This can be mapped to external rule number via the yyrmap.
+#if defined YYBISON && YYBISON >= 30800
+#define SQL_NEW_RULE   newNode("", SQLNodeType::Rule, 
yyr1[yyrule])
+#define SQL_NEW_LISTRULE   newNode("", SQLNodeType::ListRule, 
yyr1[yyrule])
+#define SQL_NEW_COMMALISTRULE   newNode("", SQLNodeType::CommaListRule, 
yyr1[yyrule])
+#else
 #define SQL_NEW_RULE   newNode("", SQLNodeType::Rule, 
yyr1[yyn])
 #define SQL_NEW_LISTRULE   newNode("", SQLNodeType::ListRule, 
yyr1[yyn])
 #define SQL_NEW_COMMALISTRULE   newNode("", SQLNodeType::CommaListRule, 
yyr1[yyn])
+#endif
 
 
 extern connectivity::OSQLParser* xxx_pGLOBAL_SQLPARSER;


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

2021-09-27 Thread Caolán McNamara (via logerrit)
 connectivity/source/commontools/dbconversion.cxx |9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

New commits:
commit 92adaab3beb7314354018909e26272a245a9
Author: Caolán McNamara 
AuthorDate: Sun Sep 26 14:23:54 2021 +0100
Commit: Michael Stahl 
CommitDate: Mon Sep 27 14:03:31 2021 +0200

ofz#39301 month has to be in range [1-12]

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

diff --git a/connectivity/source/commontools/dbconversion.cxx 
b/connectivity/source/commontools/dbconversion.cxx
index dbe942a3fd01..77cfdfb26ea1 100644
--- a/connectivity/source/commontools/dbconversion.cxx
+++ b/connectivity/source/commontools/dbconversion.cxx
@@ -26,6 +26,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -166,10 +167,13 @@ namespace dbtools
 ;
 }
 
-
 static sal_Int32 implDaysInMonth(sal_Int32 _nMonth, sal_Int32 _nYear)
 {
-OSL_ENSURE(_nMonth > 0 && _nMonth < 13,"Month as invalid value!");
+SAL_WARN_IF(_nMonth < 1 || _nMonth > 12, "connectivity.commontools", 
"Month has invalid value: " << _nMonth);
+if (_nMonth < 1)
+_nMonth = 1;
+else if (_nMonth > 12)
+_nMonth = 12;
 if (_nMonth != 2)
 return aDaysInMonth[_nMonth-1];
 else
@@ -181,7 +185,6 @@ namespace dbtools
 }
 }
 
-
 static sal_Int32 implRelativeToAbsoluteNull(const css::util::Date& _rDate)
 {
 sal_Int32 nDays = 0;


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

2021-09-27 Thread Caolán McNamara (via logerrit)
 connectivity/source/drivers/dbase/DTable.cxx |   13 -
 1 file changed, 8 insertions(+), 5 deletions(-)

New commits:
commit f48e865653650a8f8215d929c31ff3d71ce940b3
Author: Caolán McNamara 
AuthorDate: Sun Sep 26 14:05:37 2021 +0100
Commit: Michael Stahl 
CommitDate: Mon Sep 27 12:16:36 2021 +0200

ofz#39304 short timestamp record

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

diff --git a/connectivity/source/drivers/dbase/DTable.cxx 
b/connectivity/source/drivers/dbase/DTable.cxx
index f16d2f1ee3eb..3740aaae8d19 100644
--- a/connectivity/source/drivers/dbase/DTable.cxx
+++ b/connectivity/source/drivers/dbase/DTable.cxx
@@ -771,10 +771,8 @@ bool ODbaseTable::fetchRow(OValueRefRow& _rRow, const 
OSQLColumns & _rCols, bool
 for (std::size_t i = 1; aIter != aEnd && nByteOffset <= m_nBufferSize && i 
< nCount;++aIter, i++)
 {
 // Lengths depending on data type:
-sal_Int32 nLen = 0;
-sal_Int32 nType = 0;
-nLen= m_aPrecisions[i-1];
-nType   = m_aTypes[i-1];
+sal_Int32 nLen = m_aPrecisions[i-1];
+sal_Int32 nType = m_aTypes[i-1];
 
 switch(nType)
 {
@@ -833,8 +831,13 @@ bool ODbaseTable::fetchRow(OValueRefRow& _rRow, const 
OSQLColumns & _rCols, bool
 else if ( DataType::TIMESTAMP == nType )
 {
 sal_Int32 nDate = 0,nTime = 0;
+if (o3tl::make_unsigned(nLen) < 8)
+{
+SAL_WARN("connectivity.drivers", "short TIMESTAMP");
+return false;
+}
 memcpy(, pData, 4);
-memcpy(, pData+ 4, 4);
+memcpy(, pData + 4, 4);
 if ( !nDate && !nTime )
 {
 (*_rRow)[i]->setNull();


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

2021-09-13 Thread Mike Kaganski (via logerrit)
 connectivity/source/drivers/firebird/Connection.cxx |   12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

New commits:
commit e4a87773d0f6a4a4eb8605cf8c3eb6c1cc8e7c27
Author: Mike Kaganski 
AuthorDate: Fri Sep 10 18:15:48 2021 +0200
Commit: Xisco Fauli 
CommitDate: Mon Sep 13 18:04:58 2021 +0200

tdf#115547: Fix DB path handling

1. The code used wrong procedure to convert file URLs to local paths.
It assumed that it's enough to just strip the leading 'file://', which
is only sometimes true on Unix-like systems; on Windows, this converts
a valid 'file:///C:/path/file.ext' to '/C:/path/file.ext', where the
leading slash is then treated as a network path, resulting in errors.

2. It is incorrect to assume the same length for UTF-16 and UTF-8
encoded URLs coming from untrusted source (like user file). It may
contain non-ASCII characters (be an IRL), and then the assumption
would fail.

Change-Id: Ie2ea6c8cb9a690975db956fa025bf926a8010984
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121885
Reviewed-by: Lionel Mamane 
Tested-by: Jenkins
(cherry picked from commit 51269c4d28c04ebd2c0047772b7373e0bebec219)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121983
Reviewed-by: Xisco Fauli 
(cherry picked from commit 9601ca71b485bba6221e1e0ab88accf3e89a325b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121991

diff --git a/connectivity/source/drivers/firebird/Connection.cxx 
b/connectivity/source/drivers/firebird/Connection.cxx
index 05c24e9f73be..371f24498212 100644
--- a/connectivity/source/drivers/firebird/Connection.cxx
+++ b/connectivity/source/drivers/firebird/Connection.cxx
@@ -49,6 +49,7 @@
 #include 
 #include 
 
+#include 
 #include 
 #include 
 
@@ -208,7 +209,7 @@ void Connection::construct(const OUString& url, const 
Sequence< PropertyValue >&
 if (!xFileAccess->exists(m_sFirebirdURL))
 bIsNewDatabase = true;
 
-m_sFirebirdURL = 
m_sFirebirdURL.copy(OUString("file://").getLength());
+osl::FileBase::getSystemPathFromFileURL(m_sFirebirdURL, 
m_sFirebirdURL);
 }
 }
 
@@ -263,11 +264,12 @@ void Connection::construct(const OUString& url, const 
Sequence< PropertyValue >&
 
 ISC_STATUS_ARRAY status;/* status vector */
 ISC_STATUS aErr;
+const OString sFirebirdURL = OUStringToOString(m_sFirebirdURL, 
RTL_TEXTENCODING_UTF8);
 if (bIsNewDatabase)
 {
 aErr = isc_create_database(status,
-   m_sFirebirdURL.getLength(),
-   
OUStringToOString(m_sFirebirdURL,RTL_TEXTENCODING_UTF8).getStr(),
+   sFirebirdURL.getLength(),
+   sFirebirdURL.getStr(),
_aDBHandle,
dpbBuffer.size(),
dpbBuffer.c_str(),
@@ -285,8 +287,8 @@ void Connection::construct(const OUString& url, const 
Sequence< PropertyValue >&
 }
 
 aErr = isc_attach_database(status,
-   m_sFirebirdURL.getLength(),
-   OUStringToOString(m_sFirebirdURL, 
RTL_TEXTENCODING_UTF8).getStr(),
+   sFirebirdURL.getLength(),
+   sFirebirdURL.getStr(),
_aDBHandle,
dpbBuffer.size(),
dpbBuffer.c_str());


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

2021-09-10 Thread Mike Kaganski (via logerrit)
 connectivity/source/drivers/firebird/Blob.cxx |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit e7e38c23d0a91e80535893ee88e3f0062b7d522c
Author: Mike Kaganski 
AuthorDate: Fri Sep 10 00:49:49 2021 +0200
Commit: Xisco Fauli 
CommitDate: Fri Sep 10 09:49:05 2021 +0200

tdf#120129: don't forget to update buffer size to actual length

Otherwise extra bytes get written to the resulting string from the
too long buffer.

Change-Id: Iccde16b8002f214df6f86f484f288ec464c6b674
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121872
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 
(cherry picked from commit 541ddf4580cac8c3f9590be26a487f5fc8e2553c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121875
Reviewed-by: Xisco Fauli 

diff --git a/connectivity/source/drivers/firebird/Blob.cxx 
b/connectivity/source/drivers/firebird/Blob.cxx
index 8ed9fc4a8ac7..854db5bb0df0 100644
--- a/connectivity/source/drivers/firebird/Blob.cxx
+++ b/connectivity/source/drivers/firebird/Blob.cxx
@@ -144,6 +144,9 @@ bool Blob::readOneSegment(uno::Sequence< sal_Int8 >& 
rDataOut)
 OUString sError(StatusVectorToString(m_statusVector, 
"isc_get_segment"));
 throw IOException(sError, *this);
 }
+
+if (rDataOut.getLength() > nActualSize)
+rDataOut.realloc(nActualSize);
 m_nBlobPosition += nActualSize;
 return aRet == isc_segstr_eof;  // last segment read
 }


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

2021-08-16 Thread Julien Nabet (via logerrit)
 connectivity/source/drivers/mysqlc/mysqlc_general.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit b04a0ddd3ca8f5d1b1b38208ef59fb27321378b8
Author: Julien Nabet 
AuthorDate: Mon Aug 16 12:48:14 2021 +0200
Commit: Julien Nabet 
CommitDate: Mon Aug 16 18:35:20 2021 +0200

Related tdf#143895: Mysql MEDIUMINT is DataType::INTEGER not 
DataType::SMALLINT

Change-Id: I324b18cc164cb2f38b7b8411c557c6c208e8d69d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120536
Reviewed-by: Lionel Mamane 
Tested-by: Jenkins
(cherry picked from commit 997ff7166ceca0a5af80297a0e789af2ff0c6617)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120448

diff --git a/connectivity/source/drivers/mysqlc/mysqlc_general.cxx 
b/connectivity/source/drivers/mysqlc/mysqlc_general.cxx
index 7ed11fe3ff13..878efdc3be24 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_general.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_general.cxx
@@ -193,11 +193,11 @@ sal_Int32 mysqlStrToOOOType(const OUString& sType)
 // TODO other types.
 if (sType.equalsIgnoreAsciiCase("tiny") || 
sType.equalsIgnoreAsciiCase("tinyint"))
 return css::sdbc::DataType::TINYINT;
-if (sType.equalsIgnoreAsciiCase("smallint") || 
sType.equalsIgnoreAsciiCase("mediumint"))
+if (sType.equalsIgnoreAsciiCase("smallint"))
 return css::sdbc::DataType::SMALLINT;
 if (sType.equalsIgnoreAsciiCase("longtext"))
 return css::sdbc::DataType::LONGVARCHAR;
-if (sType.equalsIgnoreAsciiCase("int"))
+if (sType.equalsIgnoreAsciiCase("int") || 
sType.equalsIgnoreAsciiCase("mediumint"))
 return css::sdbc::DataType::INTEGER;
 if (sType.equalsIgnoreAsciiCase("varchar") || 
sType.equalsIgnoreAsciiCase("set")
 || sType.equalsIgnoreAsciiCase("enum"))


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

2021-03-30 Thread Lionel Elie Mamane (via logerrit)
 connectivity/source/parse/sqliterator.cxx |   27 ++-
 1 file changed, 22 insertions(+), 5 deletions(-)

New commits:
commit 97b952d05320f90fe85b91122431d47f3a87ed5d
Author: Lionel Elie Mamane 
AuthorDate: Sat Mar 27 10:57:50 2021 +0100
Commit: Michael Stahl 
CommitDate: Tue Mar 30 11:31:19 2021 +0200

tdf#141115: correctly find the ORDER BY clause of a UNION

instead of blindly assuming a SELECT is not a UNION, leading to an
out-of-bounds array access when it is.

Change-Id: I8f904ae65acba8d8ee23b95299058207af68c0ca
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113189
(cherry picked from commit f4367cfd6978ae2fa896652175956bdbedd3c4bf)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113128
Tested-by: Jenkins
Reviewed-by: Lionel Mamane 
Reviewed-by: Michael Stahl 

diff --git a/connectivity/source/parse/sqliterator.cxx 
b/connectivity/source/parse/sqliterator.cxx
index a91390eca2b8..4d8634d07eb5 100644
--- a/connectivity/source/parse/sqliterator.cxx
+++ b/connectivity/source/parse/sqliterator.cxx
@@ -1831,12 +1831,29 @@ const OSQLParseNode* 
OSQLParseTreeIterator::getOrderTree() const
 
 // Analyse parse tree (depending on statement type)
 // and set pointer to ORDER clause:
+
+assert(SQL_ISRULE(m_pParseTree, select_statement) || 
SQL_ISRULE(m_pParseTree, union_statement));
+
+auto pParseTree = m_pParseTree;
+if(SQL_ISRULE(m_pParseTree, union_statement))
+{
+assert(m_pParseTree->count() == 4);
+pParseTree = pParseTree->getChild(3);
+// since UNION is left-associative (at least in our grammar),
+// possibly the left-hand (m_pParseTree->getChild(0)) is a 
union_statement,
+// but the right hand cannot.
+assert(SQL_ISRULE(pParseTree, select_statement));
+}
+
 OSQLParseNode * pOrderClause = nullptr;
-OSL_ENSURE(m_pParseTree->count() >= 4,"ParseTreeIterator: error in parse 
tree!");
-OSQLParseNode * pTableExp = m_pParseTree->getChild(3);
-OSL_ENSURE(pTableExp != nullptr,"OSQLParseTreeIterator: error in parse 
tree!");
-OSL_ENSURE(SQL_ISRULE(pTableExp,table_exp),"OSQLParseTreeIterator: error 
in parse tree!");
-OSL_ENSURE(pTableExp->count() == 
TABLE_EXPRESSION_CHILD_COUNT,"OSQLParseTreeIterator: error in parse tree!");
+OSL_ENSURE(pParseTree->count() == 4, "OSQLParseTreeIterator::getOrderTree: 
expected a SELECT, and a SELECT must have exactly four children");
+OSQLParseNode * pTableExp = pParseTree->getChild(3);
+OSL_ENSURE(pTableExp != nullptr, "OSQLParseTreeIterator::getOrderTree: got 
NULL table_exp");
+OSL_ENSURE(SQL_ISRULE(pTableExp, table_exp), 
"OSQLParseTreeIterator::getOrderTree: expected table_exp but got something 
else");
+OSL_ENSURE(pTableExp->count() == 
TABLE_EXPRESSION_CHILD_COUNT,"OSQLParseTreeIterator::getOrderTree: table_exp 
doesn't have the expected number of children");
+// tdf#141115 upgrade the above to an assert;
+// this cannot go well if there are too few children
+assert(pTableExp->count() == TABLE_EXPRESSION_CHILD_COUNT);
 
 pOrderClause = pTableExp->getChild(ORDER_BY_CHILD_POS);
 // If it is an order_by, it must not be empty
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-03-30 Thread Lionel Elie Mamane (via logerrit)
 connectivity/source/drivers/file/FStatement.cxx |7 +++
 1 file changed, 7 insertions(+)

New commits:
commit 3e0714839d3c8cecbe02dea80b372364f4712373
Author: Lionel Elie Mamane 
AuthorDate: Sat Mar 27 15:44:08 2021 +0100
Commit: Michael Stahl 
CommitDate: Tue Mar 30 11:29:21 2021 +0200

tdf#141115 semi-userfriendly message on UNION query on file driver

Rather than silently returning only the first (left) part of the
UNION, error out.

Change-Id: I6ed1eba55ad33f149d9010933a3c7a835fce0451
(cherry picked from commit d0efd1e280c2b9759dce120dff64e8bac1ab19c1)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113216
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/connectivity/source/drivers/file/FStatement.cxx 
b/connectivity/source/drivers/file/FStatement.cxx
index 08c4f7fdd844..31d435b62aab 100644
--- a/connectivity/source/drivers/file/FStatement.cxx
+++ b/connectivity/source/drivers/file/FStatement.cxx
@@ -394,6 +394,13 @@ void OStatement_Base::construct(const OUString& sql)
 case OSQLStatementType::Unknown:
 
m_pConnection->throwGenericSQLException(STR_QUERY_TOO_COMPLEX,*this);
 break;
+case OSQLStatementType::Select:
+if(SQL_ISRULE(m_aSQLIterator.getParseTree(), union_statement))
+{
+m_pConnection->throwGenericSQLException(STR_QUERY_TOO_COMPLEX, 
*this);
+}
+assert(SQL_ISRULE(m_aSQLIterator.getParseTree(), 
select_statement));
+break;
 default:
 break;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-12-18 Thread Lionel Elie Mamane (via logerrit)
 connectivity/source/drivers/postgresql/pq_baseresultset.cxx   |2 +-
 connectivity/source/drivers/postgresql/pq_connection.cxx  |3 ++-
 connectivity/source/drivers/postgresql/pq_preparedstatement.cxx   |2 +-
 connectivity/source/drivers/postgresql/pq_tools.hxx   |8 

 connectivity/source/drivers/postgresql/pq_updateableresultset.cxx |2 +-
 5 files changed, 13 insertions(+), 4 deletions(-)

New commits:
commit 1ab014ddf72dd09b2ef30320b8b2936a26923b3a
Author: Lionel Elie Mamane 
AuthorDate: Tue Nov 17 02:14:15 2020 +0100
Commit: Michael Stahl 
CommitDate: Fri Dec 18 18:56:32 2020 +0100

pgsql-sdbc: use libpq's custom free()...

... for stuff allocated by libpq

Their documentation says this is important on Microsoft Windows:

 It is particularly important that this function, rather than free(),
 be used on Microsoft Windows. This is because allocating memory in a
 DLL and releasing it in the application works only if
 multithreaded/single-threaded, release/debug, and static/dynamic
 flags are the same for the DLL and the application.

Also use const unique_ptr since we don't need the value to survive the
scope in any way.

Change-Id: If4637ea0cd1c05125d63e2f3d37dbeaf716973f9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105967
Tested-by: Lionel Mamane 
Reviewed-by: Lionel Mamane 
(cherry picked from commit 177792660697f85763b39f455d7ebff0f83084fd)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107906
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/connectivity/source/drivers/postgresql/pq_baseresultset.cxx 
b/connectivity/source/drivers/postgresql/pq_baseresultset.cxx
index 8fc7140e4817..9ff5e01e098a 100644
--- a/connectivity/source/drivers/postgresql/pq_baseresultset.cxx
+++ b/connectivity/source/drivers/postgresql/pq_baseresultset.cxx
@@ -456,7 +456,7 @@ Sequence< sal_Int8 > BaseResultSet::getBytes( sal_Int32 
columnIndex )
 char * res = reinterpret_cast(PQunescapeBytea( 
reinterpret_cast(val.getStr()), ));
 ret = Sequence< sal_Int8 > ( reinterpret_cast(res), length 
);
 if( res )
-free( res );
+PQfreemem( res );
 }
 return ret;
 }
diff --git a/connectivity/source/drivers/postgresql/pq_connection.cxx 
b/connectivity/source/drivers/postgresql/pq_connection.cxx
index d9889dea8091..ed3ed85e9c6c 100644
--- a/connectivity/source/drivers/postgresql/pq_connection.cxx
+++ b/connectivity/source/drivers/postgresql/pq_connection.cxx
@@ -41,6 +41,7 @@
 
 #include "pq_connection.hxx"
 #include "pq_statement.hxx"
+#include "pq_tools.hxx"
 #include "pq_preparedstatement.hxx"
 #include "pq_databasemetadata.hxx"
 #include "pq_xtables.hxx"
@@ -460,7 +461,7 @@ void Connection::initialize( const Sequence< Any >& 
aArguments )
 if ( err != nullptr)
 {
 errorMessage = OUString( err, strlen(err), 
ConnectionSettings::encoding );
-free(err);
+PQfreemem(err);
 }
 else
 errorMessage = "#no error message#";
diff --git a/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx 
b/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx
index c1d9a4f66731..344c27175850 100644
--- a/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx
+++ b/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx
@@ -481,7 +481,7 @@ void PreparedStatement::setBytes(
 checkClosed();
 checkColumnIndex( parameterIndex );
 size_t len;
-std::unique_ptr escapedString(
+const std::unique_ptr> 
escapedString(
 PQescapeBytea( reinterpret_cast(x.getConstArray()), x.getLength(), ));
 if( ! escapedString )
 {
diff --git a/connectivity/source/drivers/postgresql/pq_tools.hxx 
b/connectivity/source/drivers/postgresql/pq_tools.hxx
index af751f8e633b..7fbdb260d30b 100644
--- a/connectivity/source/drivers/postgresql/pq_tools.hxx
+++ b/connectivity/source/drivers/postgresql/pq_tools.hxx
@@ -49,6 +49,14 @@
 #include "pq_connection.hxx"
 #include 
 
+namespace
+{
+// helper to create one-time deleters
+template 
+using deleter_from_fn = std::integral_constant;
+
+}
+
 namespace pq_sdbc_driver
 {
 bool isWhitespace( sal_Unicode c );
diff --git a/connectivity/source/drivers/postgresql/pq_updateableresultset.cxx 
b/connectivity/source/drivers/postgresql/pq_updateableresultset.cxx
index 880adc647c7e..d8780e76c563 100644
--- a/connectivity/source/drivers/postgresql/pq_updateableresultset.cxx
+++ b/connectivity/source/drivers/postgresql/pq_updateableresultset.cxx
@@ -481,7 +481,7 @@ void UpdateableResultSet::updateBytes( sal_Int32 
columnIndex, const css::uno::Se
 
 m_updateableField[columnIndex-1].value <<=
 OUString( reinterpret_cast(escapedString), len, 
RTL_TEXTENCODING_ASCII_US );
-free( escapedString );
+PQfreemem( 

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

2020-12-06 Thread Julien Nabet (via logerrit)
 connectivity/source/drivers/firebird/DatabaseMetaData.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 581f17605985fe659141e67f692215974880ae55
Author: Julien Nabet 
AuthorDate: Sun Dec 6 11:02:31 2020 +0100
Commit: Julien Nabet 
CommitDate: Sun Dec 6 13:22:01 2020 +0100

tdf#125957: FIREBIRD Datatype Binary(fix)[CHAR] couldn't be filled with 
content

Really use sCharsetName which is xRow->getString(13) trimmed

See commit bf662904c4b60e93c6b86e06288d41996eed12a2
Author: Tamas Bunth 
Date:   Sat Dec 16 12:57:43 2017 +0100

tdf#104734 Firebird: Add Binary (fix) type

There is no explicit binary type in Firebird. It can be accomplished
using the CHAR type with a special character set, which tells the
database that it is binary data and there is no collation. (called
OCTETS).

Because of that, we also need the character set to decide the exact
column type.

And also refactor some parts of the driver:
- Create class to determine internal type from firebird type, subtype,
scale and character set.
- Use internal type (DataType::XXX) in XDatabaseMetaData::getTypeInfo()
indirectly. (We want to return a Firebird type for each internal type,
not in the opposite direction.

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

diff --git a/connectivity/source/drivers/firebird/DatabaseMetaData.cxx 
b/connectivity/source/drivers/firebird/DatabaseMetaData.cxx
index 9aabd39cb52a..d06e7cc71985 100644
--- a/connectivity/source/drivers/firebird/DatabaseMetaData.cxx
+++ b/connectivity/source/drivers/firebird/DatabaseMetaData.cxx
@@ -1194,7 +1194,7 @@ uno::Reference< XResultSet > SAL_CALL 
ODatabaseMetaData::getColumns(
 // result field may be filled with spaces
 sCharsetName = sCharsetName.trim();
 ColumnTypeInfo aInfo(aType, xRow->getShort(7), aScale,
-xRow->getString(13));
+sCharsetName);
 
 aCurrentRow[5] = new ORowSetValueDecorator(aInfo.getSdbcType());
 // 6. Typename (SQL_*)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-11-27 Thread Julien Nabet (via logerrit)
 connectivity/source/commontools/TTableHelper.cxx |5 +
 1 file changed, 5 insertions(+)

New commits:
commit 5dae252e76da9c95049ba8124422a1f7b2f10596
Author: Julien Nabet 
AuthorDate: Thu Nov 26 23:12:46 2020 +0100
Commit: Julien Nabet 
CommitDate: Fri Nov 27 23:01:48 2020 +0100

tdf#137745: crash, when deleting tables and changed relationship isn't 
changed

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

some explanations here:
https://bugs.documentfoundation.org/show_bug.cgi?id=137745#c8

Change-Id: I1d9dc8d2e3ad7e3e36c4687cb9b2c5990f2d2c8d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106715
(cherry picked from commit 4335810b00abb9b00a9d81caa5ffe09a3ea927fd)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106742
Reviewed-by: Lionel Mamane 
Tested-by: Jenkins

diff --git a/connectivity/source/commontools/TTableHelper.cxx 
b/connectivity/source/commontools/TTableHelper.cxx
index e86af9673052..03724d669704 100644
--- a/connectivity/source/commontools/TTableHelper.cxx
+++ b/connectivity/source/commontools/TTableHelper.cxx
@@ -72,6 +72,11 @@ public:
 }
 virtual void SAL_CALL elementRemoved( const 
css::container::ContainerEvent& Event ) override
 {
+// tdf#137745, perhaps connectivity::OTableHelper::disposing() has 
been called
+// which called OTableContainerListener::clear(), so m_pComponent may 
be null
+if (m_pComponent == nullptr)
+return;
+
 OUString sName;
 Event.Accessor  >>= sName;
 if ( m_aRefNames.find(sName) != m_aRefNames.end() )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits