[Libreoffice-commits] core.git: mysqlc/Library_mysqlc.mk mysqlc/source
mysqlc/Library_mysqlc.mk|3 mysqlc/source/mysqlc_connection.cxx | 140 +-- mysqlc/source/mysqlc_connection.hxx | 19 mysqlc/source/mysqlc_databasemetadata.cxx | 1127 ++-- mysqlc/source/mysqlc_databasemetadata.hxx |4 mysqlc/source/mysqlc_driver.cxx |2 mysqlc/source/mysqlc_general.cxx| 266 +- mysqlc/source/mysqlc_general.hxx| 65 + mysqlc/source/mysqlc_prepared_resultset.cxx | 1097 +++ mysqlc/source/mysqlc_prepared_resultset.hxx | 248 ++ mysqlc/source/mysqlc_preparedstatement.cxx | 510 mysqlc/source/mysqlc_preparedstatement.hxx | 24 mysqlc/source/mysqlc_resultset.cxx | 497 ++-- mysqlc/source/mysqlc_resultset.hxx | 20 mysqlc/source/mysqlc_resultsetmetadata.cxx | 247 +- mysqlc/source/mysqlc_resultsetmetadata.hxx | 17 mysqlc/source/mysqlc_statement.cxx | 103 +- mysqlc/source/mysqlc_statement.hxx | 12 18 files changed, 2724 insertions(+), 1677 deletions(-) New commits: commit 3478d7453a3d65b3d8d164e8f898a0b79f005c58 Author: Tamas Bunth AuthorDate: Sun Jun 17 18:09:43 2018 +0200 Commit: Tamás Bunth CommitDate: Sun Aug 12 23:15:21 2018 +0200 Switch from mysql to MariaDB C API In order to get rid of the MySQL C++ Connector, the sdbc driver should be implemented using the MariaDB C connector instead. MariaDB Connector/C is LGPL licensed, so later it can be used in the connectivity module. This way mysqlc won't be an extension, so it could be maintained easier. Change-Id: I99c13ccf154b33b145d34b1e06eec85946dc82a0 Reviewed-on: https://gerrit.libreoffice.org/55960 Reviewed-by: Tamás Bunth Tested-by: Tamás Bunth diff --git a/mysqlc/Library_mysqlc.mk b/mysqlc/Library_mysqlc.mk index 97f2b63500a2..39c6230d2f05 100644 --- a/mysqlc/Library_mysqlc.mk +++ b/mysqlc/Library_mysqlc.mk @@ -12,12 +12,14 @@ $(eval $(call gb_Library_Library,mysqlc)) $(eval $(call gb_Library_use_externals,mysqlc,\ boost_headers \ mysql-connector-cpp \ + mariadb-connector-c \ )) ifeq ($(SYSTEM_MYSQL_CONNECTOR_CPP),) $(eval $(call gb_Library_add_libs,mysqlc,\ $(if $(filter-out WNT,$(OS)),$(if $(filter MACOSX SOLARIS,$(OS)),-lz -lm,\ -rdynamic -lz -lcrypt -lm)) \ + $(if $(filter LINUX,$(OS)),-lpthread -ldl,) \ )) endif @@ -46,6 +48,7 @@ $(eval $(call gb_Library_add_exception_objects,mysqlc,\ mysqlc/source/mysqlc_services \ mysqlc/source/mysqlc_connection \ mysqlc/source/mysqlc_resultset \ + mysqlc/source/mysqlc_prepared_resultset \ mysqlc/source/mysqlc_resultsetmetadata \ mysqlc/source/mysqlc_statement \ mysqlc/source/mysqlc_preparedstatement \ diff --git a/mysqlc/source/mysqlc_connection.cxx b/mysqlc/source/mysqlc_connection.cxx index c9b4c6d2e471..73581734a293 100644 --- a/mysqlc/source/mysqlc_connection.cxx +++ b/mysqlc/source/mysqlc_connection.cxx @@ -61,12 +61,25 @@ using ::osl::MutexGuard; #define MYSQLC_URI_PREFIX "sdbc:mysqlc:" -OConnection::OConnection(MysqlCDriver& _rDriver, sql::Driver * _cppDriver) +namespace +{ +void lcl_executeUpdate(MYSQL* pMySql, const rtl::OString& sql) +{ +mysql_real_query(pMySql, sql.getStr(), sql.getLength()); +// TODO handle error +} +} + +OConnection::OConnection(MysqlCDriver& _rDriver) :OMetaConnection_BASE(m_aMutex) ,m_xMetaData(nullptr) ,m_xDriver(&_rDriver) -,cppDriver(_cppDriver) { +mysql_init(_mysql); + +// use TCP as connection +mysql_protocol_type protocol = MYSQL_PROTOCOL_TCP; +mysql_options(_mysql, MYSQL_OPT_PROTOCOL, reinterpret_cast()); } OConnection::~OConnection() @@ -144,29 +157,22 @@ void OConnection::construct(const rtl::OUString& url, const Sequence< PropertyVa } if (!bEmbedded) { -try { -sql::ConnectOptionsMap connProps; -std::string host_str = rtl::OUStringToOString(aHostName, m_settings.encoding).getStr(); -std::string user_str = rtl::OUStringToOString(aUser, m_settings.encoding).getStr(); -std::string pass_str = rtl::OUStringToOString(aPass, m_settings.encoding).getStr(); -std::string schema_str = rtl::OUStringToOString(aDbName, m_settings.encoding).getStr(); -connProps["hostName"] = sql::ConnectPropertyVal(host_str); -connProps["userName"] = sql::ConnectPropertyVal(user_str); -connProps["password"] = sql::ConnectPropertyVal(pass_str); -connProps["schema"] = sql::ConnectPropertyVal(schema_str); -connProps["port"] = sql::ConnectPropertyVal(static_cast(nPort)); -if (unixSocketPassed) { -sql::SQLString socket_str = rtl::OUStringToOString(sUnixSocket, m_settings.encoding).getStr(); -connProps["socket"] = socket_str; -
[Libreoffice-commits] core.git: mysqlc/Library_mysqlc.mk mysqlc/source
mysqlc/Library_mysqlc.mk |1 mysqlc/source/mysqlc_connection.cxx |2 mysqlc/source/mysqlc_driver.hxx |2 mysqlc/source/mysqlc_propertyids.cxx | 191 --- mysqlc/source/mysqlc_propertyids.hxx | 35 -- mysqlc/source/mysqlc_resultset.cxx | 10 - mysqlc/source/mysqlc_statement.cxx | 20 +-- 7 files changed, 17 insertions(+), 244 deletions(-) New commits: commit d081dda43f393ad8a47bdc4b831bcf59b1d670d0 Author: Stephan Bergmann sberg...@redhat.com Date: Wed Mar 25 12:46:55 2015 +0100 loplugin:constantfunction Change-Id: I368de78b99369982cd17a8e7ac8c36b4e7e60b41 diff --git a/mysqlc/Library_mysqlc.mk b/mysqlc/Library_mysqlc.mk index bc26eaf..adb2111 100644 --- a/mysqlc/Library_mysqlc.mk +++ b/mysqlc/Library_mysqlc.mk @@ -52,7 +52,6 @@ $(eval $(call gb_Library_add_exception_objects,mysqlc,\ mysqlc/source/mysqlc_databasemetadata \ mysqlc/source/mysqlc_types \ mysqlc/source/mysqlc_general \ - mysqlc/source/mysqlc_propertyids \ )) $(eval $(call gb_Library_set_componentfile,mysqlc,mysqlc/source/mysqlc)) diff --git a/mysqlc/source/mysqlc_connection.cxx b/mysqlc/source/mysqlc_connection.cxx index a47ad72..42df27d 100644 --- a/mysqlc/source/mysqlc_connection.cxx +++ b/mysqlc/source/mysqlc_connection.cxx @@ -103,7 +103,7 @@ void OConnection::construct(const rtl::OUString url, const Sequence PropertyVa sal_Int32 nPort = 3306; rtl::OUString aDbName; -m_settings.encoding = m_rDriver.getDefaultEncoding(); +m_settings.encoding = MysqlCDriver::getDefaultEncoding(); m_settings.quoteIdentifier.clear(); // parse url. Url has the following format: diff --git a/mysqlc/source/mysqlc_driver.hxx b/mysqlc/source/mysqlc_driver.hxx index 60bafc2..21b2998 100644 --- a/mysqlc/source/mysqlc_driver.hxx +++ b/mysqlc/source/mysqlc_driver.hxx @@ -102,7 +102,7 @@ namespace connectivity inline Reference ::com::sun::star::lang::XMultiServiceFactory getFactory() const { return m_xFactory; } -rtl_TextEncoding getDefaultEncoding() { return RTL_TEXTENCODING_UTF8; } +static rtl_TextEncoding getDefaultEncoding() { return RTL_TEXTENCODING_UTF8; } private: voidimpl_initCppConn_lck_throw(); diff --git a/mysqlc/source/mysqlc_propertyids.cxx b/mysqlc/source/mysqlc_propertyids.cxx deleted file mode 100644 index 0e88419..000 --- a/mysqlc/source/mysqlc_propertyids.cxx +++ /dev/null @@ -1,191 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the License); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include osl/diagnose.h -#include mysqlc_propertyids.hxx - - -namespace connectivity -{ -namespace mysqlc -{ -const sal_Char* getPROPERTY_QUERYTIMEOUT() { return QueryTimeOut; } -const sal_Char* getPROPERTY_MAXFIELDSIZE() { return MaxFieldSize; } -const sal_Char* getPROPERTY_MAXROWS() { return MaxRows; } -const sal_Char* getPROPERTY_CURSORNAME(){ return CursorName; } -const sal_Char* getPROPERTY_RESULTSETCONCURRENCY() { return ResultSetConcurrency; } -const sal_Char* getPROPERTY_RESULTSETTYPE() { return ResultSetType; } -const sal_Char* getPROPERTY_FETCHDIRECTION(){ return FetchDirection; } -const sal_Char* getPROPERTY_FETCHSIZE() { return FetchSize; } -const sal_Char* getPROPERTY_ESCAPEPROCESSING() { return EscapeProcessing; } -const sal_Char* getPROPERTY_USEBOOKMARKS() { return UseBookmarks; } - -const sal_Char* getPROPERTY_NAME() { return Name; } -const sal_Char* getPROPERTY_TYPE() { return Type; } -const sal_Char* getPROPERTY_TYPENAME() { return TypeName; } -const sal_Char* getPROPERTY_PRECISION() { return Precision; } -const sal_Char* getPROPERTY_SCALE() { return Scale; } -const sal_Char* getPROPERTY_ISNULLABLE(){ return IsNullable; } -const sal_Char* getPROPERTY_ISAUTOINCREMENT() { return IsAutoIncrement; } -const sal_Char* getPROPERTY_ISROWVERSION() { return IsRowVersion; } -const sal_Char* getPROPERTY_DESCRIPTION() {
[Libreoffice-commits] core.git: mysqlc/Library_mysqlc.mk mysqlc/source
mysqlc/Library_mysqlc.mk|2 +- mysqlc/source/mysqlc_connection.cxx | 35 +-- 2 files changed, 2 insertions(+), 35 deletions(-) New commits: commit 730df392f5c5424a46fcb360c21d34a04622eb9f Author: Fridrich Å trba fridrich.st...@bluewin.ch Date: Mon Mar 11 10:09:39 2013 +0100 Do not try to dlopen a static internal libmariadb Change-Id: Ib624089418e22c050e951acc4c487572c7e0ea25 diff --git a/mysqlc/Library_mysqlc.mk b/mysqlc/Library_mysqlc.mk index ad8bc8d..d67d314 100644 --- a/mysqlc/Library_mysqlc.mk +++ b/mysqlc/Library_mysqlc.mk @@ -38,7 +38,7 @@ $(eval $(call gb_Library_use_libraries,mysqlc,\ $(eval $(call gb_Library_add_defs,mysqlc,\ -DCPPDBC_EXPORTS \ - -DCPPCON_LIB_BUILD \ + -DCPPCONN_LIB_BUILD \ -DMARIADBC_VERSION_MAJOR=$(MARIADBC_MAJOR) \ -DMARIADBC_VERSION_MINOR=$(MARIADBC_MINOR) \ -DMARIADBC_VERSION_MICRO=$(MARIADBC_MICRO) \ diff --git a/mysqlc/source/mysqlc_connection.cxx b/mysqlc/source/mysqlc_connection.cxx index fe93623..b4ebe77 100644 --- a/mysqlc/source/mysqlc_connection.cxx +++ b/mysqlc/source/mysqlc_connection.cxx @@ -99,10 +99,6 @@ void SAL_CALL OConnection::release() } /* }}} */ -#ifndef SYSTEM_MARIADB -extern C { void SAL_CALL thisModule() {} } -#endif - /* {{{ OConnection::construct() -I- */ void OConnection::construct(const OUString url, const Sequence PropertyValue info) throw(SQLException) @@ -194,35 +190,6 @@ void OConnection::construct(const OUString url, const Sequence PropertyValue connProps[socket] = pipe_str; } -#ifndef SYSTEM_MARIADB -::rtl::OUString sMySQLClientLib( libmariadb SAL_DLLEXTENSION ); - -::rtl::OUString moduleBase; -OSL_VERIFY( ::osl::Module::getUrlFromAddress( thisModule, moduleBase ) ); -::rtl::OUString sMySQLClientLibURL; -try -{ -sMySQLClientLibURL = ::rtl::Uri::convertRelToAbs( moduleBase, sMySQLClientLib.pData ); -} -catch ( const ::rtl::MalformedUriException e ) -{ -(void)e; // silence compiler -#if OSL_DEBUG_LEVEL 0 -::rtl::OString sMessage( OConnection::construct: malformed URI: ); -sMessage += ::rtl::OUStringToOString( e.getMessage(), osl_getThreadTextEncoding() ); -OSL_FAIL( sMessage.getStr() ); -#endif -} - -::rtl::OUString sMySQLClientLibPath; -osl_getSystemPathFromFileURL( sMySQLClientLibURL.pData, sMySQLClientLibPath.pData ); - -sql::SQLString mysqlLib = ::rtl::OUStringToOString( sMySQLClientLibPath, osl_getThreadTextEncoding() ).getStr(); -connProps[clientlib] = mysqlLib; - -OSL_TRACE(clientlib=%s, mysqlLib.c_str()); -#endif - OSL_TRACE(hostName=%s, host_str.c_str()); OSL_TRACE(port=%i, int(nPort)); OSL_TRACE(userName=%s, user_str.c_str()); @@ -243,7 +210,7 @@ void OConnection::construct(const OUString url, const Sequence PropertyValue // Check if the server is 4.1 or above if (this-getMysqlVersion() 40100) { throw SQLException( -::rtl::OUString( MySQL Connector/OO.org requires MySQL Server 4.1 or above ), +::rtl::OUString( MariaDB LibreOffice Connector requires MySQL Server 4.1 or above ), *this, ::rtl::OUString(), 0, ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits