[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - connectivity/source
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
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: connectivity/source
connectivity/source/drivers/file/FStatement.cxx |7 +++ 1 file changed, 7 insertions(+) New commits: commit d0efd1e280c2b9759dce120dff64e8bac1ab19c1 Author: Lionel Elie Mamane AuthorDate: Sat Mar 27 15:44:08 2021 +0100 Commit: Lionel Mamane CommitDate: Sat Mar 27 17:34:13 2021 +0100 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 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113207 Reviewed-by: Julien Nabet Reviewed-by: Lionel Mamane Tested-by: Jenkins diff --git a/connectivity/source/drivers/file/FStatement.cxx b/connectivity/source/drivers/file/FStatement.cxx index e04e4fbe5d1b..d181798b2f1e 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: connectivity/source
connectivity/source/parse/sqliterator.cxx | 27 ++- 1 file changed, 22 insertions(+), 5 deletions(-) New commits: commit f4367cfd6978ae2fa896652175956bdbedd3c4bf Author: Lionel Elie Mamane AuthorDate: Sat Mar 27 10:57:50 2021 +0100 Commit: Julien Nabet CommitDate: Sat Mar 27 11:49:51 2021 +0100 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 Reviewed-by: Lionel Mamane Tested-by: Jenkins diff --git a/connectivity/source/parse/sqliterator.cxx b/connectivity/source/parse/sqliterator.cxx index e6e3e1c72535..5a7e152b1aa6 100644 --- a/connectivity/source/parse/sqliterator.cxx +++ b/connectivity/source/parse/sqliterator.cxx @@ -1826,12 +1826,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-0' - connectivity/source
connectivity/source/drivers/postgresql/pq_baseresultset.cxx |2 +- connectivity/source/drivers/postgresql/pq_connection.cxx |9 + connectivity/source/drivers/postgresql/pq_preparedstatement.cxx |3 +-- connectivity/source/drivers/postgresql/pq_tools.hxx |8 connectivity/source/drivers/postgresql/pq_updateableresultset.cxx |2 +- 5 files changed, 16 insertions(+), 8 deletions(-) New commits: commit 13091c7cf527a04cc373042370c4d4bbda839ba9 Author: Lionel Elie Mamane AuthorDate: Tue Nov 17 02:14:15 2020 +0100 Commit: Michael Stahl CommitDate: Thu Jan 28 10:55:41 2021 +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 (cherry picked from commit 177792660697f85763b39f455d7ebff0f83084fd) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107907 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()), &length)); 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 66c30c893aed..9a51f0cd2833 100644 --- a/connectivity/source/drivers/postgresql/pq_connection.cxx +++ b/connectivity/source/drivers/postgresql/pq_connection.cxx @@ -42,6 +42,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" @@ -216,7 +217,7 @@ Reference< XPreparedStatement > Connection::prepareStatement( const OUString& sq MutexGuard guard( m_xMutex->GetMutex() ); checkClosed(); -OString byteSql = OUStringToOString( sql, ConnectionSettings::encoding ); +OString byteSql = rtl::OUStringToOString( sql, ConnectionSettings::encoding ); PreparedStatement *stmt = new PreparedStatement( m_xMutex, this, &m_settings, byteSql ); Reference< XPreparedStatement > ret = stmt; @@ -414,7 +415,7 @@ static void properties2arrays( const Sequence< PropertyValue > & args, { OUString value; tc->convertTo( prop.Value, cppu::UnoType::get() ) >>= value; -char *v = strdup(OUStringToOString(value, enc).getStr()); +char *v = strdup(rtl::OUStringToOString(value, enc).getStr()); values.push_back ( v ); } else @@ -460,7 +461,7 @@ void Connection::initialize( const Sequence< Any >& aArguments ) nColon = url.indexOf( ':' , 1+ nColon ); if( nColon != -1 ) { - o = OUStringToOString( url.getStr()+nColon+1, ConnectionSettings::encoding ); + o = rtl::OUStringToOString( url.getStr()+nColon+1, ConnectionSettings::encoding ); } } { @@ -477,7 +478,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 2e352320353f..069cdfa13e35 100644 --- a/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx +++ b/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx @@ -479,8 +479,7 @@ void PreparedStatement::setBytes( checkClosed(); checkColumnIndex( parameterIndex ); size_t len; -struct Free { void operator ()(void * p) const { free(p); } }; -std::unique_ptr escapedString( +const std::unique_ptr> escapedString(
[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - connectivity/source
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()), &length)); 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(), &len)); 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 ); +
[Libreoffice-commits] core.git: connectivity/source
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 177792660697f85763b39f455d7ebff0f83084fd Author: Lionel Elie Mamane AuthorDate: Tue Nov 17 02:14:15 2020 +0100 Commit: Lionel Mamane CommitDate: Fri Dec 18 08:49:56 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 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()), &length)); 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 5d97f2b2436d..e4716fe8855d 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" @@ -461,7 +462,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(), &len)); if( ! escapedString ) { diff --git a/connectivity/source/drivers/postgresql/pq_tools.hxx b/connectivity/source/drivers/postgresql/pq_tools.hxx index 90490be81eb6..18b105870705 100644 --- a/connectivity/source/drivers/postgresql/pq_tools.hxx +++ b/connectivity/source/drivers/postgresql/pq_tools.hxx @@ -51,6 +51,14 @@ #include #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( escapedString ); } void UpdateableResultSet::updateDate( sal_Int32 columnIndex, const css::util::Date& x ) ___ Libreoffice-commits mailing list libreof
[Libreoffice-commits] core.git: connectivity/source
connectivity/source/drivers/postgresql/pq_connection.cxx |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) New commits: commit b815bc466695cd1700a2c8d0cdc5201ed5a95032 Author: Lionel Elie Mamane AuthorDate: Tue Nov 17 02:23:56 2020 +0100 Commit: Lionel Mamane CommitDate: Fri Dec 18 08:48:29 2020 +0100 pgsql-sdbc small optimisation 1) use const unique_ptr since we don't need the value to survive the scope in any way. 2) put the custom deleter function (PQconninfoFree) in the ptr class rather than at runtime. Saves one pointer in the ptr class and reduces the ptr class overhead... Change-Id: I914baa0d8ae0426322fd343f5163d09f43c4c41c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105968 Tested-by: Jenkins Reviewed-by: Lionel Mamane diff --git a/connectivity/source/drivers/postgresql/pq_connection.cxx b/connectivity/source/drivers/postgresql/pq_connection.cxx index 4d56d52ec9a9..5d97f2b2436d 100644 --- a/connectivity/source/drivers/postgresql/pq_connection.cxx +++ b/connectivity/source/drivers/postgresql/pq_connection.cxx @@ -453,7 +453,8 @@ void Connection::initialize( const Sequence< Any >& aArguments ) if ( o.getLength() > 0 ) { char *err; -std::shared_ptr oOpts(PQconninfoParse(o.getStr(), &err), PQconninfoFree); +const std::unique_ptr> +oOpts(PQconninfoParse(o.getStr(), &err)); if (oOpts == nullptr) { OUString errorMessage; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - connectivity/source
connectivity/source/parse/sqlflex.l |4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) New commits: commit ede39fd49c03f2f604507bb1b79ac32fe52da493 Author: Lionel Elie Mamane AuthorDate: Fri May 8 07:51:53 2020 +0200 Commit: Michael Stahl CommitDate: Fri Jun 5 11:19:51 2020 +0200 tdf#122461 SQL identifiers (names) can contain newlines Change-Id: Ic58e6b65e146b2e0d9cb656aa5fa06cfe955d11d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93690 Tested-by: Jenkins Reviewed-by: Lionel Elie Mamane (cherry picked from commit b6ab865a371f5c46f96d931721f03afde82b7ec1) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93787 Reviewed-by: Michael Stahl diff --git a/connectivity/source/parse/sqlflex.l b/connectivity/source/parse/sqlflex.l index 1002ecef7970..2269d1c6e52c 100644 --- a/connectivity/source/parse/sqlflex.l +++ b/connectivity/source/parse/sqlflex.l @@ -526,6 +526,8 @@ sal_Int32 gatherString(int delim, sal_Int32 nTyp) int ch; OStringBuffer sBuffer(256); +assert(nTyp == 0 || nTyp == 1 || nTyp == 2); + while (!checkeof(ch = yyinput())) { if (ch == delim) @@ -554,7 +556,7 @@ sal_Int32 gatherString(int delim, sal_Int32 nTyp) } } -else if (nTyp != 1 && (ch == '\r' || ch == '\n') ) +else if (nTyp == 2 && (ch == '\r' || ch == '\n') ) break; else { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - connectivity/source include/connectivity
connectivity/source/commontools/dbtools.cxx |3 +++ connectivity/source/commontools/statementcomposer.cxx | 11 +++ include/connectivity/statementcomposer.hxx|1 + 3 files changed, 15 insertions(+) New commits: commit bfaa243b0cac1753330982bedb47f272724bfa1c Author: Lionel Elie Mamane AuthorDate: Mon May 4 22:58:31 2020 +0200 Commit: Michael Stahl CommitDate: Wed May 13 10:04:52 2020 +0200 tdf#122408 make StatementComposer apply HAVING clause Change-Id: I381c918e8cac2800367bc586f8c230d46bcd71e5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93378 Tested-by: Lionel Elie Mamane Reviewed-by: Michael Stahl diff --git a/connectivity/source/commontools/dbtools.cxx b/connectivity/source/commontools/dbtools.cxx index 514b026b26c9..34d83e573a1e 100644 --- a/connectivity/source/commontools/dbtools.cxx +++ b/connectivity/source/commontools/dbtools.cxx @@ -1247,7 +1247,10 @@ static Reference< XSingleSelectQueryComposer > getComposedRowSetStatement( const bool bApplyFilter = true; _rxRowSet->getPropertyValue("ApplyFilter") >>= bApplyFilter; if ( bApplyFilter ) +{ aComposer.setFilter( getString( _rxRowSet->getPropertyValue("Filter") ) ); +aComposer.setHavingClause( getString( _rxRowSet->getPropertyValue("HavingClause") ) ); +} aComposer.getQuery(); diff --git a/connectivity/source/commontools/statementcomposer.cxx b/connectivity/source/commontools/statementcomposer.cxx index a21c8cf1a41d..01f20e9c1e3c 100644 --- a/connectivity/source/commontools/statementcomposer.cxx +++ b/connectivity/source/commontools/statementcomposer.cxx @@ -60,6 +60,7 @@ namespace dbtools Reference< XSingleSelectQueryComposer > xComposer; OUString sCommand; OUString sFilter; +OUString sHavingClause; OUString sOrder; sal_Int32 nCommandType; boolbEscapeProcessing; @@ -189,6 +190,8 @@ namespace dbtools OUString sFilter; OSL_VERIFY( xQuery->getPropertyValue("Filter") >>= sFilter ); xComposer->setFilter( sFilter ); +OSL_VERIFY( xQuery->getPropertyValue("HavingClause") >>= sFilter ); +xComposer->setHavingClause( sFilter ); } // the composed statement @@ -212,6 +215,7 @@ namespace dbtools // append sort/filter xComposer->setOrder( _rData.sOrder ); xComposer->setFilter( _rData.sFilter ); +xComposer->setHavingClause( _rData.sHavingClause ); sStatement = xComposer->getQuery(); @@ -262,6 +266,13 @@ namespace dbtools } +void StatementComposer::setHavingClause( const OUString& _rHavingClause ) +{ +m_pData->sHavingClause = _rHavingClause; +m_pData->bComposerDirty = true; +} + + void StatementComposer::setOrder( const OUString& _rOrder ) { m_pData->sOrder = _rOrder; diff --git a/include/connectivity/statementcomposer.hxx b/include/connectivity/statementcomposer.hxx index 944a4321b12a..88fa61f553b1 100644 --- a/include/connectivity/statementcomposer.hxx +++ b/include/connectivity/statementcomposer.hxx @@ -68,6 +68,7 @@ namespace dbtools voidsetDisposeComposer( bool _bDoDispose ); voidsetFilter( const OUString& _rFilter ); +voidsetHavingClause( const OUString& _rHavingClause ); voidsetOrder( const OUString& _rOrder ); /** returns the composer which has been fed with the current settings ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: dbaccess/source
dbaccess/source/ui/inc/WCopyTable.hxx |2 dbaccess/source/ui/misc/DExport.cxx|2 dbaccess/source/ui/misc/WCopyTable.cxx | 226 +++-- dbaccess/source/ui/uno/copytablewizard.cxx | 10 - 4 files changed, 132 insertions(+), 108 deletions(-) New commits: commit 0b81aaa36b5b78e208c5cc2cd36b4906b8d636a6 Author: Lionel Elie Mamane AuthorDate: Sat May 9 20:27:35 2020 +0200 Commit: Lionel Elie Mamane CommitDate: Sun May 10 09:33:06 2020 +0200 CopyTableWizard: make code less confusing createTable looked into the requested operation, and depending on that, either created the table or fetched the existing one. For a function named createTable, that made for confusing reading. Split that into: * createTable that creates the table * getTable that fetches the existing table * returnTable that automagically creates or fetches an existing table, depending on the requested operation. Change-Id: I91be67c24026c850530dcaef5ec95ab508e81434 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93882 Tested-by: Jenkins Reviewed-by: Lionel Elie Mamane diff --git a/dbaccess/source/ui/inc/WCopyTable.hxx b/dbaccess/source/ui/inc/WCopyTable.hxx index fffc3cf1dee4..0563232451f9 100644 --- a/dbaccess/source/ui/inc/WCopyTable.hxx +++ b/dbaccess/source/ui/inc/WCopyTable.hxx @@ -385,6 +385,8 @@ namespace dbaui */ void clearDestColumns(); +css::uno::Reference< css::beans::XPropertySet > returnTable(); +css::uno::Reference< css::beans::XPropertySet > getTable(); css::uno::Reference< css::beans::XPropertySet > createTable(); css::uno::Reference< css::beans::XPropertySet > createView() const; sal_Int32 getMaxColumnNameLength() const; diff --git a/dbaccess/source/ui/misc/DExport.cxx b/dbaccess/source/ui/misc/DExport.cxx index 384703a6b573..cc24fe114c63 100644 --- a/dbaccess/source/ui/misc/DExport.cxx +++ b/dbaccess/source/ui/misc/DExport.cxx @@ -687,7 +687,7 @@ bool ODatabaseExport::executeWizard(const OUString& _rTableName, const Any& _aTe case CopyTableOperation::CopyDefinitionAndData: case CopyTableOperation::AppendData: { -m_xTable = aWizard.createTable(); +m_xTable = aWizard.returnTable(); bError = !m_xTable.is(); if(m_xTable.is()) { diff --git a/dbaccess/source/ui/misc/WCopyTable.cxx b/dbaccess/source/ui/misc/WCopyTable.cxx index 0a54f4982d0c..30ebf6f6a642 100644 --- a/dbaccess/source/ui/misc/WCopyTable.cxx +++ b/dbaccess/source/ui/misc/WCopyTable.cxx @@ -1135,6 +1135,28 @@ Reference< XPropertySet > OCopyTableWizard::createView() const return ::dbaui::createView( m_sName, m_xDestConnection, sCommand ); } +Reference< XPropertySet > OCopyTableWizard::returnTable() +{ +if ( getOperation() == CopyTableOperation::AppendData ) +return getTable(); +else +return createTable(); +} + +Reference< XPropertySet > OCopyTableWizard::getTable() +{ +Reference< XPropertySet > xTable; + +Reference xSup( m_xDestConnection, UNO_QUERY ); +Reference< XNameAccess > xTables; +if(xSup.is()) +xTables = xSup->getTables(); +if(xTables.is() && xTables->hasByName(m_sName)) +xTables->getByName(m_sName) >>= xTable; + +return xTable; +} + Reference< XPropertySet > OCopyTableWizard::createTable() { Reference< XPropertySet > xTable; @@ -1143,126 +1165,122 @@ Reference< XPropertySet > OCopyTableWizard::createTable() Reference< XNameAccess > xTables; if(xSup.is()) xTables = xSup->getTables(); -if ( getOperation() != CopyTableOperation::AppendData ) +Reference xFact(xTables,UNO_QUERY); +OSL_ENSURE(xFact.is(),"No XDataDescriptorFactory available!"); +if(!xFact.is()) +return nullptr; + +xTable = xFact->createDataDescriptor(); +OSL_ENSURE(xTable.is(),"Could not create a new object!"); +if(!xTable.is()) +return nullptr; + +OUString sCatalog,sSchema,sTable; +Reference< XDatabaseMetaData> xMetaData = m_xDestConnection->getMetaData(); +::dbtools::qualifiedNameComponents(xMetaData, + m_sName, + sCatalog, + sSchema, + sTable, + ::dbtools::EComposeRule::InDataManipulation); + +if ( sCatalog.isEmpty() && xMetaData->supportsCatalogsInTableDefinitions() ) { -Reference xFact(xTables,UNO_QUERY); -OSL_ENSURE(xFact.is(),"No XDataDescriptorFactory available!"); -if(!xFact.is()) -return nullptr; - -xTable = xFact->createDataDescriptor(); -OSL_ENSURE(xTable.is(),"Could not create a new object!"); -if(!xTable.i
[Libreoffice-commits] core.git: 2 commits - connectivity/source sc/source
connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.hxx |5 connectivity/source/drivers/mysqlc/mysqlc_statement.cxx | 25 +- connectivity/source/drivers/mysqlc/mysqlc_statement.hxx | 51 ++-- sc/source/ui/app/inputhdl.cxx | 77 +- sc/source/ui/view/cellsh3.cxx | 121 +- sc/source/ui/view/tabvwshc.cxx |7 6 files changed, 227 insertions(+), 59 deletions(-) New commits: commit 244e1823c41221d53b0dc7b6d9595514930f8cca Author: Lionel Elie Mamane AuthorDate: Sat May 9 16:01:12 2020 +0200 Commit: Lionel Elie Mamane CommitDate: Sun May 10 07:38:17 2020 +0200 mysql-sdbc: better separate what resultset provides what interface PreparedStatement should not provide XStatement (!!) since MySQL does not support multiple results for prepared statements, PreparedStatement should not expose a XMultipleResults interface Move those out of the common base to Statement itself. Change-Id: Ice7478089441e1def6fd65ff117eb31d04ec46ab Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93864 Tested-by: Jenkins Reviewed-by: Lionel Elie Mamane diff --git a/connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.hxx b/connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.hxx index 3c4edaf411ac..0177b15dbd03 100644 --- a/connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.hxx +++ b/connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.hxx @@ -93,11 +93,6 @@ public: sal_Bool SAL_CALL execute() override; Reference SAL_CALL getConnection() override; -// XStatement -using OCommonStatement::execute; -using OCommonStatement::executeQuery; -using OCommonStatement::executeUpdate; - // XParameters void SAL_CALL setNull(sal_Int32 parameter, sal_Int32 sqlType) override; diff --git a/connectivity/source/drivers/mysqlc/mysqlc_statement.cxx b/connectivity/source/drivers/mysqlc/mysqlc_statement.cxx index b7073be5e6ec..0082f96b61d1 100644 --- a/connectivity/source/drivers/mysqlc/mysqlc_statement.cxx +++ b/connectivity/source/drivers/mysqlc/mysqlc_statement.cxx @@ -88,6 +88,11 @@ Sequence SAL_CALL OCommonStatement::getTypes() return concatSequences(aTypes.getTypes(), OCommonStatement_IBase::getTypes()); } +Sequence SAL_CALL OStatement::getTypes() +{ +return concatSequences(OStatement_BASE::getTypes(), OCommonStatement::getTypes()); +} + void SAL_CALL OCommonStatement::cancel() { MutexGuard aGuard(m_aMutex); @@ -114,7 +119,7 @@ void SAL_CALL OCommonStatement::close() // mysqlc_sdbc_driver::throwFeatureNotImplementedException("com:sun:star:sdbc:XBatchExecution"); // } -sal_Bool SAL_CALL OCommonStatement::execute(const OUString& sql) +sal_Bool SAL_CALL OStatement::execute(const OUString& sql) { MutexGuard aGuard(m_aMutex); checkDisposed(rBHelper.bDisposed); @@ -139,7 +144,7 @@ sal_Bool SAL_CALL OCommonStatement::execute(const OUString& sql) return getResult(); } -Reference SAL_CALL OCommonStatement::executeQuery(const OUString& sql) +Reference SAL_CALL OStatement::executeQuery(const OUString& sql) { bool isRS(execute(sql)); // if a MySQL error occurred, it was already thrown and the below is not executed @@ -156,7 +161,7 @@ Reference SAL_CALL OCommonStatement::executeQuery(const OUString& sq return m_xResultSet; } -Reference SAL_CALL OCommonStatement::getConnection() +Reference SAL_CALL OStatement::getConnection() { MutexGuard aGuard(m_aMutex); checkDisposed(rBHelper.bDisposed); @@ -165,14 +170,14 @@ Reference SAL_CALL OCommonStatement::getConnection() return m_xConnection.get(); } -sal_Int32 SAL_CALL OCommonStatement::getUpdateCount() { return m_nAffectedRows; } +sal_Int32 SAL_CALL OStatement::getUpdateCount() { return m_nAffectedRows; } Any SAL_CALL OStatement::queryInterface(const Type& rType) { -Any aRet = ::cppu::queryInterface(rType, static_cast(this)); +Any aRet = OCommonStatement::queryInterface(rType); if (!aRet.hasValue()) { -aRet = OCommonStatement::queryInterface(rType); +aRet = OStatement_BASE::queryInterface(rType); } return aRet; } @@ -193,7 +198,7 @@ Any SAL_CALL OStatement::queryInterface(const Type& rType) // mysqlc_sdbc_driver::throwFeatureNotImplementedException("com:sun:star:sdbc:XBatchExecution"); // } -sal_Int32 SAL_CALL OCommonStatement::executeUpdate(const OUString& sql) +sal_Int32 SAL_CALL OStatement::executeUpdate(const OUString& sql) { MutexGuard aGuard(m_aMutex); checkDisposed(rBHelper.bDisposed); @@ -202,7 +207,7 @@ sal_Int32 SAL_CALL OCommonStatement::executeUpdate(const OUString& sql) return m_nAffectedRows; } -Reference SAL_CALL OCommonStatement::getResultSet() +Reference SAL_CALL OStatement::getResultSet() { MutexGuard aGuard(m_aMutex); checkDisposed(rBHelper.bD
[Libreoffice-commits] core.git: connectivity/source
connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.cxx | 26 +- connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.hxx | 10 +-- 2 files changed, 19 insertions(+), 17 deletions(-) New commits: commit 2c3fdd1236fc22c5d2688f728e58818984b22298 Author: Lionel Elie Mamane AuthorDate: Sat May 9 15:34:42 2020 +0200 Commit: Lionel Elie Mamane CommitDate: Sun May 10 00:13:05 2020 +0200 mysql-sdbc: do not lie about supporting XPreparedBatchExecution Change-Id: I85220307566f04640965f048ee0b5c5c4e552bdb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93863 Tested-by: Jenkins Reviewed-by: Lionel Elie Mamane diff --git a/connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.cxx b/connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.cxx index 8c9ec1d250db..2b344843deb2 100644 --- a/connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.cxx +++ b/connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.cxx @@ -534,18 +534,20 @@ void SAL_CALL OPreparedStatement::clearParameters() } } -void SAL_CALL OPreparedStatement::clearBatch() -{ - mysqlc_sdbc_driver::throwFeatureNotImplementedException("OPreparedStatement::clearBatch", -*this); -} - -void SAL_CALL OPreparedStatement::addBatch() -{ - mysqlc_sdbc_driver::throwFeatureNotImplementedException("OPreparedStatement::addBatch", *this); -} - -Sequence SAL_CALL OPreparedStatement::executeBatch() { return Sequence(); } +// void SAL_CALL OPreparedStatement::clearBatch() +// { +// mysqlc_sdbc_driver::throwFeatureNotImplementedException("OPreparedStatement::clearBatch", +// *this); +// } + +// void SAL_CALL OPreparedStatement::addBatch() +// { +// mysqlc_sdbc_driver::throwFeatureNotImplementedException("OPreparedStatement::addBatch", *this); +// } + +// Sequence SAL_CALL OPreparedStatement::executeBatch() { +// mysqlc_sdbc_driver::throwFeatureNotImplementedException("OPreparedStatement::executeBatch", *this); +// } void OPreparedStatement::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const Any& rValue) { diff --git a/connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.hxx b/connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.hxx index f488e285bc41..3c4edaf411ac 100644 --- a/connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.hxx +++ b/connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.hxx @@ -27,6 +27,7 @@ #include #include #include +#include namespace connectivity { @@ -52,8 +53,7 @@ struct BindMetaData my_bool error = false; }; -typedef ::cppu::ImplHelper5 OPreparedStatement_BASE; @@ -149,9 +149,9 @@ public: void SAL_CALL clearParameters() override; // XPreparedBatchExecution -void SAL_CALL addBatch() override; -void SAL_CALL clearBatch() override; -css::uno::Sequence SAL_CALL executeBatch() override; +// void SAL_CALL addBatch() override; +// void SAL_CALL clearBatch() override; +// css::uno::Sequence SAL_CALL executeBatch() override; // XCloseable void SAL_CALL close() override; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: connectivity/source
connectivity/source/drivers/mysqlc/mysqlc_connection.cxx |3 connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.cxx |2 connectivity/source/drivers/mysqlc/mysqlc_statement.cxx| 104 +++--- connectivity/source/drivers/mysqlc/mysqlc_statement.hxx|1 4 files changed, 81 insertions(+), 29 deletions(-) New commits: commit 86c86719782243275b65f1f7f2cfdcc0e56c8cd4 Author: Lionel Elie Mamane AuthorDate: Sat May 9 14:24:03 2020 +0200 Commit: Lionel Elie Mamane CommitDate: Sun May 10 00:11:47 2020 +0200 tdf#112423: mysql-sdbc: implement XMultipleResults Thanks to Julien Nabet for the pointers to MySQL's multiple results API documentation: https://dev.mysql.com/doc/refman/8.0/en/c-api-multiple-queries.html Change-Id: Ia6e7f52752ad895210cc415f71bb48d678f3f0ec Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93686 Tested-by: Lionel Elie Mamane Reviewed-by: Lionel Elie Mamane diff --git a/connectivity/source/drivers/mysqlc/mysqlc_connection.cxx b/connectivity/source/drivers/mysqlc/mysqlc_connection.cxx index 045da3b41a77..600e131b89b1 100644 --- a/connectivity/source/drivers/mysqlc/mysqlc_connection.cxx +++ b/connectivity/source/drivers/mysqlc/mysqlc_connection.cxx @@ -175,7 +175,8 @@ void OConnection::construct(const OUString& url, const Sequence& // flags can also be passed as last parameter if (!mysql_real_connect(&m_mysql, host_str.getStr(), user_str.getStr(), pass_str.getStr(), -schema_str.getStr(), nPort, socket_str.getStr(), 0)) +schema_str.getStr(), nPort, socket_str.getStr(), +CLIENT_MULTI_STATEMENTS)) mysqlc_sdbc_driver::throwSQLExceptionWithMsg( mysql_error(&m_mysql), mysql_sqlstate(&m_mysql), mysql_errno(&m_mysql), *this, getConnectionEncoding()); diff --git a/connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.cxx b/connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.cxx index 960b6c8875fc..db9b5c6e6b55 100644 --- a/connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.cxx +++ b/connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.cxx @@ -271,7 +271,7 @@ sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupByUnrelated() { return true; } sal_Bool SAL_CALL ODatabaseMetaData::supportsMultipleTransactions() { return true; } -sal_Bool SAL_CALL ODatabaseMetaData::supportsMultipleResultSets() { return false; } +sal_Bool SAL_CALL ODatabaseMetaData::supportsMultipleResultSets() { return true; } sal_Bool SAL_CALL ODatabaseMetaData::supportsLikeEscapeClause() { return true; } diff --git a/connectivity/source/drivers/mysqlc/mysqlc_statement.cxx b/connectivity/source/drivers/mysqlc/mysqlc_statement.cxx index c6dab15c4b53..b7073be5e6ec 100644 --- a/connectivity/source/drivers/mysqlc/mysqlc_statement.cxx +++ b/connectivity/source/drivers/mysqlc/mysqlc_statement.cxx @@ -18,6 +18,7 @@ */ #include +#include #include "mysqlc_connection.hxx" #include "mysqlc_propertyids.hxx" @@ -118,6 +119,9 @@ sal_Bool SAL_CALL OCommonStatement::execute(const OUString& sql) MutexGuard aGuard(m_aMutex); checkDisposed(rBHelper.bDisposed); +closeResultSet(); +m_nAffectedRows = -1; + OString toExec = OUStringToOString(sql, m_xConnection->getConnectionSettings().encoding); MYSQL* pMySql = m_xConnection->getMysqlConnection(); @@ -127,41 +131,28 @@ sal_Bool SAL_CALL OCommonStatement::execute(const OUString& sql) // toExec = mysqlc_sdbc_driver::escapeSql(toExec); int failure = mysql_real_query(pMySql, toExec.getStr(), toExec.getLength()); -if (failure) +if (failure || mysql_errno(pMySql)) mysqlc_sdbc_driver::throwSQLExceptionWithMsg(mysql_error(pMySql), mysql_sqlstate(pMySql), mysql_errno(pMySql), *this, m_xConnection->getConnectionEncoding()); -m_nAffectedRows = mysql_affected_rows(pMySql); -return !failure; +return getResult(); } Reference SAL_CALL OCommonStatement::executeQuery(const OUString& sql) { -MutexGuard aGuard(m_aMutex); -checkDisposed(rBHelper.bDisposed); -const OUString sSqlStatement = sql; // TODO m_xConnection->transFormPreparedStatement( sql ); -OString toExec -= OUStringToOString(sSqlStatement, m_xConnection->getConnectionSettings().encoding); - -MYSQL* pMySql = m_xConnection->getMysqlConnection(); -// toExec = mysqlc_sdbc_driver::escapeSql(toExec); -int failure = mysql_real_query(pMySql, toExec.getStr(), toExec.getLength()); -if (failure) -mysqlc_sdbc_driver::throwSQLExceptionWithMsg(mysql_error(pMySql), mysql_sqlstate(pMySql), - mysql_errno(pMySql), *this, - m_xConnection->getConnectionEnco
[Libreoffice-commits] core.git: 2 commits - connectivity/source
connectivity/source/drivers/mysqlc/mysqlc_resultset.cxx | 18 connectivity/source/drivers/mysqlc/mysqlc_resultset.hxx |1 connectivity/source/drivers/mysqlc/mysqlc_statement.cxx |7 +++--- connectivity/source/drivers/mysqlc/mysqlc_statement.hxx |2 - 4 files changed, 19 insertions(+), 9 deletions(-) New commits: commit 57cdc7f309f0863e1d8eef4a1780c3e9e2daadb5 Author: Lionel Elie Mamane AuthorDate: Sat May 9 13:53:23 2020 +0200 Commit: Lionel Elie Mamane CommitDate: Sat May 9 21:17:43 2020 +0200 mysql-sdbc: statement: rename disposeResultset to closeResultset it does not actually dispose teh ResulteSet, it only lets go of the reference. Change it to actually close the ResultSet. Change-Id: Iee51738274468f5c00e026304915ba44139a9fab Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93851 Tested-by: Jenkins Reviewed-by: Lionel Elie Mamane diff --git a/connectivity/source/drivers/mysqlc/mysqlc_statement.cxx b/connectivity/source/drivers/mysqlc/mysqlc_statement.cxx index 3211fe09eff7..6b35b236361f 100644 --- a/connectivity/source/drivers/mysqlc/mysqlc_statement.cxx +++ b/connectivity/source/drivers/mysqlc/mysqlc_statement.cxx @@ -50,11 +50,12 @@ OCommonStatement::OCommonStatement(OConnection* _pConnection) OCommonStatement::~OCommonStatement() {} -void OCommonStatement::disposeResultSet() +void OCommonStatement::closeResultSet() { -// free the cursor if alive if (m_xResultSet.is()) { +css::uno::Reference xClose(m_xResultSet, UNO_QUERY_THROW); +xClose->close(); m_xResultSet.clear(); m_pMysqlResult = nullptr; // it is freed by XResultSet } @@ -105,7 +106,7 @@ void SAL_CALL OCommonStatement::close() checkDisposed(rBHelper.bDisposed); } dispose(); -disposeResultSet(); +closeResultSet(); } // void SAL_CALL OStatement::clearBatch() diff --git a/connectivity/source/drivers/mysqlc/mysqlc_statement.hxx b/connectivity/source/drivers/mysqlc/mysqlc_statement.hxx index 54d67bd9d901..9595c596401a 100644 --- a/connectivity/source/drivers/mysqlc/mysqlc_statement.hxx +++ b/connectivity/source/drivers/mysqlc/mysqlc_statement.hxx @@ -71,7 +71,7 @@ protected: sal_Int32 m_nAffectedRows = 0; protected: -void disposeResultSet(); +void closeResultSet(); // OPropertyArrayUsageHelper ::cppu::IPropertyArrayHelper* createArrayHelper() const override; commit a79194007fc0522d134ca2922ef59129fe7aa354 Author: Lionel Elie Mamane AuthorDate: Sat May 9 13:45:10 2020 +0200 Commit: Lionel Elie Mamane CommitDate: Sat May 9 21:17:37 2020 +0200 mysql-sdbc: resultset: do not keep m_pResult after freeing it and replace m_bResultFetched by (m_pResult == nullptr) Change-Id: I81dc9f1be9a72813a8a31c214ea6f8c43a1e37d0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93850 Tested-by: Jenkins Reviewed-by: Lionel Elie Mamane diff --git a/connectivity/source/drivers/mysqlc/mysqlc_resultset.cxx b/connectivity/source/drivers/mysqlc/mysqlc_resultset.cxx index bd405dea973d..75c229823004 100644 --- a/connectivity/source/drivers/mysqlc/mysqlc_resultset.cxx +++ b/connectivity/source/drivers/mysqlc/mysqlc_resultset.cxx @@ -111,12 +111,13 @@ OResultSet::OResultSet(OConnection& rConn, OCommonStatement* pStmt, MYSQL_RES* p , m_pResult(pResult) , m_encoding(_encoding) { +assert(m_pResult); m_xMetaData = new OResultSetMetaData(rConn, m_pResult); } void OResultSet::ensureResultFetched() { -if (!m_bResultFetched) +if (m_pResult) { fetchResult(); } @@ -124,7 +125,7 @@ void OResultSet::ensureResultFetched() void OResultSet::ensureFieldInfoFetched() { -if (m_bResultFetched) +if (m_pResult == nullptr) return; // already fetched // it works only if result set is produced via mysql_store_result @@ -165,8 +166,8 @@ void OResultSet::fetchResult() if (errorNum) mysqlc_sdbc_driver::throwSQLExceptionWithMsg( mysql_error(m_pMysql), mysql_sqlstate(m_pMysql), errorNum, *this, m_encoding); -m_bResultFetched = true; mysql_free_result(m_pResult); +m_pResult = nullptr; } void OResultSet::disposing() @@ -175,6 +176,11 @@ void OResultSet::disposing() MutexGuard aGuard(m_aMutex); +if (m_pResult != nullptr) +{ +mysql_free_result(m_pResult); +m_pResult = nullptr; +} m_aStatement = nullptr; m_xMetaData = nullptr; } @@ -575,7 +581,11 @@ void SAL_CALL OResultSet::close() MutexGuard aGuard(m_aMutex); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); -m_pResult = nullptr; +if (m_pResult != nullptr) +{ +mysql_free_result(m_pResult); +m_pResult = nullptr; +} dispose(); } diff --git a/connectivity/source/drivers/mysqlc/mysqlc_resultset.hxx b/connectivity/source/drivers/mysqlc/mysqlc_resultset.hxx index 027cc294c153..dca2bb4a
[Libreoffice-commits] core.git: 2 commits - connectivity/source
connectivity/source/drivers/mysqlc/mysqlc_statement.cxx | 11 --- connectivity/source/drivers/mysqlc/mysqlc_statement.hxx |1 - 2 files changed, 4 insertions(+), 8 deletions(-) New commits: commit 7c64b92665e13c1a09ee197bd36dac015989f00e Author: Lionel Elie Mamane AuthorDate: Sat May 9 13:59:45 2020 +0200 Commit: Lionel Elie Mamane CommitDate: Sat May 9 21:18:13 2020 +0200 mysql-sdbc: statement::execute do not handle parameters this is not a PreparedStatement, it is not allowed to have parameters Change-Id: I15cd493b89824e4e68eff5a59ac255bf05db0190 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93853 Tested-by: Jenkins Reviewed-by: Lionel Elie Mamane diff --git a/connectivity/source/drivers/mysqlc/mysqlc_statement.cxx b/connectivity/source/drivers/mysqlc/mysqlc_statement.cxx index 2301d040511b..c6dab15c4b53 100644 --- a/connectivity/source/drivers/mysqlc/mysqlc_statement.cxx +++ b/connectivity/source/drivers/mysqlc/mysqlc_statement.cxx @@ -117,10 +117,8 @@ sal_Bool SAL_CALL OCommonStatement::execute(const OUString& sql) { MutexGuard aGuard(m_aMutex); checkDisposed(rBHelper.bDisposed); -const OUString sSqlStatement = m_xConnection->transFormPreparedStatement(sql); -OString toExec -= OUStringToOString(sSqlStatement, m_xConnection->getConnectionSettings().encoding); +OString toExec = OUStringToOString(sql, m_xConnection->getConnectionSettings().encoding); MYSQL* pMySql = m_xConnection->getMysqlConnection(); commit f185b070fd72112a7c4c4b843ee6156c1860ac94 Author: Lionel Elie Mamane AuthorDate: Sat May 9 13:55:23 2020 +0200 Commit: Lionel Elie Mamane CommitDate: Sat May 9 21:17:58 2020 +0200 mysql-sdbc: statement: do not pointlessly keep pointer to result in m_pMysqlResult since it is never actually used after being assigned, except in the code block that assigned it. Change-Id: Ic4341321b18b2c92eb93e59dd3b9e3035c69f293 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93852 Tested-by: Jenkins Reviewed-by: Lionel Elie Mamane diff --git a/connectivity/source/drivers/mysqlc/mysqlc_statement.cxx b/connectivity/source/drivers/mysqlc/mysqlc_statement.cxx index 6b35b236361f..2301d040511b 100644 --- a/connectivity/source/drivers/mysqlc/mysqlc_statement.cxx +++ b/connectivity/source/drivers/mysqlc/mysqlc_statement.cxx @@ -57,7 +57,6 @@ void OCommonStatement::closeResultSet() css::uno::Reference xClose(m_xResultSet, UNO_QUERY_THROW); xClose->close(); m_xResultSet.clear(); -m_pMysqlResult = nullptr; // it is freed by XResultSet } } @@ -155,15 +154,15 @@ Reference SAL_CALL OCommonStatement::executeQuery(const OUString& sq mysql_errno(pMySql), *this, m_xConnection->getConnectionEncoding()); -m_pMysqlResult = mysql_store_result(pMySql); -if (m_pMysqlResult == nullptr) +MYSQL_RES* pMysqlResult = mysql_store_result(pMySql); +if (pMysqlResult == nullptr) { mysqlc_sdbc_driver::throwSQLExceptionWithMsg(mysql_error(pMySql), mysql_sqlstate(pMySql), mysql_errno(pMySql), *this, m_xConnection->getConnectionEncoding()); } -m_xResultSet = new OResultSet(*getOwnConnection(), this, m_pMysqlResult, +m_xResultSet = new OResultSet(*getOwnConnection(), this, pMysqlResult, m_xConnection->getConnectionEncoding()); return m_xResultSet; } diff --git a/connectivity/source/drivers/mysqlc/mysqlc_statement.hxx b/connectivity/source/drivers/mysqlc/mysqlc_statement.hxx index 9595c596401a..2ce417259b24 100644 --- a/connectivity/source/drivers/mysqlc/mysqlc_statement.hxx +++ b/connectivity/source/drivers/mysqlc/mysqlc_statement.hxx @@ -65,7 +65,6 @@ protected: rtl::Reference m_xConnection; // The owning Connection object css::uno::Reference m_xResultSet; -MYSQL_RES* m_pMysqlResult = nullptr; // number of rows affected by an UPDATE, DELETE or INSERT statement. sal_Int32 m_nAffectedRows = 0; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: connectivity/source
connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.cxx |2 connectivity/source/drivers/mysqlc/mysqlc_statement.cxx| 34 +- connectivity/source/drivers/mysqlc/mysqlc_statement.hxx| 10 +- 3 files changed, 23 insertions(+), 23 deletions(-) New commits: commit a69996aab61b1b9206d3e004e283db90d1ca87e2 Author: Lionel Elie Mamane AuthorDate: Sat May 9 13:36:54 2020 +0200 Commit: Lionel Elie Mamane CommitDate: Sat May 9 20:52:33 2020 +0200 mysql-sdbc: do not lie about supporting XBatchExecution Change-Id: I414c5b43fe942203207b57bd23bfae79f1c3cbf4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93849 Tested-by: Jenkins Reviewed-by: Lionel Elie Mamane diff --git a/connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.cxx b/connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.cxx index c9814a9da659..960b6c8875fc 100644 --- a/connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.cxx +++ b/connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.cxx @@ -540,7 +540,7 @@ sal_Bool SAL_CALL ODatabaseMetaData::deletesAreDetected(sal_Int32 /*setType*/) { sal_Bool SAL_CALL ODatabaseMetaData::insertsAreDetected(sal_Int32 /*setType*/) { return false; } -sal_Bool SAL_CALL ODatabaseMetaData::supportsBatchUpdates() { return true; } +sal_Bool SAL_CALL ODatabaseMetaData::supportsBatchUpdates() { return false; } Reference SAL_CALL ODatabaseMetaData::getConnection() { return &m_rConnection; } diff --git a/connectivity/source/drivers/mysqlc/mysqlc_statement.cxx b/connectivity/source/drivers/mysqlc/mysqlc_statement.cxx index 5e9128a80f1a..3211fe09eff7 100644 --- a/connectivity/source/drivers/mysqlc/mysqlc_statement.cxx +++ b/connectivity/source/drivers/mysqlc/mysqlc_statement.cxx @@ -108,10 +108,10 @@ void SAL_CALL OCommonStatement::close() disposeResultSet(); } -void SAL_CALL OStatement::clearBatch() -{ -// if you support batches clear it here -} +// void SAL_CALL OStatement::clearBatch() +// { +// mysqlc_sdbc_driver::throwFeatureNotImplementedException("com:sun:star:sdbc:XBatchExecution"); +// } sal_Bool SAL_CALL OCommonStatement::execute(const OUString& sql) { @@ -180,7 +180,7 @@ sal_Int32 SAL_CALL OCommonStatement::getUpdateCount() { return m_nAffectedRows; Any SAL_CALL OStatement::queryInterface(const Type& rType) { -Any aRet = ::cppu::queryInterface(rType, static_cast(this)); +Any aRet = ::cppu::queryInterface(rType, static_cast(this)); if (!aRet.hasValue()) { aRet = OCommonStatement::queryInterface(rType); @@ -188,19 +188,21 @@ Any SAL_CALL OStatement::queryInterface(const Type& rType) return aRet; } -void SAL_CALL OStatement::addBatch(const OUString&) -{ -MutexGuard aGuard(m_aMutex); -checkDisposed(rBHelper.bDisposed); -} +// void SAL_CALL OStatement::addBatch(const OUString&) +// { +// MutexGuard aGuard(m_aMutex); +// checkDisposed(rBHelper.bDisposed); -Sequence SAL_CALL OStatement::executeBatch() -{ -MutexGuard aGuard(m_aMutex); -checkDisposed(rBHelper.bDisposed); +// mysqlc_sdbc_driver::throwFeatureNotImplementedException("com:sun:star:sdbc:XBatchExecution"); +// } -return Sequence(); -} +// Sequence SAL_CALL OStatement::executeBatch() +// { +// MutexGuard aGuard(m_aMutex); +// checkDisposed(rBHelper.bDisposed); + +// mysqlc_sdbc_driver::throwFeatureNotImplementedException("com:sun:star:sdbc:XBatchExecution"); +// } sal_Int32 SAL_CALL OCommonStatement::executeUpdate(const OUString& sql) { diff --git a/connectivity/source/drivers/mysqlc/mysqlc_statement.hxx b/connectivity/source/drivers/mysqlc/mysqlc_statement.hxx index 9b0d3c952763..54d67bd9d901 100644 --- a/connectivity/source/drivers/mysqlc/mysqlc_statement.hxx +++ b/connectivity/source/drivers/mysqlc/mysqlc_statement.hxx @@ -144,9 +144,7 @@ private: using ::cppu::OPropertySetHelper::getFastPropertyValue; }; -class OStatement final : public OCommonStatement, - public css::sdbc::XBatchExecution, - public css::lang::XServiceInfo +class OStatement final : public OCommonStatement, public css::lang::XServiceInfo { virtual ~OStatement() override = default; @@ -170,11 +168,11 @@ public: void SAL_CALL release() throw() override; // XBatchExecution -void SAL_CALL addBatch(const OUString& sql) override; +// void SAL_CALL addBatch(const OUString& sql) override; -void SAL_CALL clearBatch() override; +// void SAL_CALL clearBatch() override; -css::uno::Sequence SAL_CALL executeBatch() override; +// css::uno::Sequence SAL_CALL executeBatch() override; }; } } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: connectivity/source
connectivity/source/drivers/mysqlc/mysqlc_connection.cxx | 23 ++ connectivity/source/drivers/mysqlc/mysqlc_general.cxx| 13 +++-- connectivity/source/drivers/mysqlc/mysqlc_general.hxx|5 +- connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx | 12 ++--- connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.cxx | 18 +-- connectivity/source/drivers/mysqlc/mysqlc_resultset.cxx |4 - connectivity/source/drivers/mysqlc/mysqlc_statement.cxx | 15 +++--- 7 files changed, 56 insertions(+), 34 deletions(-) New commits: commit c558ad61ba56d45a46e286c5f1329c436e009617 Author: Lionel Elie Mamane AuthorDate: Sat May 9 13:29:44 2020 +0200 Commit: Lionel Elie Mamane CommitDate: Sat May 9 20:51:12 2020 +0200 mysql-sdbc: fill SQLSTATE field of SQLException when throwing it Change-Id: I0970fcfeb0ca92e6401b6f71ca4f54202fc27598 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93848 Tested-by: Jenkins Reviewed-by: Lionel Elie Mamane diff --git a/connectivity/source/drivers/mysqlc/mysqlc_connection.cxx b/connectivity/source/drivers/mysqlc/mysqlc_connection.cxx index 1070dd1fd68f..045da3b41a77 100644 --- a/connectivity/source/drivers/mysqlc/mysqlc_connection.cxx +++ b/connectivity/source/drivers/mysqlc/mysqlc_connection.cxx @@ -176,8 +176,9 @@ void OConnection::construct(const OUString& url, const Sequence& // flags can also be passed as last parameter if (!mysql_real_connect(&m_mysql, host_str.getStr(), user_str.getStr(), pass_str.getStr(), schema_str.getStr(), nPort, socket_str.getStr(), 0)) -mysqlc_sdbc_driver::throwSQLExceptionWithMsg(mysql_error(&m_mysql), mysql_errno(&m_mysql), - *this, getConnectionEncoding()); +mysqlc_sdbc_driver::throwSQLExceptionWithMsg( +mysql_error(&m_mysql), mysql_sqlstate(&m_mysql), mysql_errno(&m_mysql), *this, +getConnectionEncoding()); // Check if the server is 4.1 or above if (getMysqlVersion() < 40100) @@ -231,7 +232,8 @@ Reference SAL_CALL OConnection::prepareStatement(const OUStr unsigned int nErrorNum = mysql_errno(&m_mysql); if (nErrorNum != 0) -mysqlc_sdbc_driver::throwSQLExceptionWithMsg(mysql_error(&m_mysql), nErrorNum, *this, +mysqlc_sdbc_driver::throwSQLExceptionWithMsg(mysql_error(&m_mysql), + mysql_sqlstate(&m_mysql), nErrorNum, *this, getConnectionEncoding()); Reference xStatement = new OPreparedStatement(this, pStmt); @@ -262,8 +264,9 @@ void SAL_CALL OConnection::setAutoCommit(sal_Bool autoCommit) MutexGuard aGuard(m_aMutex); checkDisposed(OConnection_BASE::rBHelper.bDisposed); if (!mysql_autocommit(&m_mysql, autoCommit)) -mysqlc_sdbc_driver::throwSQLExceptionWithMsg(mysql_error(&m_mysql), mysql_errno(&m_mysql), - *this, getConnectionEncoding()); +mysqlc_sdbc_driver::throwSQLExceptionWithMsg( +mysql_error(&m_mysql), mysql_sqlstate(&m_mysql), mysql_errno(&m_mysql), *this, +getConnectionEncoding()); } sal_Bool SAL_CALL OConnection::getAutoCommit() @@ -284,8 +287,9 @@ void SAL_CALL OConnection::commit() checkDisposed(OConnection_BASE::rBHelper.bDisposed); if (!mysql_commit(&m_mysql)) -mysqlc_sdbc_driver::throwSQLExceptionWithMsg(mysql_error(&m_mysql), mysql_errno(&m_mysql), - *this, getConnectionEncoding()); +mysqlc_sdbc_driver::throwSQLExceptionWithMsg( +mysql_error(&m_mysql), mysql_sqlstate(&m_mysql), mysql_errno(&m_mysql), *this, +getConnectionEncoding()); } void SAL_CALL OConnection::rollback() @@ -294,8 +298,9 @@ void SAL_CALL OConnection::rollback() checkDisposed(OConnection_BASE::rBHelper.bDisposed); if (!mysql_rollback(&m_mysql)) -mysqlc_sdbc_driver::throwSQLExceptionWithMsg(mysql_error(&m_mysql), mysql_errno(&m_mysql), - *this, getConnectionEncoding()); +mysqlc_sdbc_driver::throwSQLExceptionWithMsg( +mysql_error(&m_mysql), mysql_sqlstate(&m_mysql), mysql_errno(&m_mysql), *this, +getConnectionEncoding()); } sal_Bool SAL_CALL OConnection::isClosed() diff --git a/connectivity/source/drivers/mysqlc/mysqlc_general.cxx b/connectivity/source/drivers/mysqlc/mysqlc_general.cxx index 90995ad31315..7ed11fe3ff13 100644 --- a/connectivity/source/drivers/mysqlc/mysqlc_general.cxx +++ b/connectivity/source/drivers/mysqlc/mysqlc_general.cxx @@ -104,14 +104,19 @@ void throwInvalidArgumentException(const char* _pAsciiFeatureName, throw SQLException(sMessage, _rxContext, "HYC00", 0, Any()); } -void throwSQLExceptionWit
[Libreoffice-commits] core.git: connectivity/source
connectivity/source/parse/sqlflex.l |4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) New commits: commit b6ab865a371f5c46f96d931721f03afde82b7ec1 Author: Lionel Elie Mamane AuthorDate: Fri May 8 07:51:53 2020 +0200 Commit: Lionel Elie Mamane CommitDate: Fri May 8 11:03:37 2020 +0200 tdf#122461 SQL identifiers (names) can contain newlines Change-Id: Ic58e6b65e146b2e0d9cb656aa5fa06cfe955d11d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93690 Tested-by: Jenkins Reviewed-by: Lionel Elie Mamane diff --git a/connectivity/source/parse/sqlflex.l b/connectivity/source/parse/sqlflex.l index 62cdc0abb865..34a4067ea21c 100644 --- a/connectivity/source/parse/sqlflex.l +++ b/connectivity/source/parse/sqlflex.l @@ -526,6 +526,8 @@ sal_Int32 gatherString(int delim, sal_Int32 nTyp) int ch; OStringBuffer sBuffer(256); +assert(nTyp == 0 || nTyp == 1 || nTyp == 2); + while (!checkeof(ch = yyinput())) { if (ch == delim) @@ -554,7 +556,7 @@ sal_Int32 gatherString(int delim, sal_Int32 nTyp) } } -else if (nTyp != 1 && (ch == '\r' || ch == '\n') ) +else if (nTyp == 2 && (ch == '\r' || ch == '\n') ) break; else { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: connectivity/source include/connectivity
connectivity/source/commontools/dbtools.cxx |3 +++ connectivity/source/commontools/statementcomposer.cxx | 11 +++ include/connectivity/statementcomposer.hxx|1 + 3 files changed, 15 insertions(+) New commits: commit 97a2c1fc5e376c0c00968f17a0392c6d3a5ed565 Author: Lionel Elie Mamane AuthorDate: Mon May 4 22:58:31 2020 +0200 Commit: Lionel Elie Mamane CommitDate: Tue May 5 01:07:34 2020 +0200 tdf#122408 make StatementComposer apply HAVING clause Change-Id: I381c918e8cac2800367bc586f8c230d46bcd71e5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93448 Tested-by: Jenkins Reviewed-by: Lionel Elie Mamane diff --git a/connectivity/source/commontools/dbtools.cxx b/connectivity/source/commontools/dbtools.cxx index 36161735ebb2..a16549ba3b50 100644 --- a/connectivity/source/commontools/dbtools.cxx +++ b/connectivity/source/commontools/dbtools.cxx @@ -1246,7 +1246,10 @@ static Reference< XSingleSelectQueryComposer > getComposedRowSetStatement( const bool bApplyFilter = true; _rxRowSet->getPropertyValue("ApplyFilter") >>= bApplyFilter; if ( bApplyFilter ) +{ aComposer.setFilter( getString( _rxRowSet->getPropertyValue("Filter") ) ); +aComposer.setHavingClause( getString( _rxRowSet->getPropertyValue("HavingClause") ) ); +} aComposer.getQuery(); diff --git a/connectivity/source/commontools/statementcomposer.cxx b/connectivity/source/commontools/statementcomposer.cxx index a21c8cf1a41d..01f20e9c1e3c 100644 --- a/connectivity/source/commontools/statementcomposer.cxx +++ b/connectivity/source/commontools/statementcomposer.cxx @@ -60,6 +60,7 @@ namespace dbtools Reference< XSingleSelectQueryComposer > xComposer; OUString sCommand; OUString sFilter; +OUString sHavingClause; OUString sOrder; sal_Int32 nCommandType; boolbEscapeProcessing; @@ -189,6 +190,8 @@ namespace dbtools OUString sFilter; OSL_VERIFY( xQuery->getPropertyValue("Filter") >>= sFilter ); xComposer->setFilter( sFilter ); +OSL_VERIFY( xQuery->getPropertyValue("HavingClause") >>= sFilter ); +xComposer->setHavingClause( sFilter ); } // the composed statement @@ -212,6 +215,7 @@ namespace dbtools // append sort/filter xComposer->setOrder( _rData.sOrder ); xComposer->setFilter( _rData.sFilter ); +xComposer->setHavingClause( _rData.sHavingClause ); sStatement = xComposer->getQuery(); @@ -262,6 +266,13 @@ namespace dbtools } +void StatementComposer::setHavingClause( const OUString& _rHavingClause ) +{ +m_pData->sHavingClause = _rHavingClause; +m_pData->bComposerDirty = true; +} + + void StatementComposer::setOrder( const OUString& _rOrder ) { m_pData->sOrder = _rOrder; diff --git a/include/connectivity/statementcomposer.hxx b/include/connectivity/statementcomposer.hxx index 944a4321b12a..88fa61f553b1 100644 --- a/include/connectivity/statementcomposer.hxx +++ b/include/connectivity/statementcomposer.hxx @@ -68,6 +68,7 @@ namespace dbtools voidsetDisposeComposer( bool _bDoDispose ); voidsetFilter( const OUString& _rFilter ); +voidsetHavingClause( const OUString& _rHavingClause ); voidsetOrder( const OUString& _rOrder ); /** returns the composer which has been fed with the current settings ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] online.git: net/Ssl.cpp wsd/Storage.cpp
net/Ssl.cpp | 112 +++- wsd/Storage.cpp |4 ++ 2 files changed, 74 insertions(+), 42 deletions(-) New commits: commit 1fbf148f098ba31464d7dc7040bb62464e8191e8 Author: Lionel Elie Mamane AuthorDate: Fri Oct 18 19:21:09 2019 +0200 Commit: Andras Timar CommitDate: Wed Nov 20 13:48:07 2019 +0100 modernise TLS setup Some machines (e.g. Debian 10) by default will refuse DH groups shorter than 2048 bits. Change-Id: I3505bc392775d7c92069a8f705f574338666a8e7 Reviewed-on: https://gerrit.libreoffice.org/83300 Reviewed-by: Andras Timar Tested-by: Andras Timar diff --git a/net/Ssl.cpp b/net/Ssl.cpp index ec14502d3..428239280 100644 --- a/net/Ssl.cpp +++ b/net/Ssl.cpp @@ -197,45 +197,59 @@ void SslContext::dynlockDestroy(struct CRYPTO_dynlock_value* lock, const char* / void SslContext::initDH() { #ifndef OPENSSL_NO_DH -// 1024-bit MODP Group with 160-bit prime order subgroup (RFC5114) -// -BEGIN DH PARAMETERS- -// MIIBDAKBgQCxC4+WoIDgHd6S3l6uXVTsUsmfvPsGo8aaap3KUtI7YWBz4oZ1oj0Y -// mDjvHi7mUsAT7LSuqQYRIySXXDzUm4O/rMvdfZDEvXCYSI6cIZpzck7/1vrlZEc4 -// +qMaT/VbzMChUa9fDci0vUW/N982XBpl5oz9p21NpwjfH7K8LkpDcQKBgQCk0cvV -// w/00EmdlpELvuZkF+BBN0lisUH/WQGz/FCZtMSZv6h5cQVZLd35pD1UE8hMWAhe0 -// sBuIal6RVH+eJ0n01/vX07mpLuGQnQ0iY/gKdqaiTAh6CR9THb8KAWm2oorWYqTR -// jnOvoy13nVkY0IvIhY9Nzvl8KiSFXm7rIrOy5QICAKA= -// -END DH PARAMETERS- -// - -static const unsigned char dh1024_p[] = +// 2048-bit MODP Group with 256-bit prime order subgroup (RFC5114) + +static const unsigned char dh2048_p[] = { -0xB1,0x0B,0x8F,0x96,0xA0,0x80,0xE0,0x1D,0xDE,0x92,0xDE,0x5E, -0xAE,0x5D,0x54,0xEC,0x52,0xC9,0x9F,0xBC,0xFB,0x06,0xA3,0xC6, -0x9A,0x6A,0x9D,0xCA,0x52,0xD2,0x3B,0x61,0x60,0x73,0xE2,0x86, -0x75,0xA2,0x3D,0x18,0x98,0x38,0xEF,0x1E,0x2E,0xE6,0x52,0xC0, -0x13,0xEC,0xB4,0xAE,0xA9,0x06,0x11,0x23,0x24,0x97,0x5C,0x3C, -0xD4,0x9B,0x83,0xBF,0xAC,0xCB,0xDD,0x7D,0x90,0xC4,0xBD,0x70, -0x98,0x48,0x8E,0x9C,0x21,0x9A,0x73,0x72,0x4E,0xFF,0xD6,0xFA, -0xE5,0x64,0x47,0x38,0xFA,0xA3,0x1A,0x4F,0xF5,0x5B,0xCC,0xC0, -0xA1,0x51,0xAF,0x5F,0x0D,0xC8,0xB4,0xBD,0x45,0xBF,0x37,0xDF, -0x36,0x5C,0x1A,0x65,0xE6,0x8C,0xFD,0xA7,0x6D,0x4D,0xA7,0x08, -0xDF,0x1F,0xB2,0xBC,0x2E,0x4A,0x43,0x71, +0x87,0xA8,0xE6,0x1D,0xB4,0xB6,0x66,0x3C,0xFF,0xBB,0xD1,0x9C, +0x65,0x19,0x59,0x99,0x8C,0xEE,0xF6,0x08,0x66,0x0D,0xD0,0xF2, +0x5D,0x2C,0xEE,0xD4,0x43,0x5E,0x3B,0x00,0xE0,0x0D,0xF8,0xF1, +0xD6,0x19,0x57,0xD4,0xFA,0xF7,0xDF,0x45,0x61,0xB2,0xAA,0x30, +0x16,0xC3,0xD9,0x11,0x34,0x09,0x6F,0xAA,0x3B,0xF4,0x29,0x6D, +0x83,0x0E,0x9A,0x7C,0x20,0x9E,0x0C,0x64,0x97,0x51,0x7A,0xBD, +0x5A,0x8A,0x9D,0x30,0x6B,0xCF,0x67,0xED,0x91,0xF9,0xE6,0x72, +0x5B,0x47,0x58,0xC0,0x22,0xE0,0xB1,0xEF,0x42,0x75,0xBF,0x7B, +0x6C,0x5B,0xFC,0x11,0xD4,0x5F,0x90,0x88,0xB9,0x41,0xF5,0x4E, +0xB1,0xE5,0x9B,0xB8,0xBC,0x39,0xA0,0xBF,0x12,0x30,0x7F,0x5C, +0x4F,0xDB,0x70,0xC5,0x81,0xB2,0x3F,0x76,0xB6,0x3A,0xCA,0xE1, +0xCA,0xA6,0xB7,0x90,0x2D,0x52,0x52,0x67,0x35,0x48,0x8A,0x0E, +0xF1,0x3C,0x6D,0x9A,0x51,0xBF,0xA4,0xAB,0x3A,0xD8,0x34,0x77, +0x96,0x52,0x4D,0x8E,0xF6,0xA1,0x67,0xB5,0xA4,0x18,0x25,0xD9, +0x67,0xE1,0x44,0xE5,0x14,0x05,0x64,0x25,0x1C,0xCA,0xCB,0x83, +0xE6,0xB4,0x86,0xF6,0xB3,0xCA,0x3F,0x79,0x71,0x50,0x60,0x26, +0xC0,0xB8,0x57,0xF6,0x89,0x96,0x28,0x56,0xDE,0xD4,0x01,0x0A, +0xBD,0x0B,0xE6,0x21,0xC3,0xA3,0x96,0x0A,0x54,0xE7,0x10,0xC3, +0x75,0xF2,0x63,0x75,0xD7,0x01,0x41,0x03,0xA4,0xB5,0x43,0x30, +0xC1,0x98,0xAF,0x12,0x61,0x16,0xD2,0x27,0x6E,0x11,0x71,0x5F, +0x69,0x38,0x77,0xFA,0xD7,0xEF,0x09,0xCA,0xDB,0x09,0x4A,0xE9, +0x1E,0x1A,0x15,0x97, + }; -static const unsigned char dh1024_g[] = +static const unsigned char dh2048_g[] = { -0xA4,0xD1,0xCB,0xD5,0xC3,0xFD,0x34,0x12,0x67,0x65,0xA4,0x42, -0xEF,0xB9,0x99,0x05,0xF8,0x10,0x4D,0xD2,0x58,0xAC,0x50,0x7F, -0xD6,0x40,0x6C,0xFF,0x14,0x26,0x6D,0x31,0x26,0x6F,0xEA,0x1E, -0x5C,0x41,0x56,0x4B,0x77,0x7E,0x69,0x0F,0x55,0x04,0xF2,0x13, -0x16,0x02,0x17,0xB4,0xB0,0x1B,0x88,0x6A,0x5E,0x91,0x54,0x7F, -0x9E,0x27,0x49,0xF4,0xD7,0xFB,0xD7,0xD3,0xB9,0xA9,0x2E,0xE1, -0x90,0x9D,0x0D,0x22,0x63,0xF8,0x0A,0x76,0xA6,0xA2,0x4C,0x08, -0x7A,0x09,0x1F,0x53,0x1D,0xBF,0x0A,0x01,0x69,0xB6,0xA2,0x8A, -0xD6,0x62,0xA4,0xD1,0x8E,0x73,0xAF,0xA3,0x2D,0x77,0x9D,0x59, -0x18,0xD0,0x8B,0xC8,0x85,0x8F,0x4D,0xCE,0xF9,0x7C,0x2A,0x24, -0x85,0x5E,0x6E,0xEB,0x22,0xB3,0xB2,0xE5, +0x3F,0xB3,0x2C,0x9B,0x73,0x13,0x4D,0x0B,0x2E,0x77,0x50,0x66, +0x60,0xED,0xBD,0x48,0x4C,0xA7,0xB1,0x8F,0x21,0xEF,0x20,0x54, +0x07,0xF4,0x79,0x3A,0x1A,0x0B,0xA1,0x25,0x10,0xDB,0xC1,0x50,
[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-4-0' - debian/loolwsd.postrm
debian/loolwsd.postrm |4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) New commits: commit d9c3d7df368fb8f19f969412f97ad6f26aa1a770 Author: Lionel Elie Mamane AuthorDate: Fri Oct 18 19:05:33 2019 +0200 Commit: Andras Timar CommitDate: Sat Oct 19 22:27:57 2019 +0200 debian package postrm: fix lintian warning Change-Id: I7db7a5549f4fdf3597be0df13b4ff447522b7b92 Reviewed-on: https://gerrit.libreoffice.org/81089 Reviewed-by: Andras Timar Tested-by: Andras Timar (cherry picked from commit 0c426536fac66a4cabf4b5feefd188022a56e594) Reviewed-on: https://gerrit.libreoffice.org/81143 diff --git a/debian/loolwsd.postrm b/debian/loolwsd.postrm index d4e1fd993..784ad65ba 100755 --- a/debian/loolwsd.postrm +++ b/debian/loolwsd.postrm @@ -1,3 +1,5 @@ #!/bin/sh -rm /etc/apt/apt.conf.d/25loolwsd +set -e + +rm -f /etc/apt/apt.conf.d/25loolwsd ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-4' - debian/loolwsd.postrm
debian/loolwsd.postrm |4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) New commits: commit 0c426536fac66a4cabf4b5feefd188022a56e594 Author: Lionel Elie Mamane AuthorDate: Fri Oct 18 19:05:33 2019 +0200 Commit: Andras Timar CommitDate: Sat Oct 19 22:27:30 2019 +0200 debian package postrm: fix lintian warning Change-Id: I7db7a5549f4fdf3597be0df13b4ff447522b7b92 Reviewed-on: https://gerrit.libreoffice.org/81089 Reviewed-by: Andras Timar Tested-by: Andras Timar diff --git a/debian/loolwsd.postrm b/debian/loolwsd.postrm index d4e1fd993..784ad65ba 100755 --- a/debian/loolwsd.postrm +++ b/debian/loolwsd.postrm @@ -1,3 +1,5 @@ #!/bin/sh -rm /etc/apt/apt.conf.d/25loolwsd +set -e + +rm -f /etc/apt/apt.conf.d/25loolwsd ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: configure.ac
configure.ac |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 6d482d0ac21249d4d4987cda1bfe51f967c36dc8 Author: Lionel Elie Mamane AuthorDate: Wed Jul 10 13:58:46 2019 +0200 Commit: Miklos Vajna CommitDate: Fri Aug 2 11:44:57 2019 +0200 build fails with libxmlsec version 1.2.27 Due to indirect inclusion of C++ headers in scope of an 'extern "C"'. Possibly it works with version 1.2.24 to 1.2.26. Change-Id: I12bd43b51b1cf829bfe91d4ab1eb5470b86ec18e Reviewed-on: https://gerrit.libreoffice.org/75349 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/configure.ac b/configure.ac index b3f5390428fe..96f776280732 100644 --- a/configure.ac +++ b/configure.ac @@ -8300,7 +8300,7 @@ libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat]) dnl === dnl Check for system xmlsec dnl === -libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.24]) +libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.28]) AC_MSG_CHECKING([whether to enable Embedded OpenType support]) if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - i18npool/source
i18npool/source/calendar/calendarImpl.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 913120fe50ee770e60bd82e2e60047242872111a Author: Lionel Elie Mamane AuthorDate: Wed Jul 10 10:27:19 2019 +0200 Commit: Tomáš Chvátal CommitDate: Tue Jul 30 13:56:59 2019 +0200 build failure - disambiguate Calendar return class Change-Id: I892281f85f6cc9c2de2c341ae63240ae85d302c4 Reviewed-on: https://gerrit.libreoffice.org/76595 Reviewed-by: Tomáš Chvátal Reviewed-by: Lionel Elie Mamane Tested-by: Jenkins diff --git a/i18npool/source/calendar/calendarImpl.cxx b/i18npool/source/calendar/calendarImpl.cxx index c9e22f7bc9b7..228bed358b09 100644 --- a/i18npool/source/calendar/calendarImpl.cxx +++ b/i18npool/source/calendar/calendarImpl.cxx @@ -128,7 +128,7 @@ CalendarImpl::getLoadedCalendar2() return xCalendar->getLoadedCalendar2(); } -Calendar SAL_CALL +::css::i18n::Calendar SAL_CALL CalendarImpl::getLoadedCalendar() { if (!xCalendar.is()) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: i18npool/source
i18npool/source/calendar/calendarImpl.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 2388ffc6d7f10bf0413bd2350e808a3337a99ff2 Author: Lionel Elie Mamane AuthorDate: Wed Jul 10 10:27:19 2019 +0200 Commit: Lionel Elie Mamane CommitDate: Wed Jul 10 10:27:50 2019 +0200 build failure - disambiguate Calendar return class Change-Id: I892281f85f6cc9c2de2c341ae63240ae85d302c4 diff --git a/i18npool/source/calendar/calendarImpl.cxx b/i18npool/source/calendar/calendarImpl.cxx index c9e22f7bc9b7..228bed358b09 100644 --- a/i18npool/source/calendar/calendarImpl.cxx +++ b/i18npool/source/calendar/calendarImpl.cxx @@ -128,7 +128,7 @@ CalendarImpl::getLoadedCalendar2() return xCalendar->getLoadedCalendar2(); } -Calendar SAL_CALL +::css::i18n::Calendar SAL_CALL CalendarImpl::getLoadedCalendar() { if (!xCalendar.is()) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits