[Libreoffice-commits] core.git: configure.ac connectivity/Configuration_mysql.mk connectivity/Library_mysqlc.mk connectivity/Library_mysql.mk connectivity/Module_connectivity.mk connectivity/registry connectivity/source external/mariadb-connector-c external/Module_external.mk external/mysql-connector-cpp mysqlc/Configuration_mysql.mk mysqlc/Extension_mysql-connector-ooo.mk mysqlc/Library_mysqlc.mk mysqlc/Makefile mysqlc/Module_mysqlc.mk mysqlc/Rdb_mysqlc.mk mysqlc/README mysqlc/source postprocess/CustomTarget_registry.mk postprocess/Rdb_services.mk RepositoryExternal.mk Repository.mk RepositoryModule_host.mk solenv/qa
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Fri Aug 24 15:20:20 UTC 2018
Repository.mk | 3
RepositoryExternal.mk | 5
RepositoryModule_host.mk | 1
configure.ac | 30
connectivity/Configuration_mysql.mk | 7
connectivity/Library_mysql.mk | 48
connectivity/Library_mysqlc.mk | 34
connectivity/Module_connectivity.mk | 9
connectivity/registry/mysql/org/openoffice/Office/DataAccess/Drivers.xcu | 264 --
connectivity/source/drivers/mysql/YCatalog.cxx | 138 -
connectivity/source/drivers/mysql/YColumns.cxx | 78
connectivity/source/drivers/mysql/YDriver.cxx | 492 ----
connectivity/source/drivers/mysql/YTable.cxx | 356 ---
connectivity/source/drivers/mysql/YTables.cxx | 216 --
connectivity/source/drivers/mysql/YUser.cxx | 320 ---
connectivity/source/drivers/mysql/YUsers.cxx | 105 -
connectivity/source/drivers/mysql/YViews.cxx | 151 -
connectivity/source/drivers/mysql/Yservices.cxx | 69
connectivity/source/drivers/mysql/mysql.component | 26
connectivity/source/drivers/mysqlc/mysqlc_connection.cxx | 346 +--
connectivity/source/drivers/mysqlc/mysqlc_connection.hxx | 183 +
connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.cxx | 989 ++++++++++
connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.hxx | 245 ++
connectivity/source/drivers/mysqlc/mysqlc_driver.cxx | 169 +
connectivity/source/drivers/mysqlc/mysqlc_driver.hxx | 101 +
connectivity/source/drivers/mysqlc/mysqlc_general.cxx | 354 +++
connectivity/source/drivers/mysqlc/mysqlc_general.hxx | 125 +
connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx | 7
connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.hxx | 2
connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.cxx | 240 +-
connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.hxx | 161 +
connectivity/source/drivers/mysqlc/mysqlc_propertyids.hxx | 5
connectivity/source/drivers/mysqlc/mysqlc_resultset.cxx | 358 +--
connectivity/source/drivers/mysqlc/mysqlc_resultset.hxx | 246 ++
connectivity/source/drivers/mysqlc/mysqlc_resultsetmetadata.cxx | 35
connectivity/source/drivers/mysqlc/mysqlc_resultsetmetadata.hxx | 109 +
connectivity/source/drivers/mysqlc/mysqlc_services.cxx | 74
connectivity/source/drivers/mysqlc/mysqlc_statement.cxx | 170 -
connectivity/source/drivers/mysqlc/mysqlc_statement.hxx | 185 +
connectivity/source/drivers/mysqlc/mysqlc_subcomponent.hxx | 164 +
connectivity/source/drivers/mysqlc/mysqlc_types.cxx | 680 ++++++
connectivity/source/drivers/mysqlc/mysqlc_types.hxx | 13
external/Module_external.mk | 1
external/mariadb-connector-c/StaticLibrary_mariadb-connector-c.mk | 2
external/mysql-connector-cpp/Makefile | 7
external/mysql-connector-cpp/Module_mysql-connector-cpp.mk | 17
external/mysql-connector-cpp/README | 1
external/mysql-connector-cpp/UnpackedTarball_mysql-connector-cpp.mk | 26
external/mysql-connector-cpp/binding_config.h | 5
external/mysql-connector-cpp/config.h | 39
external/mysql-connector-cpp/patches/dynexcspec.patch.0 | 15
external/mysql-connector-cpp/patches/enable-libmysql-proxy.patch | 27
external/mysql-connector-cpp/patches/mysql-connector-c++-1.1.0.patch | 115 -
external/mysql-connector-cpp/patches/warnings.patch.0 | 11
external/mysql-connector-cpp/version_info.h | 42
mysqlc/Configuration_mysql.mk | 15
mysqlc/Extension_mysql-connector-ooo.mk | 35
mysqlc/Makefile | 7
mysqlc/Module_mysqlc.mk | 23
mysqlc/README | 79
mysqlc/Rdb_mysqlc.mk | 16
mysqlc/source/mysqlc_connection.hxx | 191 -
mysqlc/source/mysqlc_databasemetadata.hxx | 219 --
mysqlc/source/mysqlc_driver.cxx | 283 --
mysqlc/source/mysqlc_driver.hxx | 124 -
mysqlc/source/mysqlc_general.hxx | 128 -
mysqlc/source/mysqlc_preparedstatement.hxx | 163 -
mysqlc/source/mysqlc_resultset.hxx | 247 --
mysqlc/source/mysqlc_resultsetmetadata.hxx | 110 -
mysqlc/source/mysqlc_statement.hxx | 189 -
mysqlc/source/mysqlc_subcomponent.hxx | 163 -
mysqlc/source/mysqlc_types.cxx | 682 ------
postprocess/CustomTarget_registry.mk | 4
postprocess/Rdb_services.mk | 2
solenv/qa/python/gbuildtojson.py | 2
75 files changed, 4345 insertions(+), 5958 deletions(-)
New commits:
commit 26b40fcfc67480e75bd9959b0c5cb9db10fdf6a1
Author: Tamas Bunth <tamas.bunth at collabora.co.uk>
AuthorDate: Thu Aug 16 16:35:17 2018 +0200
Commit: Tamás Bunth <btomi96 at gmail.com>
CommitDate: Fri Aug 24 17:19:51 2018 +0200
Moving mysqlc into connectivity as a library
Additionally I erased the remains of the old mysql C++ connector.
Also update the code where the clang plugins were unhappy after moving
the mysqlc module.
Remove mysql-cpp-connector external.
Change-Id: I771cc7afacf5012fc349afb6b36828fb0fee5a66
Reviewed-on: https://gerrit.libreoffice.org/59200
Tested-by: Jenkins
Reviewed-by: Tamás Bunth <btomi96 at gmail.com>
diff --git a/Repository.mk b/Repository.mk
index 9936b0e71c8c..b5c0b5b151a1 100644
--- a/Repository.mk
+++ b/Repository.mk
@@ -405,7 +405,7 @@ $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,ooo, \
msfilter \
$(call gb_Helper_optional,SCRIPTING,msforms) \
mtfrenderer \
- $(call gb_Helper_optional,DBCONNECTIVITY,mysql) \
+ $(call gb_Helper_optional,DBCONNECTIVITY,mysqlc) \
numbertext \
odbc \
odfflatxml \
@@ -722,7 +722,6 @@ $(eval $(call gb_Helper_register_libraries_for_install,UNOVERLIBS,ure, \
$(eval $(call gb_Helper_register_libraries,EXTENSIONLIBS, \
active_native \
- mysqlc \
passive_native \
))
diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index 788840851726..f0acedbf654e 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -228,8 +228,11 @@ endef
endif # SYSTEM_EPOXY
define gb_LinkTarget__use_iconv
+ifeq ($(COM),MSC)
+$(call gb_LinkTarget_add_libs,$(1),libiconv.lib)
+else
$(call gb_LinkTarget_add_libs,$(1),-liconv)
-
+endif
endef
ifneq ($(SYSTEM_MARIADB_CONNECTOR_C),)
diff --git a/RepositoryModule_host.mk b/RepositoryModule_host.mk
index 3b530286114e..e6f93c869ccd 100644
--- a/RepositoryModule_host.mk
+++ b/RepositoryModule_host.mk
@@ -81,7 +81,6 @@ $(eval $(call gb_Module_add_moduledirs,libreoffice,\
linguistic \
lotuswordpro \
$(call gb_Helper_optional,DESKTOP,l10ntools) \
- $(call gb_Helper_optional,MARIADBC,mysqlc) \
$(call gb_Helper_optional,NLPSOLVER,nlpsolver) \
o3tl \
$(call gb_Helper_optional,ODK,odk) \
diff --git a/configure.ac b/configure.ac
index 88dd8bfb3e1a..0bd0b862729e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1005,11 +1005,6 @@ AC_ARG_ENABLE(dynamic-loading,
[Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
)
-libo_FUZZ_ARG_ENABLE(ext-mariadb-connector,
- AS_HELP_STRING([--enable-ext-mariadb-connector],
- [Enable the build of the MariaDB/MySQL Connector extension.])
-)
-
libo_FUZZ_ARG_ENABLE(report-builder,
AS_HELP_STRING([--disable-report-builder],
[Disable the Report Builder.])
@@ -1731,12 +1726,12 @@ AC_ARG_WITH(system-apache-commons,
AC_ARG_WITH(system-mariadb,
AS_HELP_STRING([--with-system-mariadb],
[Use MariaDB/MySQL libraries already on system, for building the MariaDB Connector/LibreOffice
- extension.]),,
+ .]),,
[with_system_mariadb="$with_system_libs"])
AC_ARG_ENABLE(bundle-mariadb,
AS_HELP_STRING([--enable-bundle-mariadb],
- [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice extension.])
+ [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice.])
)
AC_ARG_WITH(system-mysql-cppconn,
@@ -8320,18 +8315,12 @@ AC_SUBST(PYTHON_VERSION)
AC_SUBST(PYTHON_VERSION_MAJOR)
AC_SUBST(PYTHON_VERSION_MINOR)
-AC_MSG_CHECKING([whether to build the MariaDB/MySQL Connector extension])
-if test "x$enable_ext_mariadb_connector" = "xyes" -a "x$enable_extension_integration" != "xno"; then
- AC_MSG_RESULT([yes])
- ENABLE_MARIADBC=TRUE
- MARIADBC_MAJOR=1
- MARIADBC_MINOR=0
- MARIADBC_MICRO=2
- BUILD_TYPE="$BUILD_TYPE MARIADBC"
-else
- AC_MSG_RESULT([no])
- ENABLE_MARIADBC=
-fi
+ENABLE_MARIADBC=TRUE
+MARIADBC_MAJOR=1
+MARIADBC_MINOR=0
+MARIADBC_MICRO=2
+BUILD_TYPE="$BUILD_TYPE MARIADBC"
+
AC_SUBST(ENABLE_MARIADBC)
AC_SUBST(MARIADBC_MAJOR)
AC_SUBST(MARIADBC_MINOR)
@@ -12550,9 +12539,6 @@ if test "$enable_mpl_subset" = "yes"; then
if test "$WITH_WEBDAV" = "neon"; then
AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
fi
- if test "x$enable_ext_mariadb_connector" = "xyes"; then
- AC_MSG_ERROR([need to --disable-ext-mariadb-connector - mariadb/mysql support.])
- fi
if test -n "$ENABLE_PDFIMPORT"; then
if test "x$SYSTEM_POPPLER" = "x"; then
AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
diff --git a/connectivity/Configuration_mysql.mk b/connectivity/Configuration_mysql.mk
index 1cb07ca71441..3e3f0b908ecb 100644
--- a/connectivity/Configuration_mysql.mk
+++ b/connectivity/Configuration_mysql.mk
@@ -7,14 +7,13 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
-$(eval $(call gb_Configuration_Configuration,driver_mysql))
+$(eval $(call gb_Configuration_Configuration,mysqlc))
-$(eval $(call gb_Configuration_add_spool_modules,driver_mysql,connectivity/registry/mysql,\
+$(eval $(call gb_Configuration_add_spool_modules,mysqlc,connectivity/registry/mysqlc,\
org/openoffice/Office/DataAccess/Drivers-mysql.xcu \
))
-$(eval $(call gb_Configuration_add_localized_datas,driver_mysql,connectivity/registry/mysql,\
+$(eval $(call gb_Configuration_add_localized_datas,mysqlc,connectivity/registry/mysqlc,\
org/openoffice/Office/DataAccess/Drivers.xcu \
))
-# vim: set noet sw=4 ts=4:
diff --git a/connectivity/Library_mysql.mk b/connectivity/Library_mysql.mk
deleted file mode 100644
index ac3c0c2619e8..000000000000
--- a/connectivity/Library_mysql.mk
+++ /dev/null
@@ -1,48 +0,0 @@
-# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
-#
-#
-# 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/.
-#
-
-$(eval $(call gb_Library_Library,mysql))
-
-$(eval $(call gb_Library_set_componentfile,mysql,connectivity/source/drivers/mysql/mysql))
-
-$(eval $(call gb_Library_use_external,mysql,boost_headers))
-
-$(eval $(call gb_Library_use_sdk_api,mysql))
-
-$(eval $(call gb_Library_set_include,mysql,\
- $$(INCLUDE) \
- -I$(SRCDIR)/connectivity/inc \
- -I$(SRCDIR)/connectivity/source/inc \
-))
-
-$(eval $(call gb_Library_set_precompiled_header,mysql,$(SRCDIR)/connectivity/inc/pch/precompiled_mysql))
-
-$(eval $(call gb_Library_use_libraries,mysql,\
- cppu \
- cppuhelper \
- sal \
- salhelper \
- dbtools \
- comphelper \
-))
-
-$(eval $(call gb_Library_add_exception_objects,mysql,\
- connectivity/source/drivers/mysql/YDriver \
- connectivity/source/drivers/mysql/YTables \
- connectivity/source/drivers/mysql/YTable \
- connectivity/source/drivers/mysql/YViews \
- connectivity/source/drivers/mysql/YCatalog \
- connectivity/source/drivers/mysql/YColumns \
- connectivity/source/drivers/mysql/YUser \
- connectivity/source/drivers/mysql/YUsers \
- connectivity/source/drivers/mysql/Yservices \
-))
-
-# vim: set noet sw=4 ts=4:
diff --git a/mysqlc/Library_mysqlc.mk b/connectivity/Library_mysqlc.mk
similarity index 61%
rename from mysqlc/Library_mysqlc.mk
rename to connectivity/Library_mysqlc.mk
index 8e1205c2fdb8..cc8625d060a2 100644
--- a/mysqlc/Library_mysqlc.mk
+++ b/connectivity/Library_mysqlc.mk
@@ -11,7 +11,6 @@ $(eval $(call gb_Library_Library,mysqlc))
$(eval $(call gb_Library_use_externals,mysqlc,\
boost_headers \
- mysql-connector-cpp \
mariadb-connector-c \
))
@@ -19,6 +18,13 @@ ifeq ($(OS)-$(SYSTEM_MARIADB_CONNECTOR_C),MACOSX-)
$(eval $(call gb_Library_use_external,mysqlc,iconv))
endif
+$(eval $(call gb_Library_set_include,firebird_sdbc,\
+ -I$(SRCDIR)/connectivity/inc \
+ -I$(SRCDIR)/connectivity/source/inc \
+ $$(INCLUDE) \
+ -I$(WORKDIR)/YaccTarget/connectivity/source/parse \
+))
+
ifeq ($(SYSTEM_MYSQL_CONNECTOR_CPP),)
$(eval $(call gb_Library_add_libs,mysqlc,\
$(if $(filter-out WNT,$(OS)),$(if $(filter MACOSX SOLARIS,$(OS)),-lz -lm,\
@@ -48,21 +54,19 @@ $(eval $(call gb_Library_add_defs,mysqlc,\
))
$(eval $(call gb_Library_add_exception_objects,mysqlc,\
- mysqlc/source/mysqlc_driver \
- 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 \
- mysqlc/source/mysqlc_databasemetadata \
- mysqlc/source/mysqlc_types \
- mysqlc/source/mysqlc_general \
+ connectivity/source/drivers/mysqlc/mysqlc_driver \
+ connectivity/source/drivers/mysqlc/mysqlc_services \
+ connectivity/source/drivers/mysqlc/mysqlc_connection \
+ connectivity/source/drivers/mysqlc/mysqlc_resultset \
+ connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset \
+ connectivity/source/drivers/mysqlc/mysqlc_resultsetmetadata \
+ connectivity/source/drivers/mysqlc/mysqlc_statement \
+ connectivity/source/drivers/mysqlc/mysqlc_preparedstatement \
+ connectivity/source/drivers/mysqlc/mysqlc_databasemetadata \
+ connectivity/source/drivers/mysqlc/mysqlc_types \
+ connectivity/source/drivers/mysqlc/mysqlc_general \
))
-$(eval $(call gb_Library_set_componentfile,mysqlc,mysqlc/source/mysqlc))
-
-$(eval $(call gb_Library_set_external_code,mysqlc))
+$(eval $(call gb_Library_set_componentfile,mysqlc,connectivity/source/drivers/mysqlc/mysqlc))
# vim: set noet sw=4 ts=4:
diff --git a/connectivity/Module_connectivity.mk b/connectivity/Module_connectivity.mk
index 3ba7ecf01d41..0fc587daa340 100644
--- a/connectivity/Module_connectivity.mk
+++ b/connectivity/Module_connectivity.mk
@@ -20,7 +20,6 @@ $(eval $(call gb_Module_add_targets,connectivity,\
Configuration_calc \
Configuration_dbase \
Configuration_flat \
- Configuration_mysql \
Configuration_odbc \
Configuration_writer \
Library_calc \
@@ -28,7 +27,6 @@ $(eval $(call gb_Module_add_targets,connectivity,\
Library_dbpool2 \
Library_file \
Library_flat \
- Library_mysql \
$(if $(filter ANDROID IOS,$(OS)),,Library_odbc) \
Library_sdbc2 \
Library_writer \
@@ -81,6 +79,13 @@ $(eval $(call gb_Module_add_targets,connectivity,\
))
endif
+ifeq ($(ENABLE_MARIADBC),TRUE)
+$(eval $(call gb_Module_add_targets,connectivity,\
+ Configuration_mysql \
+ Library_mysqlc \
+))
+endif
+
ifneq ($(BUILD_POSTGRESQL_SDBC),)
$(eval $(call gb_Module_add_targets,connectivity,\
Configuration_postgresql \
diff --git a/connectivity/registry/mysql/org/openoffice/Office/DataAccess/Drivers.xcu b/connectivity/registry/mysql/org/openoffice/Office/DataAccess/Drivers.xcu
deleted file mode 100644
index 77988448f722..000000000000
--- a/connectivity/registry/mysql/org/openoffice/Office/DataAccess/Drivers.xcu
+++ /dev/null
@@ -1,264 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * 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 .
- -->
-<oor:component-data oor:name="Drivers" oor:package="org.openoffice.Office.DataAccess" xmlns:install="http://openoffice.org/2004/installation" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema">
- <node oor:name="Installed" install:module="mysql">
- <node oor:name="sdbc:mysql:jdbc:*" oor:op="replace">
- <prop oor:name="Driver">
- <value>org.openoffice.comp.drivers.MySQL.Driver</value>
- </prop>
- <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
- <value xml:lang="en-US">MySQL (JDBC)</value>
- </prop>
- <node oor:name="Properties">
- <node oor:name="CharSet" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:string">
- <value></value>
- </prop>
- </node>
- <node oor:name="JavaDriverClass" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:string">
- <value>com.mysql.jdbc.Driver</value>
- </prop>
- </node>
- <node oor:name="AddIndexAppendix" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="ParameterNameSubstitution" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- </node>
- <node oor:name="Features">
- <node oor:name="UseKeywordAsBeforeAlias" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="IgnoreDriverPrivileges" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="DisplayVersionColumns" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="UseDOSLineEnds" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="BooleanComparisonMode" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="FormsCheckRequiredFields" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- </node>
- <node oor:name="MetaData">
- <node oor:name="SupportsTableCreation" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="UseJava" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="Authentication" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:string">
- <value>UserPassword</value>
- </prop>
- </node>
- <node oor:name="SupportsColumnDescription" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- </node>
- </node>
- <node oor:name="sdbc:mysql:odbc:*" oor:op="replace">
- <prop oor:name="Driver">
- <value>org.openoffice.comp.drivers.MySQL.Driver</value>
- </prop>
- <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
- <value xml:lang="en-US">MySQL (ODBC)</value>
- </prop>
- <node oor:name="Properties">
- <node oor:name="CharSet" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:string">
- <value></value>
- </prop>
- </node>
- <node oor:name="AddIndexAppendix" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="ParameterNameSubstitution" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- </node>
- <node oor:name="Features">
- <node oor:name="UseKeywordAsBeforeAlias" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="IgnoreDriverPrivileges" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="DisplayVersionColumns" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="UseDOSLineEnds" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="BooleanComparisonMode" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="FormsCheckRequiredFields" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- </node>
- <node oor:name="MetaData">
- <node oor:name="SupportsTableCreation" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="SupportsBrowsing" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="Authentication" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:string">
- <value>UserPassword</value>
- </prop>
- </node>
- </node>
- </node>
- <node oor:name="sdbc:mysql:mysqlc:*" oor:op="replace">
- <prop oor:name="Driver">
- <value>org.openoffice.comp.drivers.MySQL.Driver</value>
- </prop>
- <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
- <value xml:lang="en-US">MySQL (Native)</value>
- </prop>
- <node oor:name="Properties">
- <node oor:name="CharSet" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:string">
- <value></value>
- </prop>
- </node>
- <node oor:name="LocalSocket" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:string">
- <value></value>
- </prop>
- </node>
- <node oor:name="NamedPipe" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:string">
- <value></value>
- </prop>
- </node>
- <node oor:name="AddIndexAppendix" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="ParameterNameSubstitution" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- </node>
- <node oor:name="Features">
- <node oor:name="UseKeywordAsBeforeAlias" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="IgnoreDriverPrivileges" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="DisplayVersionColumns" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="UseDOSLineEnds" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="BooleanComparisonMode" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="FormsCheckRequiredFields" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- </node>
- <node oor:name="MetaData">
- <node oor:name="SupportsTableCreation" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="Authentication" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:string">
- <value>UserPassword</value>
- </prop>
- </node>
- <node oor:name="SupportsColumnDescription" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- </node>
- </node>
- </node>
-</oor:component-data>
diff --git a/mysqlc/source/registry/data/org/openoffice/Office/DataAccess/Drivers.xcu b/connectivity/registry/mysqlc/org/openoffice/Office/DataAccess/Drivers.xcu
similarity index 100%
rename from mysqlc/source/registry/data/org/openoffice/Office/DataAccess/Drivers.xcu
rename to connectivity/registry/mysqlc/org/openoffice/Office/DataAccess/Drivers.xcu
diff --git a/connectivity/source/drivers/mysql/YCatalog.cxx b/connectivity/source/drivers/mysql/YCatalog.cxx
deleted file mode 100644
index 020085c9141a..000000000000
--- a/connectivity/source/drivers/mysql/YCatalog.cxx
+++ /dev/null
@@ -1,138 +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 <mysql/YCatalog.hxx>
-#include <mysql/YUsers.hxx>
-#include <mysql/YTables.hxx>
-#include <mysql/YViews.hxx>
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/sdbc/XResultSet.hpp>
-#include <comphelper/types.hxx>
-
-
-using namespace connectivity;
-using namespace connectivity::mysql;
-using namespace connectivity::sdbcx;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::sdbcx;
-using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::lang;
-
-OMySQLCatalog::OMySQLCatalog(const Reference< XConnection >& _xConnection) : OCatalog(_xConnection)
- ,m_xConnection(_xConnection)
-{
-}
-
-void OMySQLCatalog::refreshObjects(const Sequence< OUString >& _sKindOfObject,::std::vector< OUString>& _rNames)
-{
- Reference< XResultSet > xResult = m_xMetaData->getTables(Any(),
- "%",
- "%",
- _sKindOfObject);
- fillNames(xResult,_rNames);
-}
-
-void OMySQLCatalog::refreshTables()
-{
- ::std::vector< OUString> aVector;
-
- Sequence< OUString > sTableTypes(3);
- sTableTypes[0] = "VIEW";
- sTableTypes[1] = "TABLE";
- sTableTypes[2] = "%"; // just to be sure to include anything else ....
-
- refreshObjects(sTableTypes,aVector);
-
- if ( m_pTables )
- m_pTables->reFill(aVector);
- else
- m_pTables.reset( new OTables(m_xMetaData,*this,m_aMutex,aVector) );
-}
-
-void OMySQLCatalog::refreshViews()
-{
- Sequence< OUString > aTypes { "VIEW" };
-
- // let's simply assume the server is new enough to support views. Current drivers
- // as of this writing might not return the proper information in getTableTypes, so
- // don't rely on it.
-
- ::std::vector< OUString> aVector;
- refreshObjects(aTypes,aVector);
-
- if ( m_pViews )
- m_pViews->reFill(aVector);
- else
- m_pViews.reset( new OViews(m_xMetaData,*this,m_aMutex,aVector) );
-}
-
-void OMySQLCatalog::refreshGroups()
-{
-}
-
-void OMySQLCatalog::refreshUsers()
-{
- ::std::vector< OUString> aVector;
- Reference< XStatement > xStmt = m_xConnection->createStatement( );
- Reference< XResultSet > xResult = xStmt->executeQuery("SELECT grantee FROM information_schema.user_privileges GROUP BY grantee");
- if ( xResult.is() )
- {
- Reference< XRow > xRow(xResult,UNO_QUERY);
- while( xResult->next() )
- aVector.push_back(xRow->getString(1));
- ::comphelper::disposeComponent(xResult);
- }
- ::comphelper::disposeComponent(xStmt);
-
- if(m_pUsers)
- m_pUsers->reFill(aVector);
- else
- m_pUsers.reset( new OUsers(*this,m_aMutex,aVector,m_xConnection,this) );
-}
-
-Any SAL_CALL OMySQLCatalog::queryInterface( const Type & rType )
-{
- if ( rType == cppu::UnoType<XGroupsSupplier>::get())
- return Any();
-
-
- return OCatalog::queryInterface(rType);
-}
-
-Sequence< Type > SAL_CALL OMySQLCatalog::getTypes( )
-{
- Sequence< Type > aTypes = OCatalog::getTypes();
- std::vector<Type> aOwnTypes;
- aOwnTypes.reserve(aTypes.getLength());
- const Type* pBegin = aTypes.getConstArray();
- const Type* pEnd = pBegin + aTypes.getLength();
- for(;pBegin != pEnd;++pBegin)
- {
- if ( !(*pBegin == cppu::UnoType<XGroupsSupplier>::get()))
- {
- aOwnTypes.push_back(*pBegin);
- }
- }
- return Sequence< Type >(aOwnTypes.data(), aOwnTypes.size());
-}
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mysql/YColumns.cxx b/connectivity/source/drivers/mysql/YColumns.cxx
deleted file mode 100644
index ceae5d44ee48..000000000000
--- a/connectivity/source/drivers/mysql/YColumns.cxx
+++ /dev/null
@@ -1,78 +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 <mysql/YColumns.hxx>
-#include <TConnection.hxx>
-
-
-using namespace ::comphelper;
-using namespace connectivity::mysql;
-using namespace connectivity::sdbcx;
-using namespace connectivity;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::sdbcx;
-using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::lang;
-
-OMySQLColumns::OMySQLColumns( ::cppu::OWeakObject& _rParent
- ,::osl::Mutex& _rMutex
- ,const ::std::vector< OUString> &_rVector
- ) : OColumnsHelper(_rParent,true/*_bCase*/,_rMutex,_rVector,true/*_bUseHardRef*/)
-{
-}
-
-Reference< XPropertySet > OMySQLColumns::createDescriptor()
-{
- return new OMySQLColumn;
-}
-
-
-OMySQLColumn::OMySQLColumn()
- : connectivity::sdbcx::OColumn( true )
-{
- construct();
-}
-
-void OMySQLColumn::construct()
-{
- m_sAutoIncrement = "auto_increment";
- registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_AUTOINCREMENTCREATION),PROPERTY_ID_AUTOINCREMENTCREATION,0,&m_sAutoIncrement, cppu::UnoType<decltype(m_sAutoIncrement)>::get());
-}
-
-::cppu::IPropertyArrayHelper* OMySQLColumn::createArrayHelper( sal_Int32 /*_nId*/ ) const
-{
- return doCreateArrayHelper();
-}
-
-::cppu::IPropertyArrayHelper & SAL_CALL OMySQLColumn::getInfoHelper()
-{
- return *OMySQLColumn_PROP::getArrayHelper(isNew() ? 1 : 0);
-}
-
-Sequence< OUString > SAL_CALL OMySQLColumn::getSupportedServiceNames( )
-{
- Sequence< OUString > aSupported { "com.sun.star.sdbcx.Column" };
-
- return aSupported;
-}
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mysql/YDriver.cxx b/connectivity/source/drivers/mysql/YDriver.cxx
deleted file mode 100644
index b78954531b93..000000000000
--- a/connectivity/source/drivers/mysql/YDriver.cxx
+++ /dev/null
@@ -1,492 +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 <mysql/YDriver.hxx>
-#include <mysql/YCatalog.hxx>
-#include <comphelper/namedvaluecollection.hxx>
-#include <comphelper/processfactory.hxx>
-#include <comphelper/types.hxx>
-#include <cppuhelper/supportsservice.hxx>
-#include <connectivity/dbexception.hxx>
-#include <connectivity/dbcharset.hxx>
-#include <com/sun/star/sdbc/DriverManager.hpp>
-#include <com/sun/star/uno/XComponentContext.hpp>
-#include <TConnection.hxx>
-#include <strings.hrc>
-#include <resource/sharedresources.hxx>
-
-namespace connectivity
-{
-
- using namespace mysql;
- using namespace ::com::sun::star::uno;
- using namespace ::com::sun::star::sdbc;
- using namespace ::com::sun::star::sdbcx;
- using namespace ::com::sun::star::beans;
- using namespace ::com::sun::star::lang;
-
- namespace mysql
- {
- Reference< XInterface > ODriverDelegator_CreateInstance(const Reference< css::lang::XMultiServiceFactory >& _rxFac)
- {
- return *(new ODriverDelegator( comphelper::getComponentContext(_rxFac) ));
- }
- }
-
- namespace
- {
- OUString getJavaDriverClass(
- css::uno::Sequence<css::beans::PropertyValue> const & info)
- {
- return comphelper::NamedValueCollection(info).getOrDefault(
- "JavaDriverClass", OUString("com.mysql.jdbc.Driver"));
- }
- }
-
- ODriverDelegator::ODriverDelegator(const Reference< XComponentContext >& _rxContext)
- : ODriverDelegator_BASE(m_aMutex)
- ,m_xContext(_rxContext)
- {
- }
-
-
- ODriverDelegator::~ODriverDelegator()
- {
- try
- {
- ::comphelper::disposeComponent(m_xODBCDriver);
- ::comphelper::disposeComponent(m_xNativeDriver);
- TJDBCDrivers::iterator aIter = m_aJdbcDrivers.begin();
- TJDBCDrivers::const_iterator aEnd = m_aJdbcDrivers.end();
- for ( ;aIter != aEnd;++aIter )
- ::comphelper::disposeComponent(aIter->second);
- }
- catch(const Exception&)
- {
- }
- }
-
-
- void ODriverDelegator::disposing()
- {
- ::osl::MutexGuard aGuard(m_aMutex);
-
-
- for (auto const& connection : m_aConnections)
- {
- Reference<XInterface > xTemp = connection.first.get();
- ::comphelper::disposeComponent(xTemp);
- }
- m_aConnections.clear();
- TWeakPairVector().swap(m_aConnections);
-
- ODriverDelegator_BASE::disposing();
- }
-
- namespace
- {
- enum class T_DRIVERTYPE
- {
- Odbc,
- Jdbc,
- Native
- };
-
- bool isOdbcUrl(const OUString& _sUrl)
- {
- return _sUrl.startsWith("sdbc:mysql:odbc:");
- }
-
- bool isNativeUrl(const OUString& _sUrl)
- {
- return _sUrl.startsWith("sdbc:mysql:mysqlc:");
- }
-
- T_DRIVERTYPE lcl_getDriverType(const OUString& _sUrl)
- {
- T_DRIVERTYPE eRet = T_DRIVERTYPE::Jdbc;
- if ( isOdbcUrl(_sUrl ) )
- eRet = T_DRIVERTYPE::Odbc;
- else if ( isNativeUrl(_sUrl ) )
- eRet = T_DRIVERTYPE::Native;
- return eRet;
- }
-
- OUString transformUrl(const OUString& _sUrl)
- {
- OUString sNewUrl = _sUrl.copy(11);
- if ( isOdbcUrl( _sUrl ) )
- sNewUrl = "sdbc:" + sNewUrl;
- else if ( isNativeUrl( _sUrl ) )
- sNewUrl = "sdbc:" + sNewUrl;
- else
- {
- sNewUrl = "jdbc:mysql://" + sNewUrl.copy(5);
- }
- return sNewUrl;
- }
-
- Reference< XDriver > lcl_loadDriver(const Reference< XComponentContext >& _rxContext,const OUString& _sUrl)
- {
- Reference<XDriverManager2> xDriverAccess = DriverManager::create(_rxContext);
- Reference< XDriver > xDriver = xDriverAccess->getDriverByURL(_sUrl);
- return xDriver;
- }
-
- Sequence< PropertyValue > lcl_convertProperties(T_DRIVERTYPE _eType,const Sequence< PropertyValue >& info,const OUString& _sUrl)
- {
- std::vector<PropertyValue> aProps;
- const PropertyValue* pSupported = info.getConstArray();
- const PropertyValue* pEnd = pSupported + info.getLength();
-
- aProps.reserve(info.getLength() + 5);
- bool jdc = false;
- for (;pSupported != pEnd; ++pSupported)
- {
- aProps.push_back( *pSupported );
- if (pSupported->Name == "JavaDriverClass")
- {
- jdc = true;
- }
- }
-
- if ( _eType == T_DRIVERTYPE::Odbc )
- {
- aProps.push_back( PropertyValue(
- "Silent"
- ,0
- ,makeAny(true)
- ,PropertyState_DIRECT_VALUE) );
- aProps.push_back( PropertyValue(
- "PreventGetVersionColumns"
- ,0
- ,makeAny(true)
- ,PropertyState_DIRECT_VALUE) );
- }
- else if ( _eType == T_DRIVERTYPE::Jdbc )
- {
- if (!jdc)
- {
- aProps.push_back( PropertyValue(
- "JavaDriverClass"
- ,0
- ,makeAny(OUString("com.mysql.jdbc.Driver"))
- ,PropertyState_DIRECT_VALUE) );
- }
- }
- else
- {
- aProps.push_back( PropertyValue(
- "PublicConnectionURL"
- ,0
- ,makeAny(_sUrl)
- ,PropertyState_DIRECT_VALUE) );
- }
- aProps.push_back( PropertyValue(
- "IsAutoRetrievingEnabled"
- ,0
- ,makeAny(true)
- ,PropertyState_DIRECT_VALUE) );
- aProps.push_back( PropertyValue(
- "AutoRetrievingStatement"
- ,0
- ,makeAny(OUString("SELECT LAST_INSERT_ID()"))
- ,PropertyState_DIRECT_VALUE) );
- aProps.push_back( PropertyValue(
- "ParameterNameSubstitution"
- ,0
- ,makeAny(true)
- ,PropertyState_DIRECT_VALUE) );
- return Sequence< PropertyValue >(aProps.data(), aProps.size());
- }
- }
-
- Reference< XDriver > ODriverDelegator::loadDriver( const OUString& url, const Sequence< PropertyValue >& info )
- {
- Reference< XDriver > xDriver;
- const OUString sCuttedUrl = transformUrl(url);
- const T_DRIVERTYPE eType = lcl_getDriverType( url );
- if ( eType == T_DRIVERTYPE::Odbc )
- {
- if ( !m_xODBCDriver.is() )
- m_xODBCDriver = lcl_loadDriver(m_xContext,sCuttedUrl);
- xDriver = m_xODBCDriver;
- } // if ( bIsODBC )
- else if ( eType == T_DRIVERTYPE::Native )
- {
- if ( !m_xNativeDriver.is() )
- m_xNativeDriver = lcl_loadDriver(m_xContext,sCuttedUrl);
- xDriver = m_xNativeDriver;
- }
- else
- {
- OUString sDriverClass(getJavaDriverClass(info));
- TJDBCDrivers::iterator aFind = m_aJdbcDrivers.find(sDriverClass);
- if ( aFind == m_aJdbcDrivers.end() )
- aFind = m_aJdbcDrivers.emplace(sDriverClass,lcl_loadDriver(m_xContext,sCuttedUrl)).first;
- xDriver = aFind->second;
- }
-
- return xDriver;
- }
-
-
- Reference< XConnection > SAL_CALL ODriverDelegator::connect( const OUString& url, const Sequence< PropertyValue >& info )
- {
- Reference< XConnection > xConnection;
- if ( acceptsURL(url) )
- {
- Reference< XDriver > xDriver;
- xDriver = loadDriver(url,info);
- if ( xDriver.is() )
- {
- OUString sCuttedUrl = transformUrl(url);
- const T_DRIVERTYPE eType = lcl_getDriverType( url );
- Sequence< PropertyValue > aConvertedProperties = lcl_convertProperties(eType,info,url);
- if ( eType == T_DRIVERTYPE::Jdbc )
- {
- ::comphelper::NamedValueCollection aSettings( info );
- OUString sIanaName = aSettings.getOrDefault( "CharSet", OUString() );
- if ( !sIanaName.isEmpty() )
- {
- ::dbtools::OCharsetMap aLookupIanaName;
- ::dbtools::OCharsetMap::const_iterator aLookup = aLookupIanaName.findIanaName(sIanaName);
- if (aLookup != aLookupIanaName.end() )
- {
- OUString sAdd;
- if ( RTL_TEXTENCODING_UTF8 == (*aLookup).getEncoding() )
- {
- static const char s_sCharSetOp[] = "useUnicode=true&";
- if ( !sCuttedUrl.matchIgnoreAsciiCase(s_sCharSetOp) )
- {
- sAdd = s_sCharSetOp;
- } // if ( !sCuttedUrl.matchIgnoreAsciiCase(s_sCharSetOp) )
- } // if ( RTL_TEXTENCODING_UTF8 == (*aLookup).getEncoding() )
- if ( sCuttedUrl.indexOf('?') == -1 )
- sCuttedUrl += "?";
- else
- sCuttedUrl += "&";
- sCuttedUrl += sAdd;
- sCuttedUrl += "characterEncoding=";
- sCuttedUrl += sIanaName;
- }
- }
- } // if ( !bIsODBC )
-
- xConnection = xDriver->connect( sCuttedUrl, aConvertedProperties );
- if ( xConnection.is() )
- {
- OMetaConnection* pMetaConnection = nullptr;
- // now we have to set the URL to get the correct answer for metadata()->getURL()
- Reference< XUnoTunnel> xTunnel(xConnection,UNO_QUERY);
- if ( xTunnel.is() )
- {
- pMetaConnection = reinterpret_cast<OMetaConnection*>(xTunnel->getSomething( OMetaConnection::getUnoTunnelImplementationId() ));
- if ( pMetaConnection )
- pMetaConnection->setURL(url);
- }
- m_aConnections.push_back(TWeakPair(WeakReferenceHelper(xConnection),TWeakConnectionPair(WeakReferenceHelper(),pMetaConnection)));
- }
- }
- }
- return xConnection;
- }
-
-
- sal_Bool SAL_CALL ODriverDelegator::acceptsURL( const OUString& url )
- {
- Sequence< PropertyValue > info;
-
- bool bOK = url.startsWith( "sdbc:mysql:odbc:" )
- || url.startsWith( "sdbc:mysql:jdbc:" )
- || ( url.startsWith( "sdbc:mysql:mysqlc:" )
- && loadDriver( url, info ).is()
- );
- return bOK;
- }
-
-
- Sequence< DriverPropertyInfo > SAL_CALL ODriverDelegator::getPropertyInfo( const OUString& url, const Sequence< PropertyValue >& info )
- {
- std::vector< DriverPropertyInfo > aDriverInfo;
- if ( !acceptsURL(url) )
- return Sequence< DriverPropertyInfo >();
-
- Sequence< OUString > aBoolean(2);
- aBoolean[0] = "0";
- aBoolean[1] = "1";
-
-
- aDriverInfo.push_back(DriverPropertyInfo(
- "CharSet"
- ,"CharSet of the database."
- ,false
- ,OUString()
- ,Sequence< OUString >())
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- "SuppressVersionColumns"
- ,"Display version columns (when available)."
- ,false
- ,"0"
- ,aBoolean)
- );
- const T_DRIVERTYPE eType = lcl_getDriverType( url );
- if ( eType == T_DRIVERTYPE::Jdbc )
- {
- aDriverInfo.push_back(DriverPropertyInfo(
- "JavaDriverClass"
- ,"The JDBC driver class name."
- ,true
- ,getJavaDriverClass(info)
- ,Sequence< OUString >())
- );
- }
- else if ( eType == T_DRIVERTYPE::Native )
- {
- aDriverInfo.push_back(DriverPropertyInfo(
- "LocalSocket"
- ,"The file path of a socket to connect to a local MySQL server."
- ,false
- ,OUString()
- ,Sequence< OUString >())
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- "NamedPipe"
- ,"The name of a pipe to connect to a local MySQL server."
- ,false
- ,OUString()
- ,Sequence< OUString >())
- );
- }
-
- return Sequence< DriverPropertyInfo >(&aDriverInfo[0],aDriverInfo.size());
- }
-
-
- sal_Int32 SAL_CALL ODriverDelegator::getMajorVersion( )
- {
- return 1;
- }
-
-
- sal_Int32 SAL_CALL ODriverDelegator::getMinorVersion( )
- {
- return 0;
- }
-
-
- Reference< XTablesSupplier > SAL_CALL ODriverDelegator::getDataDefinitionByConnection( const Reference< XConnection >& connection )
- {
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(ODriverDelegator_BASE::rBHelper.bDisposed);
-
- Reference< XTablesSupplier > xTab;
- Reference< XUnoTunnel> xTunnel(connection,UNO_QUERY);
- if ( xTunnel.is() )
- {
- OMetaConnection* pConnection = reinterpret_cast<OMetaConnection*>(xTunnel->getSomething( OMetaConnection::getUnoTunnelImplementationId() ));
- if ( pConnection )
- {
- TWeakPairVector::const_iterator aEnd = m_aConnections.end();
- for (TWeakPairVector::iterator i = m_aConnections.begin(); aEnd != i; ++i)
- {
- if ( i->second.second == pConnection )
- {
- xTab.set(i->second.first.get().get(),UNO_QUERY);
- if ( !xTab.is() )
- {
- xTab = new OMySQLCatalog(connection);
- i->second.first = WeakReferenceHelper(xTab);
- }
- break;
- }
- }
- }
- } // if ( xTunnel.is() )
- if ( !xTab.is() )
- {
- TWeakPairVector::const_iterator aEnd = m_aConnections.end();
- for (TWeakPairVector::iterator i = m_aConnections.begin(); aEnd != i; ++i)
- {
- Reference< XConnection > xTemp(i->first.get(),UNO_QUERY);
- if ( xTemp == connection )
- {
- xTab.set(i->second.first.get().get(),UNO_QUERY);
- if ( !xTab.is() )
- {
- xTab = new OMySQLCatalog(connection);
- i->second.first = WeakReferenceHelper(xTab);
- }
- break;
- }
- }
- }
- return xTab;
- }
-
-
- Reference< XTablesSupplier > SAL_CALL ODriverDelegator::getDataDefinitionByURL( const OUString& url, const Sequence< PropertyValue >& info )
- {
- if ( ! acceptsURL(url) )
- {
- ::connectivity::SharedResources aResources;
- const OUString sMessage = aResources.getResourceString(STR_URI_SYNTAX_ERROR);
- ::dbtools::throwGenericSQLException(sMessage ,*this);
- } // if ( ! acceptsURL(url) )
-
- return getDataDefinitionByConnection(connect(url,info));
- }
-
- // XServiceInfo
-
-
- OUString ODriverDelegator::getImplementationName_Static( )
- {
- return OUString("org.openoffice.comp.drivers.MySQL.Driver");
- }
-
- Sequence< OUString > ODriverDelegator::getSupportedServiceNames_Static( )
- {
- Sequence< OUString > aSNS( 2 );
- aSNS[0] = "com.sun.star.sdbc.Driver";
- aSNS[1] = "com.sun.star.sdbcx.Driver";
- return aSNS;
- }
-
- OUString SAL_CALL ODriverDelegator::getImplementationName( )
- {
- return getImplementationName_Static();
- }
-
- sal_Bool SAL_CALL ODriverDelegator::supportsService( const OUString& _rServiceName )
- {
- return cppu::supportsService(this, _rServiceName);
- }
-
- Sequence< OUString > SAL_CALL ODriverDelegator::getSupportedServiceNames( )
- {
- return getSupportedServiceNames_Static();
- }
-
-
-} // namespace connectivity
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mysql/YTable.cxx b/connectivity/source/drivers/mysql/YTable.cxx
deleted file mode 100644
index 7192c2393907..000000000000
--- a/connectivity/source/drivers/mysql/YTable.cxx
+++ /dev/null
@@ -1,356 +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 <string.h>
-#include <mysql/YTable.hxx>
-#include <mysql/YTables.hxx>
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/sdbc/XResultSet.hpp>
-#include <com/sun/star/sdbcx/KeyType.hpp>
-#include <com/sun/star/sdbc/KeyRule.hpp>
-#include <cppuhelper/typeprovider.hxx>
-#include <com/sun/star/lang/DisposedException.hpp>
-#include <com/sun/star/sdbc/ColumnValue.hpp>
-#include <com/sun/star/sdbcx/Privilege.hpp>
-#include <comphelper/property.hxx>
-#include <comphelper/types.hxx>
-#include <connectivity/dbtools.hxx>
-#include <connectivity/sdbcx/VColumn.hxx>
-#include <connectivity/TKeys.hxx>
-#include <connectivity/TIndexes.hxx>
-#include <connectivity/TColumnsHelper.hxx>
-#include <mysql/YCatalog.hxx>
-#include <mysql/YColumns.hxx>
-#include <TConnection.hxx>
-
-
-using namespace ::comphelper;
-using namespace connectivity::mysql;
-using namespace connectivity::sdbcx;
-using namespace connectivity;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::sdbcx;
-using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::lang;
-namespace connectivity
-{
- namespace mysql
- {
- class OMySQLKeysHelper : public OKeysHelper
- {
- protected:
-
- virtual OUString getDropForeignKey() const override
- {
- return OUString(" DROP FOREIGN KEY ");
- }
- public:
- OMySQLKeysHelper( OTableHelper* _pTable,
- ::osl::Mutex& _rMutex,
- const ::std::vector< OUString>& _rVector
- ) : OKeysHelper(_pTable,_rMutex,_rVector){}
-
- };
- }
-}
-
-OMySQLTable::OMySQLTable( sdbcx::OCollection* _pTables,
- const Reference< XConnection >& _xConnection)
- :OTableHelper(_pTables,_xConnection,true)
-{
- // we create a new table here, so we should have all the rights or ;-)
- m_nPrivileges = Privilege::DROP |
- Privilege::REFERENCE |
- Privilege::ALTER |
- Privilege::CREATE |
- Privilege::READ |
- Privilege::DELETE |
- Privilege::UPDATE |
- Privilege::INSERT |
- Privilege::SELECT;
- construct();
-}
-
-OMySQLTable::OMySQLTable( sdbcx::OCollection* _pTables,
- const Reference< XConnection >& _xConnection,
- const OUString& Name,
- const OUString& Type,
- const OUString& Description ,
- const OUString& SchemaName,
- const OUString& CatalogName,
- sal_Int32 _nPrivileges
- ) : OTableHelper( _pTables,
- _xConnection,
- true,
- Name,
- Type,
- Description,
- SchemaName,
- CatalogName)
- , m_nPrivileges(_nPrivileges)
-{
- construct();
-}
-
-void OMySQLTable::construct()
-{
- OTableHelper::construct();
- if ( !isNew() )
- registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRIVILEGES), PROPERTY_ID_PRIVILEGES,PropertyAttribute::READONLY,&m_nPrivileges, cppu::UnoType<decltype(m_nPrivileges)>::get());
-}
-
-::cppu::IPropertyArrayHelper* OMySQLTable::createArrayHelper( sal_Int32 /*_nId*/ ) const
-{
- return doCreateArrayHelper();
-}
-
-::cppu::IPropertyArrayHelper & OMySQLTable::getInfoHelper()
-{
- return *static_cast<OMySQLTable_PROP*>(this)->getArrayHelper(isNew() ? 1 : 0);
-}
-
-sdbcx::OCollection* OMySQLTable::createColumns(const ::std::vector< OUString>& _rNames)
-{
- OMySQLColumns* pColumns = new OMySQLColumns(*this,m_aMutex,_rNames);
- pColumns->setParent(this);
- return pColumns;
-}
-
-sdbcx::OCollection* OMySQLTable::createKeys(const ::std::vector< OUString>& _rNames)
-{
- return new OMySQLKeysHelper(this,m_aMutex,_rNames);
-}
-
-sdbcx::OCollection* OMySQLTable::createIndexes(const ::std::vector< OUString>& _rNames)
-{
- return new OIndexesHelper(this,m_aMutex,_rNames);
-}
-
-Sequence< sal_Int8 > OMySQLTable::getUnoTunnelImplementationId()
-{
- static ::cppu::OImplementationId implId;
-
- return implId.getImplementationId();
-}
-
-// css::lang::XUnoTunnel
-
-sal_Int64 OMySQLTable::getSomething( const Sequence< sal_Int8 > & rId )
-{
- return (rId.getLength() == 16 && 0 == memcmp(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) )
- ? reinterpret_cast< sal_Int64 >( this )
- : OTable_TYPEDEF::getSomething(rId);
-}
-
-// XAlterTable
-void SAL_CALL OMySQLTable::alterColumnByName( const OUString& colName, const Reference< XPropertySet >& descriptor )
-{
- ::osl::MutexGuard aGuard(m_aMutex);
- checkDisposed(
-#ifdef __GNUC__
- ::connectivity::sdbcx::OTableDescriptor_BASE::rBHelper.bDisposed
-#else
- rBHelper.bDisposed
-#endif
- );
-
- if ( !m_xColumns || !m_xColumns->hasByName(colName) )
- throw NoSuchElementException(colName,*this);
-
-
- if ( !isNew() )
- {
- // first we have to check what should be altered
- Reference<XPropertySet> xProp;
- m_xColumns->getByName(colName) >>= xProp;
- // first check the types
- sal_Int32 nOldType = 0,nNewType = 0,nOldPrec = 0,nNewPrec = 0,nOldScale = 0,nNewScale = 0;
-
- ::dbtools::OPropertyMap& rProp = OMetaConnection::getPropMap();
- xProp->getPropertyValue(rProp.getNameByIndex(PROPERTY_ID_TYPE)) >>= nOldType;
- descriptor->getPropertyValue(rProp.getNameByIndex(PROPERTY_ID_TYPE)) >>= nNewType;
- // and precisions and scale
- xProp->getPropertyValue(rProp.getNameByIndex(PROPERTY_ID_PRECISION)) >>= nOldPrec;
- descriptor->getPropertyValue(rProp.getNameByIndex(PROPERTY_ID_PRECISION))>>= nNewPrec;
- xProp->getPropertyValue(rProp.getNameByIndex(PROPERTY_ID_SCALE)) >>= nOldScale;
- descriptor->getPropertyValue(rProp.getNameByIndex(PROPERTY_ID_SCALE)) >>= nNewScale;
- // second: check the "is nullable" value
- sal_Int32 nOldNullable = 0,nNewNullable = 0;
- xProp->getPropertyValue(rProp.getNameByIndex(PROPERTY_ID_ISNULLABLE)) >>= nOldNullable;
- descriptor->getPropertyValue(rProp.getNameByIndex(PROPERTY_ID_ISNULLABLE)) >>= nNewNullable;
-
- // check also the auto_increment
- bool bOldAutoIncrement = false,bAutoIncrement = false;
- xProp->getPropertyValue(rProp.getNameByIndex(PROPERTY_ID_ISAUTOINCREMENT)) >>= bOldAutoIncrement;
- descriptor->getPropertyValue(rProp.getNameByIndex(PROPERTY_ID_ISAUTOINCREMENT)) >>= bAutoIncrement;
- bool bColumnNameChanged = false;
- OUString sOldDesc,sNewDesc;
- xProp->getPropertyValue(rProp.getNameByIndex(PROPERTY_ID_DESCRIPTION)) >>= sOldDesc;
- descriptor->getPropertyValue(rProp.getNameByIndex(PROPERTY_ID_DESCRIPTION)) >>= sNewDesc;
-
- if ( nOldType != nNewType
- || nOldPrec != nNewPrec
- || nOldScale != nNewScale
- || nNewNullable != nOldNullable
- || bOldAutoIncrement != bAutoIncrement
- || sOldDesc != sNewDesc )
- {
- // special handling because they changed the type names to distinguish
- // if a column should be an auto_incmrement one
- if ( bOldAutoIncrement != bAutoIncrement )
- {
- OUString sTypeName;
- descriptor->getPropertyValue(rProp.getNameByIndex(PROPERTY_ID_TYPENAME)) >>= sTypeName;
-
- static const char s_sAutoIncrement[] = "auto_increment";
- if ( bAutoIncrement )
- {
- if ( sTypeName.indexOf(s_sAutoIncrement) == -1 )
- {
- sTypeName += " ";
- sTypeName += s_sAutoIncrement;
- }
- }
- else
- {
- sal_Int32 nIndex = 0;
- if ( !sTypeName.isEmpty() && (nIndex = sTypeName.indexOf(s_sAutoIncrement)) != -1 )
- {
- sTypeName = sTypeName.copy(0,nIndex);
- descriptor->setPropertyValue(rProp.getNameByIndex(PROPERTY_ID_TYPENAME),makeAny(sTypeName));
- }
- }
- }
- alterColumnType(nNewType,colName,descriptor);
- bColumnNameChanged = true;
- }
-
- // third: check the default values
- OUString sNewDefault,sOldDefault;
- xProp->getPropertyValue(rProp.getNameByIndex(PROPERTY_ID_DEFAULTVALUE)) >>= sOldDefault;
- descriptor->getPropertyValue(rProp.getNameByIndex(PROPERTY_ID_DEFAULTVALUE)) >>= sNewDefault;
-
- if(!sOldDefault.isEmpty())
- {
- dropDefaultValue(colName);
- if(!sNewDefault.isEmpty() && sOldDefault != sNewDefault)
- alterDefaultValue(sNewDefault,colName);
- }
- else if(!sNewDefault.isEmpty())
- alterDefaultValue(sNewDefault,colName);
-
- // now we should look if the name of the column changed
- OUString sNewColumnName;
- descriptor->getPropertyValue(rProp.getNameByIndex(PROPERTY_ID_NAME)) >>= sNewColumnName;
- if ( !sNewColumnName.equalsIgnoreAsciiCase(colName) && !bColumnNameChanged )
- {
- const OUString sQuote = getMetaData()->getIdentifierQuoteString( );
- OUString sSql = getAlterTableColumnPart() +
- " CHANGE " + ::dbtools::quoteName(sQuote,colName) +
- " " + OTables::adjustSQL(::dbtools::createStandardColumnPart(descriptor,getConnection(),static_cast<OTables*>(m_pTables),getTypeCreatePattern()));
- executeStatement(sSql);
- }
- m_xColumns->refresh();
- }
- else
- {
- if(m_xColumns)
- {
- m_xColumns->dropByName(colName);
- m_xColumns->appendByDescriptor(descriptor);
- }
- }
-
-}
-
-void OMySQLTable::alterColumnType(sal_Int32 nNewType,const OUString& _rColName, const Reference<XPropertySet>& _xDescriptor)
-{
- const OUString sQuote = getMetaData()->getIdentifierQuoteString( );
- OUString sSql = getAlterTableColumnPart() +
- " CHANGE " + ::dbtools::quoteName(sQuote,_rColName) +
- " ";
-
- OColumn* pColumn = new OColumn(true);
- Reference<XPropertySet> xProp = pColumn;
- ::comphelper::copyProperties(_xDescriptor,xProp);
- xProp->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE),makeAny(nNewType));
-
- sSql += OTables::adjustSQL(::dbtools::createStandardColumnPart(xProp,getConnection(),static_cast<OTables*>(m_pTables),getTypeCreatePattern()));
- executeStatement(sSql);
-}
-
-OUString OMySQLTable::getTypeCreatePattern() const
-{
- return OUString("(M,D)");
-}
-
-void OMySQLTable::alterDefaultValue(const OUString& _sNewDefault,const OUString& _rColName)
-{
- const OUString sQuote = getMetaData()->getIdentifierQuoteString( );
- OUString sSql = getAlterTableColumnPart() +
- " ALTER " + ::dbtools::quoteName(sQuote,_rColName) +
- " SET DEFAULT '" + _sNewDefault + "'";
-
- executeStatement(sSql);
-}
-
-void OMySQLTable::dropDefaultValue(const OUString& _rColName)
-{
- const OUString sQuote = getMetaData()->getIdentifierQuoteString( );
- OUString sSql = getAlterTableColumnPart() +
- " ALTER " + ::dbtools::quoteName(sQuote,_rColName) +
- " DROP DEFAULT";
-
- executeStatement(sSql);
-}
-
-OUString OMySQLTable::getAlterTableColumnPart()
-{
- OUString sSql( "ALTER TABLE " );
-
- OUString sComposedName(
- ::dbtools::composeTableName( getMetaData(), m_CatalogName, m_SchemaName, m_Name, true, ::dbtools::EComposeRule::InTableDefinitions ) );
- sSql += sComposedName;
-
- return sSql;
-}
-
-void OMySQLTable::executeStatement(const OUString& _rStatement )
-{
- OUString sSQL = _rStatement;
- if(sSQL.endsWith(","))
- sSQL = sSQL.replaceAt(sSQL.getLength()-1, 1, ")");
-
- Reference< XStatement > xStmt = getConnection()->createStatement( );
- if ( xStmt.is() )
- {
- xStmt->execute(sSQL);
- ::comphelper::disposeComponent(xStmt);
- }
-}
-
-OUString OMySQLTable::getRenameStart() const
-{
- return OUString("RENAME TABLE ");
-}
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mysql/YTables.cxx b/connectivity/source/drivers/mysql/YTables.cxx
deleted file mode 100644
index 55077af30426..000000000000
--- a/connectivity/source/drivers/mysql/YTables.cxx
+++ /dev/null
@@ -1,216 +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 <mysql/YTables.hxx>
-#include <mysql/YViews.hxx>
-#include <mysql/YTable.hxx>
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/sdbc/XResultSet.hpp>
-#include <com/sun/star/sdbc/ColumnValue.hpp>
-#include <com/sun/star/sdbcx/Privilege.hpp>
-#include <com/sun/star/sdbc/KeyRule.hpp>
-#include <com/sun/star/sdbcx/KeyType.hpp>
-#include <mysql/YCatalog.hxx>
-#include <connectivity/dbtools.hxx>
-#include <connectivity/dbexception.hxx>
-#include <cppuhelper/interfacecontainer.h>
-#include <comphelper/types.hxx>
-#include <TConnection.hxx>
-
-using namespace ::comphelper;
-using namespace connectivity;
-using namespace ::cppu;
-using namespace connectivity::mysql;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::sdbcx;
-using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::lang;
-using namespace dbtools;
-
-sdbcx::ObjectType OTables::createObject(const OUString& _rName)
-{
- OUString sCatalog,sSchema,sTable;
- ::dbtools::qualifiedNameComponents(m_xMetaData,_rName,sCatalog,sSchema,sTable,::dbtools::EComposeRule::InDataManipulation);
-
- Sequence< OUString > sTableTypes(3);
- sTableTypes[0] = "VIEW";
- sTableTypes[1] = "TABLE";
- sTableTypes[2] = "%"; // just to be sure to include anything else ....
-
- Any aCatalog;
- if ( !sCatalog.isEmpty() )
- aCatalog <<= sCatalog;
- Reference< XResultSet > xResult = m_xMetaData->getTables(aCatalog,sSchema,sTable,sTableTypes);
-
- sdbcx::ObjectType xRet = nullptr;
- if ( xResult.is() )
- {
- Reference< XRow > xRow(xResult,UNO_QUERY);
- if ( xResult->next() ) // there can be only one table with this name
- {
- sal_Int32 const nPrivileges = Privilege::DROP |
- Privilege::REFERENCE |
- Privilege::ALTER |
- Privilege::CREATE |
- Privilege::READ |
- Privilege::DELETE |
- Privilege::UPDATE |
- Privilege::INSERT |
- Privilege::SELECT;
-
- OMySQLTable* pRet = new OMySQLTable( this
- ,static_cast<OMySQLCatalog&>(m_rParent).getConnection()
- ,sTable
- ,xRow->getString(4)
- ,xRow->getString(5)
- ,sSchema
- ,sCatalog
- ,nPrivileges);
- xRet = pRet;
- }
- ::comphelper::disposeComponent(xResult);
- }
-
- return xRet;
-}
-
-void OTables::impl_refresh( )
-{
- static_cast<OMySQLCatalog&>(m_rParent).refreshTables();
-}
-
-void OTables::disposing()
-{
-m_xMetaData.clear();
- OCollection::disposing();
-}
-
-Reference< XPropertySet > OTables::createDescriptor()
-{
- return new OMySQLTable(this,static_cast<OMySQLCatalog&>(m_rParent).getConnection());
-}
-
-// XAppend
-sdbcx::ObjectType OTables::appendObject( const OUString& _rForName, const Reference< XPropertySet >& descriptor )
-{
- createTable(descriptor);
- return createObject( _rForName );
-}
-
-// XDrop
-void OTables::dropObject(sal_Int32 _nPos,const OUString& _sElementName)
-{
- Reference< XInterface > xObject( getObject( _nPos ) );
- bool bIsNew = connectivity::sdbcx::ODescriptor::isNew( xObject );
- if (!bIsNew)
- {
- Reference< XConnection > xConnection = static_cast<OMySQLCatalog&>(m_rParent).getConnection();
-
-
- OUString sCatalog,sSchema,sTable;
- ::dbtools::qualifiedNameComponents(m_xMetaData,_sElementName,sCatalog,sSchema,sTable,::dbtools::EComposeRule::InDataManipulation);
-
- OUString aSql( "DROP " );
-
- Reference<XPropertySet> xProp(xObject,UNO_QUERY);
- bool bIsView = xProp.is() && ::comphelper::getString(xProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE))) == "VIEW";
- if(bIsView) // here we have a view
- aSql += "VIEW ";
- else
- aSql += "TABLE ";
-
- OUString sComposedName(
- ::dbtools::composeTableName( m_xMetaData, sCatalog, sSchema, sTable, true, ::dbtools::EComposeRule::InDataManipulation ) );
- aSql += sComposedName;
- Reference< XStatement > xStmt = xConnection->createStatement( );
- if ( xStmt.is() )
- {
- xStmt->execute(aSql);
- ::comphelper::disposeComponent(xStmt);
- }
- // if no exception was thrown we must delete it from the views
- if ( bIsView )
- {
- OViews* pViews = static_cast<OViews*>(static_cast<OMySQLCatalog&>(m_rParent).getPrivateViews());
- if ( pViews && pViews->hasByName(_sElementName) )
- pViews->dropByNameImpl(_sElementName);
- }
- }
-}
-
-OUString OTables::adjustSQL(const OUString& _sSql)
-{
- OUString sSQL = _sSql;
- static const char s_sUNSIGNED[] = "UNSIGNED";
- sal_Int32 nIndex = sSQL.indexOf(s_sUNSIGNED);
- while(nIndex != -1 )
- {
- sal_Int32 nParen = sSQL.indexOf(')',nIndex);
- sal_Int32 nPos = nIndex + strlen(s_sUNSIGNED);
- OUString sNewUnsigned( sSQL.copy(nPos,nParen - nPos + 1));
- sSQL = sSQL.replaceAt(nIndex, strlen(s_sUNSIGNED) + sNewUnsigned.getLength(), sNewUnsigned + s_sUNSIGNED);
- nIndex = sSQL.indexOf(s_sUNSIGNED,nIndex + strlen(s_sUNSIGNED) + sNewUnsigned.getLength());
- }
- return sSQL;
-}
-
-void OTables::createTable( const Reference< XPropertySet >& descriptor )
-{
- const Reference< XConnection > xConnection = static_cast<OMySQLCatalog&>(m_rParent).getConnection();
- const OUString aSql = adjustSQL(::dbtools::createSqlCreateTableStatement(descriptor,xConnection, this, "(M,D)"));
- Reference< XStatement > xStmt = xConnection->createStatement( );
- if ( xStmt.is() )
- {
- xStmt->execute(aSql);
- ::comphelper::disposeComponent(xStmt);
- }
-}
-
-void OTables::appendNew(const OUString& _rsNewTable)
-{
- insertElement(_rsNewTable,nullptr);
-
- // notify our container listeners
- ContainerEvent aEvent(static_cast<XContainer*>(this), makeAny(_rsNewTable), Any(), Any());
- OInterfaceIteratorHelper2 aListenerLoop(m_aContainerListeners);
- while (aListenerLoop.hasMoreElements())
- static_cast<XContainerListener*>(aListenerLoop.next())->elementInserted(aEvent);
-}
-
-OUString OTables::getNameForObject(const sdbcx::ObjectType& _xObject)
-{
- OSL_ENSURE(_xObject.is(),"OTables::getNameForObject: Object is NULL!");
- return ::dbtools::composeTableName( m_xMetaData, _xObject, ::dbtools::EComposeRule::InDataManipulation, false );
-}
-
-void OTables::addComment(const Reference< XPropertySet >& descriptor,OUStringBuffer& _rOut)
-{
- OUString sDesc;
- descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DESCRIPTION)) >>= sDesc;
- if ( !sDesc.isEmpty() )
- {
- _rOut.append(" COMMENT '");
- _rOut.append(sDesc);
- _rOut.append("'");
- }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mysql/YUser.cxx b/connectivity/source/drivers/mysql/YUser.cxx
deleted file mode 100644
index bc9c8c55b22e..000000000000
--- a/connectivity/source/drivers/mysql/YUser.cxx
+++ /dev/null
@@ -1,320 +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 <mysql/YUser.hxx>
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/sdbc/XResultSet.hpp>
-#include <connectivity/dbtools.hxx>
-#include <connectivity/dbexception.hxx>
-#include <com/sun/star/sdbcx/Privilege.hpp>
-#include <com/sun/star/sdbcx/PrivilegeObject.hpp>
-#include <TConnection.hxx>
-#include <strings.hrc>
-
-using namespace connectivity;
-using namespace connectivity::mysql;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::sdbcx;
-using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::lang;
-
-OMySQLUser::OMySQLUser( const css::uno::Reference< css::sdbc::XConnection >& _xConnection) : connectivity::sdbcx::OUser(true)
- ,m_xConnection(_xConnection)
-{
- construct();
-}
-
-OMySQLUser::OMySQLUser( const css::uno::Reference< css::sdbc::XConnection >& _xConnection,
- const OUString& Name
- ) : connectivity::sdbcx::OUser(Name,true)
- ,m_xConnection(_xConnection)
-{
- construct();
-}
-
-void OMySQLUser::refreshGroups()
-{
-}
-
-OUserExtend::OUserExtend( const css::uno::Reference< css::sdbc::XConnection >& _xConnection) : OMySQLUser(_xConnection)
-{
- construct();
-}
-
-void OUserExtend::construct()
-{
- registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PASSWORD), PROPERTY_ID_PASSWORD,0,&m_Password,::cppu::UnoType<OUString>::get());
-}
-
-cppu::IPropertyArrayHelper* OUserExtend::createArrayHelper() const
-{
- Sequence< Property > aProps;
- describeProperties(aProps);
- return new cppu::OPropertyArrayHelper(aProps);
-}
-
-cppu::IPropertyArrayHelper & OUserExtend::getInfoHelper()
-{
- return *OUserExtend_PROP::getArrayHelper();
-}
-typedef connectivity::sdbcx::OUser_BASE OUser_BASE_RBHELPER;
-
-sal_Int32 SAL_CALL OMySQLUser::getPrivileges( const OUString& objName, sal_Int32 objType )
-{
- ::osl::MutexGuard aGuard(m_aMutex);
- checkDisposed(OUser_BASE_RBHELPER::rBHelper.bDisposed);
-
- sal_Int32 nRights,nRightsWithGrant;
- findPrivilegesAndGrantPrivileges(objName,objType,nRights,nRightsWithGrant);
- return nRights;
-}
-
-void OMySQLUser::findPrivilegesAndGrantPrivileges(const OUString& objName, sal_Int32 objType,sal_Int32& nRights,sal_Int32& nRightsWithGrant)
-{
- nRightsWithGrant = nRights = 0;
- // first we need to create the sql stmt to select the privs
- Reference<XDatabaseMetaData> xMeta = m_xConnection->getMetaData();
- OUString sCatalog,sSchema,sTable;
- ::dbtools::qualifiedNameComponents(xMeta,objName,sCatalog,sSchema,sTable,::dbtools::EComposeRule::InDataManipulation);
- Reference<XResultSet> xRes;
- switch(objType)
- {
- case PrivilegeObject::TABLE:
- case PrivilegeObject::VIEW:
- {
- Any aCatalog;
- if ( !sCatalog.isEmpty() )
- aCatalog <<= sCatalog;
- xRes = xMeta->getTablePrivileges(aCatalog,sSchema,sTable);
- }
- break;
-
- case PrivilegeObject::COLUMN:
- {
- Any aCatalog;
- if ( !sCatalog.isEmpty() )
- aCatalog <<= sCatalog;
- xRes = xMeta->getColumnPrivileges(aCatalog,sSchema,sTable, "%");
- }
- break;
- }
-
- if ( xRes.is() )
- {
- static const char sYes [] = "YES";
-
- nRightsWithGrant = nRights = 0;
-
- Reference<XRow> xCurrentRow(xRes,UNO_QUERY);
- while( xCurrentRow.is() && xRes->next() )
- {
- OUString sGrantee = xCurrentRow->getString(5);
- OUString sPrivilege = xCurrentRow->getString(6);
- OUString sGrantable = xCurrentRow->getString(7);
-
- if (!m_Name.equalsIgnoreAsciiCase(sGrantee))
- continue;
-
- if (sPrivilege.equalsIgnoreAsciiCase("SELECT"))
- {
- nRights |= Privilege::SELECT;
- if ( sGrantable.equalsIgnoreAsciiCase(sYes) )
- nRightsWithGrant |= Privilege::SELECT;
- }
- else if (sPrivilege.equalsIgnoreAsciiCase("INSERT"))
- {
- nRights |= Privilege::INSERT;
- if ( sGrantable.equalsIgnoreAsciiCase(sYes) )
- nRightsWithGrant |= Privilege::INSERT;
- }
- else if (sPrivilege.equalsIgnoreAsciiCase("UPDATE"))
- {
- nRights |= Privilege::UPDATE;
- if ( sGrantable.equalsIgnoreAsciiCase(sYes) )
- nRightsWithGrant |= Privilege::UPDATE;
- }
- else if (sPrivilege.equalsIgnoreAsciiCase("DELETE"))
- {
- nRights |= Privilege::DELETE;
- if ( sGrantable.equalsIgnoreAsciiCase(sYes) )
- nRightsWithGrant |= Privilege::DELETE;
- }
- else if (sPrivilege.equalsIgnoreAsciiCase("READ"))
- {
- nRights |= Privilege::READ;
- if ( sGrantable.equalsIgnoreAsciiCase(sYes) )
- nRightsWithGrant |= Privilege::READ;
- }
- else if (sPrivilege.equalsIgnoreAsciiCase("CREATE"))
- {
- nRights |= Privilege::CREATE;
- if ( sGrantable.equalsIgnoreAsciiCase(sYes) )
- nRightsWithGrant |= Privilege::CREATE;
- }
- else if (sPrivilege.equalsIgnoreAsciiCase("ALTER"))
- {
- nRights |= Privilege::ALTER;
- if ( sGrantable.equalsIgnoreAsciiCase(sYes) )
- nRightsWithGrant |= Privilege::ALTER;
- }
- else if (sPrivilege.equalsIgnoreAsciiCase("REFERENCES"))
- {
- nRights |= Privilege::REFERENCE;
- if ( sGrantable.equalsIgnoreAsciiCase(sYes) )
- nRightsWithGrant |= Privilege::REFERENCE;
- }
- else if (sPrivilege.equalsIgnoreAsciiCase("DROP"))
- {
- nRights |= Privilege::DROP;
- if ( sGrantable.equalsIgnoreAsciiCase(sYes) )
- nRightsWithGrant |= Privilege::DROP;
- }
- }
- ::comphelper::disposeComponent(xRes);
- }
-}
-
-sal_Int32 SAL_CALL OMySQLUser::getGrantablePrivileges( const OUString& objName, sal_Int32 objType )
-{
- ::osl::MutexGuard aGuard(m_aMutex);
- checkDisposed(OUser_BASE_RBHELPER::rBHelper.bDisposed);
-
- sal_Int32 nRights,nRightsWithGrant;
- findPrivilegesAndGrantPrivileges(objName,objType,nRights,nRightsWithGrant);
- return nRightsWithGrant;
-}
-
-void SAL_CALL OMySQLUser::grantPrivileges( const OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges )
-{
- if ( objType != PrivilegeObject::TABLE )
- {
- ::connectivity::SharedResources aResources;
- const OUString sError( aResources.getResourceString(STR_PRIVILEGE_NOT_GRANTED));
- ::dbtools::throwGenericSQLException(sError,*this);
- } // if ( objType != PrivilegeObject::TABLE )
-
- ::osl::MutexGuard aGuard(m_aMutex);
-
- OUString sPrivs = getPrivilegeString(objPrivileges);
- if(!sPrivs.isEmpty())
- {
- Reference<XDatabaseMetaData> xMeta = m_xConnection->getMetaData();
- OUString sGrant = "GRANT " + sPrivs +
- " ON " + ::dbtools::quoteTableName(xMeta,objName,::dbtools::EComposeRule::InDataManipulation) +
- " TO " + m_Name;
-
- Reference<XStatement> xStmt = m_xConnection->createStatement();
- if(xStmt.is())
- xStmt->execute(sGrant);
- ::comphelper::disposeComponent(xStmt);
- }
-}
-
-void SAL_CALL OMySQLUser::revokePrivileges( const OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges )
-{
- if ( objType != PrivilegeObject::TABLE )
- {
- ::connectivity::SharedResources aResources;
- const OUString sError( aResources.getResourceString(STR_PRIVILEGE_NOT_REVOKED));
- ::dbtools::throwGenericSQLException(sError,*this);
- }
-
- ::osl::MutexGuard aGuard(m_aMutex);
- checkDisposed(OUser_BASE_RBHELPER::rBHelper.bDisposed);
- OUString sPrivs = getPrivilegeString(objPrivileges);
- if(!sPrivs.isEmpty())
- {
- Reference<XDatabaseMetaData> xMeta = m_xConnection->getMetaData();
- OUString sGrant = "REVOKE " + sPrivs +
- " ON " + ::dbtools::quoteTableName(xMeta,objName,::dbtools::EComposeRule::InDataManipulation) +
- " FROM " + m_Name;
-
- Reference<XStatement> xStmt = m_xConnection->createStatement();
- if(xStmt.is())
- xStmt->execute(sGrant);
- ::comphelper::disposeComponent(xStmt);
- }
-}
-
-// XUser
-void SAL_CALL OMySQLUser::changePassword( const OUString& /*oldPassword*/, const OUString& newPassword )
-{
- ::osl::MutexGuard aGuard(m_aMutex);
- checkDisposed(OUser_BASE_RBHELPER::rBHelper.bDisposed);
- OUString sAlterPwd = "SET PASSWORD FOR " +
- m_Name + "@\"%\" = PASSWORD('" +
- newPassword + "')";
-
-
- Reference<XStatement> xStmt = m_xConnection->createStatement();
- if ( xStmt.is() )
- {
- xStmt->execute(sAlterPwd);
- ::comphelper::disposeComponent(xStmt);
- }
-}
-
-OUString OMySQLUser::getPrivilegeString(sal_Int32 nRights)
-{
- OUString sPrivs;
- if((nRights & Privilege::INSERT) == Privilege::INSERT)
- sPrivs += "INSERT";
-
- if((nRights & Privilege::DELETE) == Privilege::DELETE)
- {
- if(!sPrivs.isEmpty())
- sPrivs += ",";
- sPrivs += "DELETE";
- }
-
- if((nRights & Privilege::UPDATE) == Privilege::UPDATE)
- {
- if(!sPrivs.isEmpty())
- sPrivs += ",";
- sPrivs += "UPDATE";
- }
-
- if((nRights & Privilege::ALTER) == Privilege::ALTER)
- {
- if(!sPrivs.isEmpty())
- sPrivs += ",";
- sPrivs += "ALTER";
- }
-
- if((nRights & Privilege::SELECT) == Privilege::SELECT)
- {
- if(!sPrivs.isEmpty())
- sPrivs += ",";
- sPrivs += "SELECT";
- }
-
- if((nRights & Privilege::REFERENCE) == Privilege::REFERENCE)
- {
- if(!sPrivs.isEmpty())
- sPrivs += ",";
- sPrivs += "REFERENCES";
- }
-
- return sPrivs;
-}
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mysql/YUsers.cxx b/connectivity/source/drivers/mysql/YUsers.cxx
deleted file mode 100644
index d6982b8c985b..000000000000
--- a/connectivity/source/drivers/mysql/YUsers.cxx
+++ /dev/null
@@ -1,105 +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 <mysql/YUsers.hxx>
-#include <mysql/YUser.hxx>
-#include <mysql/YTable.hxx>
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/sdbc/XResultSet.hpp>
-#include <connectivity/sdbcx/IRefreshable.hxx>
-#include <comphelper/types.hxx>
-#include <connectivity/dbexception.hxx>
-#include <connectivity/dbtools.hxx>
-#include <TConnection.hxx>
-
-using namespace ::comphelper;
-using namespace connectivity;
-using namespace connectivity::mysql;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::lang;
-
-OUsers::OUsers( ::cppu::OWeakObject& _rParent,
- ::osl::Mutex& _rMutex,
- const ::std::vector< OUString> &_rVector,
- const css::uno::Reference< css::sdbc::XConnection >& _xConnection,
- connectivity::sdbcx::IRefreshableUsers* _pParent)
- : sdbcx::OCollection(_rParent, true, _rMutex, _rVector)
- ,m_xConnection(_xConnection)
- ,m_pParent(_pParent)
-{
-}
-
-
-sdbcx::ObjectType OUsers::createObject(const OUString& _rName)
-{
- return new OMySQLUser(m_xConnection,_rName);
-}
-
-void OUsers::impl_refresh()
-{
- m_pParent->refreshUsers();
-}
-
-Reference< XPropertySet > OUsers::createDescriptor()
-{
- OUserExtend* pNew = new OUserExtend(m_xConnection);
- return pNew;
-}
-
-// XAppend
-sdbcx::ObjectType OUsers::appendObject( const OUString& _rForName, const Reference< XPropertySet >& descriptor )
-{
- OUString aSql( "GRANT USAGE ON * TO " );
- OUString aQuote = m_xConnection->getMetaData()->getIdentifierQuoteString( );
- aSql += ::dbtools::quoteName(aQuote,_rForName) + " @\"%\" ";
- OUString sPassword;
- descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PASSWORD)) >>= sPassword;
- if ( !sPassword.isEmpty() )
- {
- aSql += " IDENTIFIED BY '";
- aSql += sPassword;
- aSql += "'";
- }
-
- Reference< XStatement > xStmt = m_xConnection->createStatement( );
- if(xStmt.is())
- xStmt->execute(aSql);
- ::comphelper::disposeComponent(xStmt);
-
- return createObject( _rForName );
-}
-
-// XDrop
-void OUsers::dropObject(sal_Int32 /*_nPos*/,const OUString& _sElementName)
-{
- OUString aSql( "DROP USER " );
- OUString aQuote = m_xConnection->getMetaData()->getIdentifierQuoteString( );
- aSql += ::dbtools::quoteName(aQuote,_sElementName);
-
- Reference< XStatement > xStmt = m_xConnection->createStatement( );
- if(xStmt.is())
- xStmt->execute(aSql);
- ::comphelper::disposeComponent(xStmt);
-}
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mysql/YViews.cxx b/connectivity/source/drivers/mysql/YViews.cxx
deleted file mode 100644
index c6a3c2800073..000000000000
--- a/connectivity/source/drivers/mysql/YViews.cxx
+++ /dev/null
@@ -1,151 +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 <mysql/YViews.hxx>
-#include <mysql/YTables.hxx>
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/sdbc/XResultSet.hpp>
-#include <com/sun/star/sdbc/ColumnValue.hpp>
-#include <com/sun/star/sdbc/KeyRule.hpp>
-#include <com/sun/star/sdbcx/KeyType.hpp>
-#include <com/sun/star/sdbcx/CheckOption.hpp>
-#include <mysql/YCatalog.hxx>
-#include <connectivity/dbtools.hxx>
-#include <connectivity/dbexception.hxx>
-#include <cppuhelper/interfacecontainer.h>
-#include <connectivity/sdbcx/VView.hxx>
-#include <comphelper/types.hxx>
-#include <TConnection.hxx>
-
-using namespace ::comphelper;
-
-using namespace ::cppu;
-using namespace connectivity;
-using namespace connectivity::mysql;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::sdbcx;
-using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::lang;
-using namespace dbtools;
-typedef connectivity::sdbcx::OCollection OCollection_TYPE;
-
-sdbcx::ObjectType OViews::createObject(const OUString& _rName)
-{
- OUString sCatalog,sSchema,sTable;
- ::dbtools::qualifiedNameComponents(m_xMetaData,
- _rName,
- sCatalog,
- sSchema,
- sTable,
- ::dbtools::EComposeRule::InDataManipulation);
- return new ::connectivity::sdbcx::OView(isCaseSensitive(),
- sTable,
- m_xMetaData,
- OUString(),
- sSchema,
- sCatalog
- );
-}
-
-void OViews::impl_refresh( )
-{
- static_cast<OMySQLCatalog&>(m_rParent).refreshTables();
-}
-
-void OViews::disposing()
-{
-m_xMetaData.clear();
- OCollection::disposing();
-}
-
-Reference< XPropertySet > OViews::createDescriptor()
-{
- Reference<XConnection> xConnection = static_cast<OMySQLCatalog&>(m_rParent).getConnection();
- connectivity::sdbcx::OView* pNew = new connectivity::sdbcx::OView(true, xConnection->getMetaData());
- return pNew;
-}
-
-// XAppend
-sdbcx::ObjectType OViews::appendObject( const OUString& _rForName, const Reference< XPropertySet >& descriptor )
-{
- createView(descriptor);
- return createObject( _rForName );
-}
-
-// XDrop
-void OViews::dropObject(sal_Int32 _nPos,const OUString& /*_sElementName*/)
-{
- if ( m_bInDrop )
- return;
-
- Reference< XInterface > xObject( getObject( _nPos ) );
- bool bIsNew = connectivity::sdbcx::ODescriptor::isNew( xObject );
- if (!bIsNew)
- {
- OUString aSql( "DROP VIEW" );
-
- Reference<XPropertySet> xProp(xObject,UNO_QUERY);
- aSql += ::dbtools::composeTableName( m_xMetaData, xProp, ::dbtools::EComposeRule::InTableDefinitions, true );
-
- Reference<XConnection> xConnection = static_cast<OMySQLCatalog&>(m_rParent).getConnection();
- Reference< XStatement > xStmt = xConnection->createStatement( );
- xStmt->execute(aSql);
- ::comphelper::disposeComponent(xStmt);
- }
-}
-
-void OViews::dropByNameImpl(const OUString& elementName)
-{
- m_bInDrop = true;
- OCollection_TYPE::dropByName(elementName);
- m_bInDrop = false;
-}
-
-void OViews::createView( const Reference< XPropertySet >& descriptor )
-{
- Reference<XConnection> xConnection = static_cast<OMySQLCatalog&>(m_rParent).getConnection();
-
- OUString aSql( "CREATE VIEW " );
- OUString sCommand;
-
- aSql += ::dbtools::composeTableName( m_xMetaData, descriptor, ::dbtools::EComposeRule::InTableDefinitions, true );
-
- aSql += " AS ";
- descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_COMMAND)) >>= sCommand;
- aSql += sCommand;
-
- Reference< XStatement > xStmt = xConnection->createStatement( );
- if ( xStmt.is() )
- {
- xStmt->execute(aSql);
- ::comphelper::disposeComponent(xStmt);
- }
-
- // insert the new view also in the tables collection
- OTables* pTables = static_cast<OTables*>(static_cast<OMySQLCatalog&>(m_rParent).getPrivateTables());
- if ( pTables )
- {
- OUString sName = ::dbtools::composeTableName( m_xMetaData, descriptor, ::dbtools::EComposeRule::InDataManipulation, false );
- pTables->appendNew(sName);
- }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mysql/Yservices.cxx b/connectivity/source/drivers/mysql/Yservices.cxx
deleted file mode 100644
index b08ce3425255..000000000000
--- a/connectivity/source/drivers/mysql/Yservices.cxx
+++ /dev/null
@@ -1,69 +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 <mysql/YDriver.hxx>
-#include <cppuhelper/factory.hxx>
-
-using namespace connectivity::mysql;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Sequence;
-using ::com::sun::star::lang::XSingleServiceFactory;
-using ::com::sun::star::lang::XMultiServiceFactory;
-
-typedef Reference< XSingleServiceFactory > (*createFactoryFunc)
- (
- const Reference< XMultiServiceFactory > & rServiceManager,
- const OUString & rComponentName,
- ::cppu::ComponentInstantiation pCreateFunction,
- const Sequence< OUString > & rServiceNames,
- rtl_ModuleCount*
- );
-
-extern "C" SAL_DLLPUBLIC_EXPORT void* mysql_component_getFactory(
- const sal_Char* pImplementationName,
- void* pServiceManager,
- void* /*pRegistryKey*/)
-{
- if (!pServiceManager)
- {
- return nullptr;
- }
-
- Reference< XSingleServiceFactory > xRet;
- const Reference< XMultiServiceFactory > xServiceManager( static_cast<XMultiServiceFactory*>(pServiceManager) );
- const OUString sImplementationName( OUString::createFromAscii(pImplementationName) );
-
- if( ODriverDelegator::getImplementationName_Static() == sImplementationName )
- try
- {
- xRet = ::cppu::createSingleFactory( xServiceManager, sImplementationName, ODriverDelegator_CreateInstance,
- ODriverDelegator::getSupportedServiceNames_Static());
- }
- catch(...)
- {
- }
-
- if(xRet.is())
- xRet->acquire();
-
- return xRet.get();
-};
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mysql/mysql.component b/connectivity/source/drivers/mysql/mysql.component
deleted file mode 100644
index 9c3e7ad7c6cd..000000000000
--- a/connectivity/source/drivers/mysql/mysql.component
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * 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 .
- -->
-
-<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
- prefix="mysql" xmlns="http://openoffice.org/2010/uno-components">
- <implementation name="org.openoffice.comp.drivers.MySQL.Driver">
- <service name="com.sun.star.sdbc.Driver"/>
- <service name="com.sun.star.sdbcx.Driver"/>
- </implementation>
-</component>
diff --git a/mysqlc/source/DataAccess.xcu b/connectivity/source/drivers/mysqlc/DataAccess.xcu
similarity index 100%
rename from mysqlc/source/DataAccess.xcu
rename to connectivity/source/drivers/mysqlc/DataAccess.xcu
diff --git a/mysqlc/source/META-INF/manifest.xml b/connectivity/source/drivers/mysqlc/META-INF/manifest.xml
similarity index 100%
rename from mysqlc/source/META-INF/manifest.xml
rename to connectivity/source/drivers/mysqlc/META-INF/manifest.xml
diff --git a/mysqlc/source/description-en-US.txt b/connectivity/source/drivers/mysqlc/description-en-US.txt
similarity index 100%
rename from mysqlc/source/description-en-US.txt
rename to connectivity/source/drivers/mysqlc/description-en-US.txt
diff --git a/mysqlc/source/description.xml b/connectivity/source/drivers/mysqlc/description.xml
similarity index 100%
rename from mysqlc/source/description.xml
rename to connectivity/source/drivers/mysqlc/description.xml
diff --git a/mysqlc/source/mysqlc.component b/connectivity/source/drivers/mysqlc/mysqlc.component
similarity index 100%
rename from mysqlc/source/mysqlc.component
rename to connectivity/source/drivers/mysqlc/mysqlc.component
diff --git a/mysqlc/source/mysqlc_connection.cxx b/connectivity/source/drivers/mysqlc/mysqlc_connection.cxx
similarity index 50%
rename from mysqlc/source/mysqlc_connection.cxx
rename to connectivity/source/drivers/mysqlc/mysqlc_connection.cxx
index 1b3169845e19..74c68b2dbe11 100644
--- a/mysqlc/source/mysqlc_connection.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_connection.cxx
@@ -21,18 +21,11 @@
#include "mysqlc_connection.hxx"
#include "mysqlc_databasemetadata.hxx"
-
#include "mysqlc_driver.hxx"
#include "mysqlc_statement.hxx"
#include "mysqlc_preparedstatement.hxx"
#include "mysqlc_general.hxx"
-#include <cppconn/driver.h>
-#include <cppconn/connection.h>
-#include <cppconn/statement.h>
-#include <cppconn/metadata.h>
-#include <cppconn/exception.h>
-
#include <com/sun/star/sdbc/ColumnValue.hpp>
#include <com/sun/star/sdbc/XRow.hpp>
#include <com/sun/star/sdbc/TransactionIsolation.hpp>
@@ -42,6 +35,8 @@
#include <osl/module.hxx>
#include <osl/thread.h>
#include <osl/file.h>
+#include <sal/log.hxx>
+#include <osl/diagnose.h>
#include <rtl/uri.hxx>
#include <rtl/ustrbuf.hxx>
@@ -49,7 +44,6 @@ using namespace connectivity::mysqlc;
#include <stdio.h>
-
using namespace com::sun::star::uno;
using namespace com::sun::star::container;
using namespace com::sun::star::lang;
@@ -57,44 +51,44 @@ using namespace com::sun::star::beans;
using namespace com::sun::star::sdbc;
using ::osl::MutexGuard;
-
#define MYSQLC_URI_PREFIX "sdbc:mysqlc:"
-
namespace
{
- void lcl_executeUpdate(MYSQL* pMySql, const rtl::OString& sql)
- {
- mysql_real_query(pMySql, sql.getStr(), sql.getLength());
- // TODO handle error
- }
+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)
+ : OMetaConnection_BASE(m_aMutex)
+ , m_xMetaData(nullptr)
+ , m_xDriver(&_rDriver)
{
- mysql_init(&m_mysql);
-
- // use TCP as connection
- mysql_protocol_type protocol = MYSQL_PROTOCOL_TCP;
- mysql_options(&m_mysql, MYSQL_OPT_PROTOCOL, &protocol);
}
OConnection::~OConnection()
{
- if (!isClosed()) {
+ if (!isClosed())
+ {
close();
}
}
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list