summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladimir Glazunov <vg@openoffice.org>2010-02-15 15:27:59 +0100
committerVladimir Glazunov <vg@openoffice.org>2010-02-15 15:27:59 +0100
commit130d648f21ad0b9456716a66b92b641b5a1e309d (patch)
treeb25b516977246ee04b9a3a1618dbda30d511c224
parent6163dce52f006f6f5a390eebd000caeaa1c70854 (diff)
parent2b78c56c7d895ab11ecf67734a8e509ee68a8e73 (diff)
CWS-TOOLING: integrate CWS mysqlconnector
-rw-r--r--mysqlc/images/sun_extension.pngbin0 -> 1965 bytes
-rw-r--r--mysqlc/images/sun_extension_hc.pngbin0 -> 1160 bytes
-rw-r--r--mysqlc/prj/build.lst3
-rw-r--r--mysqlc/prj/d.lst4
-rw-r--r--mysqlc/source/DataAccess.xcu19
-rw-r--r--mysqlc/source/README65
-rw-r--r--mysqlc/source/delzip0
-rw-r--r--mysqlc/source/description.xml29
-rw-r--r--mysqlc/source/description/description_de.txt1
-rw-r--r--mysqlc/source/description/description_en-US.txt1
-rw-r--r--mysqlc/source/description/description_es.txt1
-rw-r--r--mysqlc/source/description/description_fr.txt1
-rw-r--r--mysqlc/source/description/description_hu.txt1
-rw-r--r--mysqlc/source/description/description_it.txt1
-rw-r--r--mysqlc/source/description/description_ja.txt1
-rw-r--r--mysqlc/source/description/description_ko.txt1
-rw-r--r--mysqlc/source/description/description_nl.txt1
-rw-r--r--mysqlc/source/description/description_pl.txt1
-rw-r--r--mysqlc/source/description/description_pt-BR.txt1
-rw-r--r--mysqlc/source/description/description_pt.txt1
-rw-r--r--mysqlc/source/description/description_ru.txt1
-rw-r--r--mysqlc/source/description/description_sv.txt1
-rw-r--r--mysqlc/source/description/description_zh-CN.txt1
-rw-r--r--mysqlc/source/description/description_zh-TW.txt1
-rw-r--r--mysqlc/source/exports.dxp3
-rw-r--r--mysqlc/source/makefile.mk332
-rw-r--r--mysqlc/source/manifest.xml8
-rw-r--r--mysqlc/source/mysqlc.map8
-rw-r--r--mysqlc/source/mysqlc.xml81
-rw-r--r--mysqlc/source/mysqlc_connection.cxx791
-rw-r--r--mysqlc/source/mysqlc_connection.hxx250
-rw-r--r--mysqlc/source/mysqlc_databasemetadata.cxx2215
-rw-r--r--mysqlc/source/mysqlc_databasemetadata.hxx243
-rw-r--r--mysqlc/source/mysqlc_driver.cxx368
-rw-r--r--mysqlc/source/mysqlc_driver.hxx118
-rw-r--r--mysqlc/source/mysqlc_general.cxx176
-rw-r--r--mysqlc/source/mysqlc_general.hxx66
-rw-r--r--mysqlc/source/mysqlc_preparedstatement.cxx944
-rw-r--r--mysqlc/source/mysqlc_preparedstatement.hxx194
-rw-r--r--mysqlc/source/mysqlc_propertyids.cxx210
-rw-r--r--mysqlc/source/mysqlc_propertyids.hxx136
-rw-r--r--mysqlc/source/mysqlc_resultset.cxx1509
-rw-r--r--mysqlc/source/mysqlc_resultset.hxx337
-rw-r--r--mysqlc/source/mysqlc_resultsetmetadata.cxx468
-rw-r--r--mysqlc/source/mysqlc_resultsetmetadata.hxx121
-rw-r--r--mysqlc/source/mysqlc_services.cxx183
-rw-r--r--mysqlc/source/mysqlc_statement.cxx531
-rw-r--r--mysqlc/source/mysqlc_statement.hxx187
-rw-r--r--mysqlc/source/mysqlc_subcomponent.hxx255
-rw-r--r--mysqlc/source/mysqlc_types.cxx792
-rw-r--r--mysqlc/source/mysqlc_types.hxx56
-rw-r--r--mysqlc/source/registry/data/org/openoffice/Office/DataAccess/Drivers.xcu103
-rw-r--r--mysqlc/version.mk38
53 files changed, 10859 insertions, 0 deletions
diff --git a/mysqlc/images/sun_extension.png b/mysqlc/images/sun_extension.png
new file mode 100644
index 000000000000..31f48ea8fb69
--- /dev/null
+++ b/mysqlc/images/sun_extension.png
Binary files differ
diff --git a/mysqlc/images/sun_extension_hc.png b/mysqlc/images/sun_extension_hc.png
new file mode 100644
index 000000000000..3870cc4709d4
--- /dev/null
+++ b/mysqlc/images/sun_extension_hc.png
Binary files differ
diff --git a/mysqlc/prj/build.lst b/mysqlc/prj/build.lst
new file mode 100644
index 000000000000..636c4876826c
--- /dev/null
+++ b/mysqlc/prj/build.lst
@@ -0,0 +1,3 @@
+mc mysqlc : solenv MYSQLCPPCONN:mysqlcppconn offuh cppu soltools cppuhelper readlicense_oo NULL
+ch mysqlc usr1 - all mc_mkout NULL
+mc mysqlc\source nmake - all mc_source NULL
diff --git a/mysqlc/prj/d.lst b/mysqlc/prj/d.lst
new file mode 100644
index 000000000000..dc6ba44ab37d
--- /dev/null
+++ b/mysqlc/prj/d.lst
@@ -0,0 +1,4 @@
+# Extensions
+
+..\%__SRC%\bin\*.oxt %_DEST%\bin%_EXT%\*.oxt
+
diff --git a/mysqlc/source/DataAccess.xcu b/mysqlc/source/DataAccess.xcu
new file mode 100644
index 000000000000..1c70d36f1680
--- /dev/null
+++ b/mysqlc/source/DataAccess.xcu
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<oor:node xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" oor:name="DataAccess" oor:package="org.openoffice.Office">
+ <node oor:name="UserDefinedDriverSettings">
+ <node oor:name="org.openoffice.comp.connectivity.mysql_native.Driver" oor:op="replace">
+ <prop oor:name="DriverName">
+ <value>org.openoffice.comp.connectivity.mysql_native.Driver</value>
+ </prop>
+ <prop oor:name="DriverPageDisplayName">
+ <value>MySQL native driver</value>
+ </prop>
+ <prop oor:name="DriverTypeDisplayName">
+ <value>MySQL native driver</value>
+ </prop>
+ <prop oor:name="DriverDsnPrefix">
+ <value>sdbc:mysqlc:</value>
+ </prop>
+ </node>
+ </node>
+</oor:node>
diff --git a/mysqlc/source/README b/mysqlc/source/README
new file mode 100644
index 000000000000..1166dde27971
--- /dev/null
+++ b/mysqlc/source/README
@@ -0,0 +1,65 @@
+---------- Status -------------------------------------------------------------
+
+The code is on a PREVIEW level. PREVIEW means pre-alpha.
+
+---------- Requirements -------------------------------------------------------
+
+The MySQL driver for OpenOffice.org (MySQL Connector/OpenOffice.org - C/OOo)
+requires two external libraries to be build:
+
+ 1) The MySQL Client Library (libmysql)
+ 2) The MySQL Connector/C++ Library (libmysqlcppcon)
+
+At the time of writing neither of the two libraries are part of the CWS!
+Before you can build the MySQL driver for OpenOffice.org you must install
+the two required libraries on your system before you can compile the driver.
+
+You need the two libraries because the MySQL driver for OpenOffice.org
+does not feature an implementation of the MySQL Client Server
+communication protocol. The protocol implementation is part of the MySQL
+Client Library. And the SDBC(X) style OpenOffice.org driver is implemented as a
+wrapper of the MySQL Connector/C++ Library which implements a JDBC interface and
+in turn uses the C based MySQL Client Library.
+
+1) MySQL Client Library (libmysql)
+
+The MySQL Client Library (libmysql) is part of the MySQL Server. You need to
+download and install the MySQL Server. Use a binary distribution of
+MySQL 5.0.x or MySQL 5.1.x. Check the MySQL manual for instructions, e.g.
+for Unix:
+
+ http://dev.mysql.com/doc/refman/5.1/en/installing-binary.html
+
+The typical installation path of the libmysql.so on Unix is
+/usr/local/mysql/lib/mysql/ .
+
+2) MySQL Connector/C++ (libmysqlcppcon)
+
+Download and install the latest version of the MySQL Connector/C++, see
+http://forge.mysql.com/wiki/Connector_C++ . Check out the source
+from the bzr repository.
+
+3) Tweaking library paths
+
+At the time of writing you might have to *manually* tweak library paths and
+library names by patching makefile.mk. This is a temporary hack. The makefile
+will be improved later.
+
+However, for the moment check the makefile.mk if the compilation fails due to
+"missing" libraries (= libraries not found). For example, check the following
+settings:
+
+ MYSQL_INCDIR=/usr/local/include
+ MYSQL_LIBDIR=/usr/local/lib
+ [...]
+ MYSQL_INCDIR=/usr/local/include
+ MYSQL_LIBDIR=/usr/local/lib
+ [...]
+ MYSQL_INC=-I$(MYSQL_INCDIR)
+ MYSQL_LIB=-L$(MYSQL_LIBDIR) -lmysqlclient -rdynamic -lz -lcrypt -lnsl -lm
+ MYSQL_LIBFILE=$(MYSQL_LIBDIR)$/libmysqlclient.so.16
+ MYSQL_CPPCONN_LIBFILE=$(MYSQL_LIBDIR)$/libmysqlcppconn.so
+ [...]
+
+A common issue is libmysqlclient.so.15 vs. libmysqlclient.so.16 .
+
diff --git a/mysqlc/source/delzip b/mysqlc/source/delzip
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/mysqlc/source/delzip
diff --git a/mysqlc/source/description.xml b/mysqlc/source/description.xml
new file mode 100644
index 000000000000..e5a17a11851a
--- /dev/null
+++ b/mysqlc/source/description.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<description xmlns="http://openoffice.org/extensions/description/2006" xmlns:d="http://openoffice.org/extensions/description/2006"
+ xmlns:xlink="http://www.w3.org/1999/xlink">
+
+ <identifier value="UPDATED_IDENTIFIER"/>
+ <version value="#VERSION#" />
+ <platform value="UPDATED_SUPPORTED_PLATFORM" />
+ <registration>
+ <simple-license accept-by="admin" default-license-id="lic-en-US" >
+ <license-text xlink:href="licensefile" lang="isocode" license-id="lic-isocode"/>
+ </simple-license>
+ </registration>
+ <display-name>
+ <name lang="en-US">#TITLE#</name>
+ </display-name>
+ <dependencies>
+ <OpenOffice.org-minimal-version value="3.1" d:name="OpenOffice.org 3.1"/>
+ </dependencies>
+ <publisher>
+ <name xlink:href="http://www.sun.com/software/star/staroffice/extensions.jsp?cid=925095" lang="en">Sun Microsystems</name>
+ </publisher>
+ <icon>
+ <default xlink:href="images/sun_extension.png" />
+ <high-contrast xlink:href="images/sun_extension_hc.png" />
+ </icon>
+ <extension-description>
+ <src lang="#LANG#" xlink:href="description/description_#LANG#.txt"/>
+ </extension-description>
+</description>
diff --git a/mysqlc/source/description/description_de.txt b/mysqlc/source/description/description_de.txt
new file mode 100644
index 000000000000..acdaea342571
--- /dev/null
+++ b/mysqlc/source/description/description_de.txt
@@ -0,0 +1 @@
+Verbindet OpenOffice.org direkt mit MySQL-Servern \ No newline at end of file
diff --git a/mysqlc/source/description/description_en-US.txt b/mysqlc/source/description/description_en-US.txt
new file mode 100644
index 000000000000..e149658af7de
--- /dev/null
+++ b/mysqlc/source/description/description_en-US.txt
@@ -0,0 +1 @@
+Connects OpenOffice.org directly with MySQL Servers
diff --git a/mysqlc/source/description/description_es.txt b/mysqlc/source/description/description_es.txt
new file mode 100644
index 000000000000..9e04c85fbd84
--- /dev/null
+++ b/mysqlc/source/description/description_es.txt
@@ -0,0 +1 @@
+Conecta OpenOffice.org directamente con los servidores de MySQL \ No newline at end of file
diff --git a/mysqlc/source/description/description_fr.txt b/mysqlc/source/description/description_fr.txt
new file mode 100644
index 000000000000..ca3073273834
--- /dev/null
+++ b/mysqlc/source/description/description_fr.txt
@@ -0,0 +1 @@
+Connexion directe d'OpenOffice.org avec les serveurs MySQL. \ No newline at end of file
diff --git a/mysqlc/source/description/description_hu.txt b/mysqlc/source/description/description_hu.txt
new file mode 100644
index 000000000000..0b60de706018
--- /dev/null
+++ b/mysqlc/source/description/description_hu.txt
@@ -0,0 +1 @@
+Közvetlen kapcsolatot teremt az OpenOffice.org és a MySQL-kiszolgálók között. \ No newline at end of file
diff --git a/mysqlc/source/description/description_it.txt b/mysqlc/source/description/description_it.txt
new file mode 100644
index 000000000000..36326e214bf6
--- /dev/null
+++ b/mysqlc/source/description/description_it.txt
@@ -0,0 +1 @@
+Consente la connessione diretta tra OpenOffice.org e i server MySQL \ No newline at end of file
diff --git a/mysqlc/source/description/description_ja.txt b/mysqlc/source/description/description_ja.txt
new file mode 100644
index 000000000000..3d6a70eb9489
--- /dev/null
+++ b/mysqlc/source/description/description_ja.txt
@@ -0,0 +1 @@
+OpenOffice.org を MySQL サーバーと直接に接続させる \ No newline at end of file
diff --git a/mysqlc/source/description/description_ko.txt b/mysqlc/source/description/description_ko.txt
new file mode 100644
index 000000000000..6b4ca29be8ce
--- /dev/null
+++ b/mysqlc/source/description/description_ko.txt
@@ -0,0 +1 @@
+MySQL 서버를 통해 OpenOffice.org에 직접 연결합니다. \ No newline at end of file
diff --git a/mysqlc/source/description/description_nl.txt b/mysqlc/source/description/description_nl.txt
new file mode 100644
index 000000000000..1405fd0b2ff1
--- /dev/null
+++ b/mysqlc/source/description/description_nl.txt
@@ -0,0 +1 @@
+Verbindt OpenOffice.org direct met MySQL Servers \ No newline at end of file
diff --git a/mysqlc/source/description/description_pl.txt b/mysqlc/source/description/description_pl.txt
new file mode 100644
index 000000000000..03e0f23bbc99
--- /dev/null
+++ b/mysqlc/source/description/description_pl.txt
@@ -0,0 +1 @@
+Laczy witryne OpenOffice.org bezposrednio z systemem MySQL Servers \ No newline at end of file
diff --git a/mysqlc/source/description/description_pt-BR.txt b/mysqlc/source/description/description_pt-BR.txt
new file mode 100644
index 000000000000..21d3ba28a5da
--- /dev/null
+++ b/mysqlc/source/description/description_pt-BR.txt
@@ -0,0 +1 @@
+Conecta o OpenOffice.org diretamente aos servidores MySQL \ No newline at end of file
diff --git a/mysqlc/source/description/description_pt.txt b/mysqlc/source/description/description_pt.txt
new file mode 100644
index 000000000000..1f05c487e03e
--- /dev/null
+++ b/mysqlc/source/description/description_pt.txt
@@ -0,0 +1 @@
+Liga o OpenOffice.org directamente aos servidores MySQL \ No newline at end of file
diff --git a/mysqlc/source/description/description_ru.txt b/mysqlc/source/description/description_ru.txt
new file mode 100644
index 000000000000..633b2c9514df
--- /dev/null
+++ b/mysqlc/source/description/description_ru.txt
@@ -0,0 +1 @@
+Подключает OpenOffice.org напрямую к серверам MySQL
diff --git a/mysqlc/source/description/description_sv.txt b/mysqlc/source/description/description_sv.txt
new file mode 100644
index 000000000000..d7fc80975763
--- /dev/null
+++ b/mysqlc/source/description/description_sv.txt
@@ -0,0 +1 @@
+Ansluter OpenOffice.org direkt till MySQL-servrarna \ No newline at end of file
diff --git a/mysqlc/source/description/description_zh-CN.txt b/mysqlc/source/description/description_zh-CN.txt
new file mode 100644
index 000000000000..c38bc47a41a8
--- /dev/null
+++ b/mysqlc/source/description/description_zh-CN.txt
@@ -0,0 +1 @@
+将 OpenOffice.org 与 MySQL 服务器直接相连 \ No newline at end of file
diff --git a/mysqlc/source/description/description_zh-TW.txt b/mysqlc/source/description/description_zh-TW.txt
new file mode 100644
index 000000000000..de628909d369
--- /dev/null
+++ b/mysqlc/source/description/description_zh-TW.txt
@@ -0,0 +1 @@
+將 OpenOffice.org 直接連線至 MySQL 伺服器 \ No newline at end of file
diff --git a/mysqlc/source/exports.dxp b/mysqlc/source/exports.dxp
new file mode 100644
index 000000000000..9630d7e06768
--- /dev/null
+++ b/mysqlc/source/exports.dxp
@@ -0,0 +1,3 @@
+component_getImplementationEnvironment
+component_writeInfo
+component_getFactory
diff --git a/mysqlc/source/makefile.mk b/mysqlc/source/makefile.mk
new file mode 100644
index 000000000000..ff1c8c83f7c4
--- /dev/null
+++ b/mysqlc/source/makefile.mk
@@ -0,0 +1,332 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2008 by Sun Microsystems, Inc.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ=..
+PRJNAME=mysqlc
+
+.INCLUDE : $(PRJ)$/version.mk
+
+TARGET=mysqlc
+ENABLE_EXCEPTIONS=TRUE
+LIBTARGET=NO
+EXTENSIONNAME:=mysql-connector-ooo
+
+.IF "$(SYSTEM_MYSQL)" == "YES"
+EXTERNAL_WARNINGS_NOT_ERRORS = TRUE
+.ENDIF
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+#-------------------------------------------------------------------
+
+#---- extension version
+EXTENSION_VERSION_BASE=$(MYSQLC_VERSION_MAJOR).$(MYSQLC_VERSION_MINOR).$(MYSQLC_VERSION_MICRO)
+.IF ( "$(CWS_WORK_STAMP)" == "" ) || ( "$(UPDATER)" == "YES" )
+ EXTENSION_VERSION=$(EXTENSION_VERSION_BASE)
+.ELSE
+ EXTENSION_VERSION=$(EXTENSION_VERSION_BASE).cws.$(CWS_WORK_STAMP)
+.ENDIF
+
+#---- extension title package name
+.IF "$(MYSQLC_STATUS)" == "final"
+ EXTENSION_TITLE:=$(MYSQLC_TITLE)
+ EXTENSION_ZIPNAME:=$(EXTENSIONNAME)-$(EXTENSION_VERSION_BASE)-$(RTL_OS:l)-$(RTL_ARCH:l)
+.ELSE
+ EXTENSION_TITLE:=$(MYSQLC_TITLE) ($(MYSQLC_STATUS))
+ EXTENSION_ZIPNAME:=$(EXTENSIONNAME)-$(EXTENSION_VERSION_BASE)-$(MYSQLC_STATUS:s/ /-/:l)-$(RTL_OS:l)-$(RTL_ARCH:l)
+.ENDIF
+
+#-------------------------------------------------------------------
+
+# set default symbol visibility / scope to hidden
+.IF "$(COMNAME)" == "gcc3"
+.IF "$(HAVE_GCC_VISIBILITY_FEATURE)" == "TRUE"
+ CFLAGS += -fvisibility=hidden
+.ENDIF # HAVE_GCC_VISIBILITY_FEATURE
+.ENDIF # gcc3
+
+.IF "$(COMNAME)" == "sunpro5"
+.IF "$(CCNUMVER)" >= "00050005"
+ CFLAGS += -xldscope=hidden
+.ENDIF # 5.5
+.ENDIF # sunpro5
+
+#-------------------------------------------------------------------
+
+# The headers delivered from C/C++ have a habit of putting a ";" after the closing bracked of a namespace, which
+# yields a warning with Solaris' compiler. Until this is fixed in C/C++, silence this warning
+.IF "$(OS)" == "SOLARIS"
+ CFLAGSWARNCXX+=,wemptydecl
+ CFLAGSWARNCXX:=$(CFLAGSWARNCXX:s/ ,/,/)
+.ENDIF
+
+#-------------------------------------------------------------------
+.IF "$(ENABLE_MYSQLC)" != "YES"
+@all:
+ @echo "Mysql native driver extension build disabled."
+.ENDIF
+
+# use the static version
+.IF "$(GUI)"=="WNT"
+ MYSQL_LIBDIR=$(LIBMYSQL_PATH)$/lib
+ MYSQL_INCDIR=$(LIBMYSQL_PATH)$/include
+.ELSE
+ .IF "$(SYSTEM_MYSQL)" != "YES"
+ MYSQL_LIBDIR=$(LIBMYSQL_PATH)$/lib
+ MYSQL_INCDIR=$(LIBMYSQL_PATH)$/include
+ .ENDIF
+.ENDIF
+
+.IF "$(SYSTEM_MYSQL)" == "YES"
+CFLAGS+=-DSYSTEM_MYSQL
+.ENDIF
+
+.IF "$(SYSTEM_MYSQL_CPPCONN)" == "YES"
+CFLAGS+=-DSYSTEM_MYSQL_CPPCONN
+.ENDIF
+
+CDEFS+=-DCPPDBC_EXPORTS -DCPPCONN_LIB_BUILD
+.IF "$(SYSTEM_MYSQL_CPPCONN)" != "YES"
+CDEFS += -DCPPCONN_LIB=\"$(DLLPRE)mysqlcppconn$(DLLPOST)\"
+.ELSE
+CDEFS += -DCPPCONN_LIB=\"$(shell readlink /usr/lib/libmysqlcppconn.so)\"
+.ENDIF
+
+# --------------- MySQL settings ------------------
+.IF "$(GUI)"=="WNT"
+ MYSQL_INC=-I$(SOLARINCDIR)$/mysqlcppconn -I$(SOLARINCDIR)$/mysqlcppconn/cppconn -I$(MYSQL_INCDIR)
+ MYSQL_LIB=$(MYSQL_LIBDIR)$/libmysql.lib
+ MYSQL_LIBFILE=$(MYSQL_LIBDIR)$/libmysql.dll
+ MYSQL_CPPCONNFILE=$(SOLARBINDIR)$/$(DLLPRE)mysqlcppconn$(DLLPOST)
+.ELSE
+ .IF "$(SYSTEM_MYSQL)" != "YES"
+ MYSQL_INC+=-I$(MYSQL_INCDIR)
+ .IF "$(OS)"=="MACOSX"
+ MYSQL_LIBFILE=$(MYSQL_LIBDIR)$/$(DLLPRE)mysql.16$(DLLPOST)
+ .ELSE
+ MYSQL_LIBFILE=$(MYSQL_LIBDIR)$/$(DLLPRE)mysql$(DLLPOST).16
+ .ENDIF
+
+ # checkdll will complain if we do not point it to the libmysql lib
+ EXTRALIBPATHS=-L$(MYSQL_LIBDIR)
+ .ENDIF
+
+ .IF "$(SYSTEM_MYSQL_CPPCONN)" != "YES"
+ .IF "$(OS)"=="MACOSX" || "$(OS)" == "SOLARIS"
+ MYSQL_LIB+=-lz -lm
+ .ELSE
+ MYSQL_LIB+=-rdynamic -lz -lcrypt -lnsl -lm
+ .ENDIF
+ MYSQL_CPPCONNFILE=$(SOLARLIBDIR)$/$(DLLPRE)mysqlcppconn$(DLLPOST)
+ .ELSE
+ MYSQL_CPPCONN_LIB+=-lmysqlcppconn
+ .ENDIF
+.ENDIF
+
+.IF "$(SYSTEM_MYSQL_CPPCONN)" != "YES"
+ MYSQL_INC+=-I$(SOLARINCDIR)$/mysqlcppconn -I$(SOLARINCDIR)$/mysqlcppconn/cppconn
+.ENDIF
+
+CFLAGS+=-I..$/..$/inc $(MYSQL_INC) \
+ -DMYSQLC_VERSION_MAJOR=$(MYSQLC_VERSION_MAJOR) \
+ -DMYSQLC_VERSION_MINOR=$(MYSQLC_VERSION_MINOR) \
+ -DMYSQLC_VERSION_MICRO=$(MYSQLC_VERSION_MICRO) \
+ $(MYSQL_DEFINES)
+
+# provide the name of the MySQL client lib to the C++ code
+.IF "$(SYSTEM_MYSQL)" != "YES"
+CDEFS += -DMYSQL_LIB=\"$(MYSQL_LIBFILE:f)\"
+.ENDIF
+
+#--------------------------------------------------
+
+SHL1DLLPRE=
+SHL1TARGET=$(TARGET).uno
+LIB1TARGET=$(SLB)$/$(SHL1TARGET).lib
+LIB1OBJFILES= \
+ $(SLO)$/mysqlc_driver.obj \
+ $(SLO)$/mysqlc_services.obj \
+ $(SLO)$/mysqlc_connection.obj \
+ $(SLO)$/mysqlc_resultset.obj \
+ $(SLO)$/mysqlc_resultsetmetadata.obj \
+ $(SLO)$/mysqlc_statement.obj \
+ $(SLO)$/mysqlc_preparedstatement.obj \
+ $(SLO)$/mysqlc_databasemetadata.obj \
+ $(SLO)$/mysqlc_types.obj \
+ $(SLO)$/mysqlc_general.obj \
+ $(SLO)$/mysqlc_propertyids.obj
+
+SHL1STDLIBS= \
+ $(MYSQL_LIB) \
+ $(MYSQL_CPPCONN_LIB) \
+ $(CPPULIB) \
+ $(SALLIB) \
+ $(SALHELPERLIB) \
+ $(CPPUHELPERLIB)
+
+SHL1VERSIONMAP=$(TARGET).map
+SHL1LIBS= $(LIB1TARGET)
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+SHL1RPATH=OXT
+DEF1NAME= $(SHL1TARGET)
+
+# create Extension -----------------------------
+
+# DESCRIPTION_SRC is the source file which is copied into the extension
+# It is defaulted to "description.xml", but we want to pre-process it, so we use an intermediate
+# file
+DESCRIPTION_SRC = $(MISC)$/description.xml
+
+COMPONENT_XCU=\
+ registry$/data$/org$/openoffice$/Office$/DataAccess$/Drivers.xcu
+
+COMPONENT_MERGED_XCU= \
+ $(foreach,i,$(COMPONENT_XCU) $(EXTENSIONDIR)$/$i)
+
+COMPONENT_LIBRARY = \
+ $(EXTENSIONDIR)$/$(SHL1TARGET)$(DLLPOST)
+
+COMPONENT_MYSQL_LIBFILE = \
+ $(EXTENSIONDIR)$/$(MYSQL_LIBFILE:f)
+
+COMPONENT_MYSQL_CPPCONN_FILE=\
+ $(EXTENSIONDIR)$/$(MYSQL_CPPCONNFILE:f)
+
+COMPONENT_LIBRARIES=\
+ $(COMPONENT_LIBRARY)
+
+COMPONENT_IMAGES= \
+ $(EXTENSIONDIR)$/images$/sun_extension.png \
+ $(EXTENSIONDIR)$/images$/sun_extension_hc.png
+
+
+# ........ component description ........
+# one file for each WITH_LANG token
+DESC_LANGS=$(WITH_LANG)
+.IF "$(DESC_LANGS)" == ""
+ DESC_LANGS=en-US
+.ENDIF
+COMPONENT_DESCRIPTIONS=$/$(foreach,lang,$(DESC_LANGS) description$/description_$(lang).txt)
+COMPONENT_DESCRIPTIONS_PACKDEP= \
+ $(foreach,i,$(COMPONENT_DESCRIPTIONS) $(EXTENSIONDIR)$/$i)
+
+# WITH_LANG might contain languages which we actually do not have a description for (yet)
+# Find those, and treat the specially
+
+# first, find those locales which we actually have a description file for
+EXISTING_DESCRIPTIONS=$(foreach,i,$(shell $(FIND) .$/description -name "description_*.txt") $(i:f))
+EXISTING_LANGS=$(foreach,i,$(EXISTING_DESCRIPTIONS) $(i:s,description_,,:s,.txt,,))
+
+# then, create a version of WITH_LANG where we stripped all those locales
+EXISTING_LANGS_NORMALIZED=$(strip $(EXISTING_LANGS))
+EXISTING_LANGS_NORMALIZED:=+$(EXISTING_LANGS_NORMALIZED:s/ /+/)+
+MISSING_LANGS=$(foreach,lang,$(WITH_LANG) $(eq,$(EXISTING_LANGS_NORMALIZED:s/+$(lang)+//),$(EXISTING_LANGS_NORMALIZED) $(lang) ))
+
+# ........ dependencies for packaging the extension ........
+EXTENSION_PACKDEPS=makefile.mk $(COMPONENT_IMAGES) $(COMPONENT_DESCRIPTIONS_PACKDEP) $(COMPONENT_MERGED_XCU)
+
+.IF "$(SYSTEM_MYSQL)" != "YES"
+EXTENSION_PACKDEPS+=$(COMPONENT_MYSQL_LIBFILE)
+.ENDIF
+
+.IF "$(SYSTEM_MYSQL_CPPCONN)" != "YES"
+EXTENSION_PACKDEPS+=$(COMPONENT_MYSQL_CPPCONN_FILE)
+.ENDIF
+
+# --- Targets ------------------------------------------------------
+.INCLUDE : extension_pre.mk
+.INCLUDE : target.mk
+.INCLUDE : extension_post.mk
+
+$(EXTENSIONDIR)$/images$/%.png : $(PRJ)$/images$/%.png
+ @@-$(MKDIRHIER) $(@:d)
+ @$(COPY) $< $@ > $(NULLDEV)
+
+# existing descriptions: just copy
+$(EXTENSIONDIR)$/description$/%.txt: .$/description$/%.txt
+ @@-$(MKDIRHIER) $(@:d)
+ @$(COPY) $< $@ > $(NULLDEV)
+
+# xcu files: copy
+# the following is a hack for now - need to find out the generic mechanism later
+
+$(EXTENSIONDIR)$/registry$/data$/org$/openoffice$/Office$/DataAccess$/Drivers.xcu : .$/registry$/data$/org$/openoffice$/Office$/DataAccess$/Drivers.xcu
+ @@-$(MKDIRHIER) $(EXTENSIONDIR)$/registry$/data$/org$/openoffice$/Office$/DataAccess
+ @$(COPY) $< $(EXTENSIONDIR)$/registry$/data$/org$/openoffice$/Office$/DataAccess$/Drivers.xcu > $(NULLDEV)
+
+# The below doesn't work - it's completely beyond me .... $@ is some strange path when echoed, so the whole construct
+# doesn't work .... :(
+
+#$(foreach,i,$(COMPONENT_XCU) $(EXTENSIONDIR)$/$i : $i)
+# @echo -----------------
+# @echo $@
+# @echo $<
+# @echo -----------------
+# -$(MKDIRHIER) $(@:d)
+# (COPY) $< $@
+# @echo -----------------
+
+# non-existing descriptions: copy from the English version
+.IF "$(strip $(MISSING_LANGS))" != ""
+$(foreach,i,$(MISSING_LANGS) $(EXTENSIONDIR)$/description$/description_$i.txt): .$/description$/description_en-US.txt
+ @echo ------ WARNING: .$/description$/$(@:f) not found, falling back to English description
+ @@-$(MKDIRHIER) $(@:d)
+ @$(COPY) $< $@ > $(NULLDEV)
+.ENDIF
+
+$(DESCRIPTION_SRC): description.xml
+ +-$(RM) $@
+ $(TYPE) description.xml | $(SED) "s/#VERSION#/$(EXTENSION_VERSION)/" | $(SED) "s,#TITLE#,$(EXTENSION_TITLE)," > $@
+
+.IF "$(SYSTEM_MYSQL)" != "YES"
+# --- the MySQL client lib needs to be copied
+$(COMPONENT_MYSQL_LIBFILE): $(MYSQL_LIBFILE)
+ @@-$(MKDIRHIER) $(@:d)
+ @$(COPY) $< $@ > $(NULLDEV)
+ .IF "$(OS)" == "MACOSX"
+ install_name_tool -id @__________________________________________________OOO/$(MYSQL_LIBFILE:f) $@
+ .ENDIF
+.ENDIF
+
+.IF "$(SYSTEM_MYSQL_CPPCONN)" != "YES"
+# --- the MySQL cppconn lib needs to be copied
+$(COMPONENT_MYSQL_CPPCONN_FILE): $(MYSQL_CPPCONNFILE)
+ @@-$(MKDIRHIER) $(@:d)
+ @$(COPY) $< $@ > $(NULLDEV)
+ .IF "$(OS)" == "MACOSX"
+ install_name_tool -change $(MYSQL_LIBFILE:f) @loader_path/$(MYSQL_LIBFILE:f) $@
+ .ENDIF
+.ENDIF
+
+.IF "$(OS)" == "MACOSX"
+$(EXTENSION_TARGET): adjust_libmysql_path
+
+adjust_libmysql_path: $(EXTENSIONDIR)$/$(SHL1TARGET)$(DLLPOST)
+ install_name_tool -change $(MYSQL_LIBFILE:f) @loader_path/$(MYSQL_LIBFILE:f) $(EXTENSIONDIR)$/$(SHL1TARGET)$(DLLPOST)
+.ENDIF
diff --git a/mysqlc/source/manifest.xml b/mysqlc/source/manifest.xml
new file mode 100644
index 000000000000..107f6a878638
--- /dev/null
+++ b/mysqlc/source/manifest.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE manifest:manifest PUBLIC "-//OpenOffice.org//DTD Manifest 1.0//EN" "Manifest.dtd">
+<manifest:manifest xmlns:manifest="http://openoffice.org/2001/manifest">
+ <manifest:file-entry manifest:media-type="application/vnd.sun.star.uno-component;type=native"
+ manifest:full-path="mysqlc.unoSHARED_EXTENSION"/>
+ <manifest:file-entry manifest:media-type="application/vnd.sun.star.configuration-data"
+ manifest:full-path="registry/data/org/openoffice/Office/DataAccess/Drivers.xcu"/>
+</manifest:manifest>
diff --git a/mysqlc/source/mysqlc.map b/mysqlc/source/mysqlc.map
new file mode 100644
index 000000000000..f4ed78b9e970
--- /dev/null
+++ b/mysqlc/source/mysqlc.map
@@ -0,0 +1,8 @@
+UDK_3_0_0 {
+ global:
+ component_getImplementationEnvironment;
+ component_writeInfo;
+ component_getFactory;
+ local:
+ *;
+};
diff --git a/mysqlc/source/mysqlc.xml b/mysqlc/source/mysqlc.xml
new file mode 100644
index 000000000000..d11c6d041ff6
--- /dev/null
+++ b/mysqlc/source/mysqlc.xml
@@ -0,0 +1,81 @@
+<?xml version='1.0' encoding="UTF-8"?>
+<!DOCTYPE COMPONENTDESCRIPTION PUBLIC "-//W3C//DTD HTML 3.2//EN" "module-description.dtd">
+<module-description xmlns:xlink="http://www.w3.org/1999/xlink">
+ <module-name>mysqlc</module-name>
+ <component-description>
+ <Author>Georg Richter</Author>
+ <Name>com.sun.star.comp.sdbc.mysqlc</Name>
+ <Description>
+ This is the implementation of the MySQL Connector/OO.org.
+ </Description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final"/>
+ <supported-service> com.sun.star.sdbc.Driver </supported-service>
+ <service-dependency> ... </service-dependency>
+ </component-description>
+ <project-build-dependency> cppuhelper </project-build-dependency>
+ <project-build-dependency> cppu </project-build-dependency>
+ <project-build-dependency> sal </project-build-dependency>
+ <project-build-dependency> vos </project-build-dependency>
+
+ <runtime-module-dependency> cppuhelper </runtime-module-dependency>
+ <runtime-module-dependency> cppu1 </runtime-module-dependency>
+ <runtime-module-dependency> sal1 </runtime-module-dependency>
+ <runtime-module-dependency> vos </runtime-module-dependency>
+
+ <type> com.sun.star.registry.XRegistryKey </type>
+ <type> com.sun.star.util.XCancellable </type>
+ <type> com.sun.star.util.XNumberFormatter </type>
+ <type> com.sun.star.uno.TypeClass </type>
+ <type> com.sun.star.uno.XWeak </type>
+ <type> com.sun.star.uno.XAggregation </type>
+ <type> com.sun.star.uno.XComponentContext </type>
+ <type> com.sun.star.beans.PropertyAttribute </type>
+ <type> com.sun.star.beans.XPropertyState </type>
+ <type> com.sun.star.beans.XPropertySet </type>
+ <type> com.sun.star.beans.PropertyValue </type>
+ <type> com.sun.star.beans.XMultiPropertySet </type>
+ <type> com.sun.star.beans.XFastPropertySet </type>
+ <type> com.sun.star.lang.XSingleServiceFactory </type>
+ <type> com.sun.star.lang.XTypeProvider </type>
+ <type> com.sun.star.lang.XSingleComponentFactory </type>
+ <type> com.sun.star.lang.EventObject </type>
+ <type> com.sun.star.lang.XComponent </type>
+ <type> com.sun.star.lang.IllegalArgumentException </type>
+ <type> com.sun.star.lang.DisposedException </type>
+ <type> com.sun.star.lang.XMultiServiceFactory </type>
+ <type> com.sun.star.lang.XServiceInfo </type>
+ <type> com.sun.star.lang.XUnoTunnel </type>
+ <type> com.sun.star.java.XJavaThreadRegister_11 </type>
+ <type> com.sun.star.java.XJavaVM </type>
+ <type> com.sun.star.sdbc.FetchDirection </type>
+ <type> com.sun.star.sdbc.XConnection </type>
+ <type> com.sun.star.sdbc.XStatement </type>
+ <type> com.sun.star.sdbc.XResultSet </type>
+ <type> com.sun.star.sdbc.XResultSetMetaDataSupplier</type>
+ <type> com.sun.star.sdbc.XColumnLocate </type>
+ <type> com.sun.star.sdbc.XResultSetUpdate </type>
+ <type> com.sun.star.sdbc.XWarningsSupplier </type>
+ <type> com.sun.star.sdbc.XRowUpdate </type>
+ <type> com.sun.star.sdbc.XMultipleResults </type>
+ <type> com.sun.star.sdbc.XBatchExecution </type>
+ <type> com.sun.star.sdbc.XPreparedBatchExecution </type>
+ <type> com.sun.star.sdbc.XParameters </type>
+ <type> com.sun.star.sdbc.XOutParameters </type>
+ <type> com.sun.star.sdbc.DriverPropertyInfo </type>
+ <type> com.sun.star.sdbc.SQLWarning </type>
+ <type> com.sun.star.sdbc.XRow </type>
+ <type> com.sun.star.sdbc.ColumnSearch </type>
+ <type> com.sun.star.sdbc.ColumnValue </type>
+ <type> com.sun.star.sdbc.DataType </type>
+ <type> com.sun.star.sdbc.XDriver </type>
+ <type> com.sun.star.sdbc.TransactionIsolation </type>
+ <type> com.sun.star.sdbc.ResultSetType </type>
+ <type> com.sun.star.sdbc.ResultSetConcurrency </type>
+ <type> com.sun.star.sdbcx.XRowLocate </type>
+ <type> com.sun.star.sdbcx.XDeleteRows </type>
+ <type> com.sun.star.sdbcx.CompareBookmark </type>
+ <type> com.sun.star.sdb.XColumnUpdate </type>
+ <type> com.sun.star.sdb.XColumn </type>
+</module-description>
diff --git a/mysqlc/source/mysqlc_connection.cxx b/mysqlc/source/mysqlc_connection.cxx
new file mode 100644
index 000000000000..c839e235f369
--- /dev/null
+++ b/mysqlc/source/mysqlc_connection.cxx
@@ -0,0 +1,791 @@
+/*************************************************************************
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2008 by Sun Microsystems, Inc.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* $RCSfile: mysqlc_connection.cxx,v $
+*
+* $Revision: 1.1.2.6 $*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+************************************************************************/
+
+#include <cppconn/driver.h>
+#include <cppconn/connection.h>
+#include <cppconn/statement.h>
+#include <cppconn/metadata.h>
+#include <cppconn/exception.h>
+
+#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 <com/sun/star/sdbc/ColumnValue.hpp>
+#include <com/sun/star/sdbc/XRow.hpp>
+#include <com/sun/star/sdbc/TransactionIsolation.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/beans/NamedValue.hpp>
+
+#include <osl/module.hxx>
+#include <osl/thread.h>
+#include <osl/file.h>
+#include <rtl/uri.hxx>
+#include <rtl/ustrbuf.hxx>
+
+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;
+using namespace com::sun::star::beans;
+using namespace com::sun::star::sdbc;
+using ::osl::MutexGuard;
+using ::rtl::OUString;
+
+
+#define MYSQLC_URI_PREFIX "sdbc:mysqlc:"
+
+
+/* {{{ OConnection::OConnection() -I- */
+OConnection::OConnection(MysqlCDriver& _rDriver, sql::Driver * _cppDriver)
+ :OMetaConnection_BASE(m_aMutex)
+ ,OSubComponent<OConnection, OConnection_BASE>((::cppu::OWeakObject*)&_rDriver, this)
+ ,m_xMetaData(NULL)
+ ,m_rDriver(_rDriver)
+ ,cppDriver(_cppDriver)
+ ,m_bClosed(sal_False)
+ ,m_bUseCatalog(sal_False)
+ ,m_bUseOldDateFormat(sal_False)
+{
+ OSL_TRACE("OConnection::OConnection");
+ m_rDriver.acquire();
+}
+/* }}} */
+
+
+/* {{{ OConnection::OConnection() -I- */
+OConnection::~OConnection()
+{
+ OSL_TRACE("OConnection::~OConnection");
+ if (!isClosed()) {
+ close();
+ }
+ m_rDriver.release();
+}
+/* }}} */
+
+
+/* {{{ OConnection::release() -I- */
+void SAL_CALL OConnection::release()
+ throw()
+{
+ OSL_TRACE("OConnection::release");
+ relase_ChildImpl();
+}
+/* }}} */
+
+#ifndef SYSTEM_MYSQL
+ extern "C" { void SAL_CALL thisModule() {} }
+#endif
+
+/* {{{ OConnection::construct() -I- */
+void OConnection::construct(const OUString& url, const Sequence< PropertyValue >& info)
+ throw(SQLException)
+{
+ OSL_TRACE("OConnection::construct");
+ MutexGuard aGuard(m_aMutex);
+
+ sal_Int32 nIndex;
+ sal_Bool bEmbedded = sal_False;
+ OUString token;
+ OUString aHostName(RTL_CONSTASCII_USTRINGPARAM("localhost"));
+ sal_Int32 nPort = 3306;
+ OUString aDbName;
+
+ m_settings.encoding = m_rDriver.getDefaultEncoding();
+ m_settings.quoteIdentifier = OUString();
+
+ // parse url. Url has the following format:
+ // external server: sdbc:mysqlc:[hostname]:[port]/[dbname]
+
+ if (!url.compareTo(OUString::createFromAscii(MYSQLC_URI_PREFIX), sizeof(MYSQLC_URI_PREFIX)-1)) {
+ nIndex = 12;
+ } else {
+ bEmbedded = sal_True;
+ nIndex = 20;
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OConnection::construct (embedded MySQL)", *this);
+ }
+
+ token = url.getToken(0, '/', nIndex);
+ if (token.getLength()) {
+ sal_Int32 nIndex1 = 0;
+ OUString hostandport = token.getToken(0,':', nIndex1);
+ if (hostandport.getLength()) {
+ aHostName = hostandport;
+ hostandport = token.getToken(0, ':', nIndex1);
+ if (hostandport.getLength() && nIndex1) {
+ nPort = hostandport.toInt32();
+ }
+ token = url.getToken(0, '/', nIndex);
+ if (token.getLength() && nIndex) {
+ aDbName = token;
+ }
+ }
+ }
+
+ // get user and password for mysql connection
+ const PropertyValue *pIter = info.getConstArray();
+ const PropertyValue *pEnd = pIter + info.getLength();
+ OUString aUser, aPass, sUnixSocket, sNamedPipe;
+ bool unixSocketPassed = false;
+ bool namedPipePassed = false;
+
+ m_settings.connectionURL = url;
+ for (;pIter != pEnd;++pIter) {
+ if (!pIter->Name.compareToAscii("user")) {
+ OSL_VERIFY( pIter->Value >>= aUser );
+ } else if (!pIter->Name.compareToAscii("password")) {
+ OSL_VERIFY( pIter->Value >>= aPass );
+ } else if (!pIter->Name.compareToAscii("LocalSocket")) {
+ OSL_VERIFY( pIter->Value >>= sUnixSocket );
+ unixSocketPassed = true;
+ } else if (!pIter->Name.compareToAscii("NamedPipe")) {
+ OSL_VERIFY( pIter->Value >>= sNamedPipe );
+ namedPipePassed = true;
+ } else if ( !pIter->Name.compareToAscii("PublicConnectionURL")) {
+ OSL_VERIFY( pIter->Value >>= m_settings.connectionURL );
+ } else if ( !pIter->Name.compareToAscii("NewURL")) { // legacy name for "PublicConnectionURL"
+ OSL_VERIFY( pIter->Value >>= m_settings.connectionURL );
+ }
+ }
+
+ if (bEmbedded == sal_False) {
+ try {
+ sql::ConnectOptionsMap connProps;
+ std::string host_str = OUStringToOString(aHostName, m_settings.encoding).getStr();
+ std::string user_str = OUStringToOString(aUser, m_settings.encoding).getStr();
+ std::string pass_str = OUStringToOString(aPass, m_settings.encoding).getStr();
+ std::string schema_str = 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((int)(nPort));
+ if (unixSocketPassed) {
+ sql::SQLString socket_str = OUStringToOString(sUnixSocket, m_settings.encoding).getStr();
+ connProps["socket"] = socket_str;
+ } else if (namedPipePassed) {
+ sql::SQLString pipe_str = OUStringToOString(sNamedPipe, m_settings.encoding).getStr();
+ connProps["socket"] = pipe_str;
+ }
+
+#ifndef SYSTEM_MYSQL
+ ::rtl::OUString sMySQLClientLib( RTL_CONSTASCII_USTRINGPARAM( MYSQL_LIB ) );
+
+ ::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_ENSURE( false, 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());
+ OSL_TRACE("password=%s", pass_str.c_str());
+ OSL_TRACE("schema=%s", schema_str.c_str());
+
+ m_settings.cppConnection.reset(cppDriver->connect(connProps));
+ } catch (sql::SQLException &e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, getConnectionEncoding());
+ }
+ } else {
+ // TODO: support for embedded server
+ }
+
+ m_settings.schema = aDbName;
+ OSL_TRACE(OUStringToOString(m_settings.schema, getConnectionEncoding()).getStr());
+
+ // Check if the server is 4.1 or above
+ if (this->getMysqlVersion() < 40100) {
+ throw SQLException(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MySQL Connector/OO.org requires MySQL Server 4.1 or above" ) ),
+ *this,
+ ::rtl::OUString(),
+ 0,
+ Any());
+ }
+ std::auto_ptr<sql::Statement> stmt(m_settings.cppConnection->createStatement());
+ stmt->executeUpdate("SET session sql_mode='ANSI_QUOTES'");
+ stmt->executeUpdate("SET NAMES utf8");
+}
+/* }}} */
+
+
+// XServiceInfo
+IMPLEMENT_SERVICE_INFO(OConnection, "com.sun.star.sdbc.drivers.mysqlc.OConnection", "com.sun.star.sdbc.Connection")
+
+
+/* {{{ OConnection::createStatement() -I- */
+Reference< XStatement > SAL_CALL OConnection::createStatement()
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OConnection::createStatement");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OConnection_BASE::rBHelper.bDisposed);
+
+ // create a statement
+ Reference< XStatement > xReturn;
+ // the statement can only be executed once
+ try {
+ xReturn = new OStatement(this, m_settings.cppConnection->createStatement());
+ m_aStatements.push_back(WeakReferenceHelper(xReturn));
+ return xReturn;
+ } catch (sql::SQLException & e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, getConnectionEncoding());
+ }
+ return xReturn;
+}
+/* }}} */
+
+
+/* {{{ OConnection::createStatement() -I- */
+Reference< XPreparedStatement > SAL_CALL OConnection::prepareStatement(const OUString& _sSql)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OConnection::prepareStatement");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OConnection_BASE::rBHelper.bDisposed);
+ const ::rtl::OUString sSqlStatement = transFormPreparedStatement( _sSql );
+
+ Reference< XPreparedStatement > xStatement;
+ try {
+ // create a statement
+ // the statement can only be executed more than once
+ xStatement = new OPreparedStatement(this,
+ m_settings.cppConnection->prepareStatement(OUStringToOString(sSqlStatement, getConnectionEncoding()).getStr()));
+ m_aStatements.push_back( WeakReferenceHelper( xStatement ) );
+ } catch (sql::SQLException & e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, getConnectionEncoding());
+ }
+ return xStatement;
+}
+/* }}} */
+
+
+/* {{{ OConnection::prepareCall() -U- */
+Reference< XPreparedStatement > SAL_CALL OConnection::prepareCall(const OUString& /*_sSql*/ )
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OConnection::prepareCall");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OConnection_BASE::rBHelper.bDisposed);
+
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OConnection::prepareCall", *this);
+ return Reference< XPreparedStatement >();
+}
+/* }}} */
+
+
+/* {{{ OConnection::nativeSQL() -I- */
+OUString SAL_CALL OConnection::nativeSQL(const OUString& _sSql)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OConnection::nativeSQL");
+ MutexGuard aGuard(m_aMutex);
+
+ const ::rtl::OUString sSqlStatement = transFormPreparedStatement( _sSql );
+ ::rtl::OUString sNativeSQL;
+ try {
+ sNativeSQL = mysqlc_sdbc_driver::convert(m_settings.cppConnection->nativeSQL(mysqlc_sdbc_driver::convert(sSqlStatement, getConnectionEncoding())),
+ getConnectionEncoding());
+ } catch (sql::SQLException & e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, getConnectionEncoding());
+ }
+ return sNativeSQL;
+}
+/* }}} */
+
+
+/* {{{ OConnection::setAutoCommit() -I- */
+void SAL_CALL OConnection::setAutoCommit(sal_Bool autoCommit)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OConnection::setAutoCommit");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OConnection_BASE::rBHelper.bDisposed);
+ try {
+ m_settings.cppConnection->setAutoCommit(autoCommit == sal_True? true:false);
+ } catch (sql::SQLException & e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, getConnectionEncoding());
+ }
+}
+/* }}} */
+
+
+/* {{{ OConnection::getAutoCommit() -I- */
+sal_Bool SAL_CALL OConnection::getAutoCommit()
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OConnection::getAutoCommit");
+ // you have to distinguish which if you are in autocommit mode or not
+ // at normal case true should be fine here
+
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OConnection_BASE::rBHelper.bDisposed);
+
+ sal_Bool autoCommit = sal_False;
+ try {
+ autoCommit = m_settings.cppConnection->getAutoCommit() == true ? sal_True : sal_False;
+ } catch (sql::SQLException & e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, getConnectionEncoding());
+ }
+ return autoCommit;
+}
+/* }}} */
+
+
+/* {{{ OConnection::commit() -I- */
+void SAL_CALL OConnection::commit()
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OConnection::commit");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OConnection_BASE::rBHelper.bDisposed);
+ try {
+ m_settings.cppConnection->commit();
+ } catch (sql::SQLException & e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, getConnectionEncoding());
+ }
+}
+/* }}} */
+
+
+/* {{{ OConnection::rollback() -I- */
+void SAL_CALL OConnection::rollback()
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OConnection::rollback");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OConnection_BASE::rBHelper.bDisposed);
+ try {
+ m_settings.cppConnection->rollback();
+ } catch (sql::SQLException & e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, getConnectionEncoding());
+ }
+}
+/* }}} */
+
+
+/* {{{ OConnection::isClosed() -I- */
+sal_Bool SAL_CALL OConnection::isClosed()
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OConnection::isClosed");
+ MutexGuard aGuard(m_aMutex);
+
+ // just simple -> we are close when we are disposed taht means someone called dispose(); (XComponent)
+ return (OConnection_BASE::rBHelper.bDisposed);
+}
+/* }}} */
+
+
+/* {{{ OConnection::createStatement() -I- */
+Reference< XDatabaseMetaData > SAL_CALL OConnection::getMetaData()
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OConnection::getMetaData");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OConnection_BASE::rBHelper.bDisposed);
+
+ Reference< XDatabaseMetaData > xMetaData = m_xMetaData;
+ if (!xMetaData.is()) {
+ try {
+ xMetaData = new ODatabaseMetaData(*this); // need the connection because it can return it
+ } catch (sql::SQLException & e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, getConnectionEncoding());
+ }
+ m_xMetaData = xMetaData;
+ }
+
+ return xMetaData;
+}
+/* }}} */
+
+
+/* {{{ OConnection::createStatement() -I- */
+void SAL_CALL OConnection::setReadOnly(sal_Bool readOnly)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OConnection::setReadOnly");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OConnection_BASE::rBHelper.bDisposed);
+
+ m_settings.readOnly = readOnly;
+}
+/* }}} */
+
+
+/* {{{ OConnection::createStatement() -I- */
+sal_Bool SAL_CALL OConnection::isReadOnly()
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OConnection::isReadOnly");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OConnection_BASE::rBHelper.bDisposed);
+
+ // return if your connection to readonly
+ return (m_settings.readOnly);
+}
+/* }}} */
+
+
+/* {{{ OConnection::createStatement() -I- */
+void SAL_CALL OConnection::setCatalog(const OUString& catalog)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OConnection::setCatalog");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OConnection_BASE::rBHelper.bDisposed);
+
+ try {
+// m_settings.cppConnection->setCatalog(OUStringToOString(catalog, m_settings.encoding).getStr());
+ m_settings.cppConnection->setSchema(OUStringToOString(catalog, getConnectionEncoding()).getStr());
+ } catch (sql::SQLException & e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, getConnectionEncoding());
+ }
+}
+/* }}} */
+
+
+/* {{{ OConnection::createStatement() -I- */
+OUString SAL_CALL OConnection::getCatalog()
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OConnection::getCatalog");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OConnection_BASE::rBHelper.bDisposed);
+
+ OUString catalog;
+ try {
+ catalog = mysqlc_sdbc_driver::convert(m_settings.cppConnection->getSchema(), getConnectionEncoding());
+ } catch (sql::SQLException & e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, getConnectionEncoding());
+ }
+ return catalog;
+}
+/* }}} */
+
+
+/* {{{ OConnection::createStatement() -I- */
+void SAL_CALL OConnection::setTransactionIsolation(sal_Int32 level)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OConnection::setTransactionIsolation");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OConnection_BASE::rBHelper.bDisposed);
+
+ sql::enum_transaction_isolation cpplevel = sql::TRANSACTION_SERIALIZABLE;
+
+ switch (level) {
+ case TransactionIsolation::READ_UNCOMMITTED:
+ cpplevel = sql::TRANSACTION_READ_UNCOMMITTED;
+ break;
+ case TransactionIsolation::READ_COMMITTED:
+ cpplevel = sql::TRANSACTION_READ_COMMITTED;
+ break;
+ case TransactionIsolation::REPEATABLE_READ:
+ cpplevel = sql::TRANSACTION_REPEATABLE_READ;
+ break;
+ case TransactionIsolation::SERIALIZABLE:
+ cpplevel = sql::TRANSACTION_SERIALIZABLE;
+ break;
+ case TransactionIsolation::NONE:
+ cpplevel = sql::TRANSACTION_SERIALIZABLE;
+ break;
+ default:;
+ /* XXX: Exception ?? */
+ }
+ try {
+ m_settings.cppConnection->setTransactionIsolation(cpplevel);
+ } catch (sql::SQLException & e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, getConnectionEncoding());
+ }
+}
+/* }}} */
+
+
+/* {{{ OConnection::createStatement() -I- */
+sal_Int32 SAL_CALL OConnection::getTransactionIsolation()
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OConnection::getTransactionIsolation");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OConnection_BASE::rBHelper.bDisposed);
+
+ try {
+ switch (m_settings.cppConnection->getTransactionIsolation()) {
+ case sql::TRANSACTION_SERIALIZABLE: return TransactionIsolation::SERIALIZABLE;
+ case sql::TRANSACTION_REPEATABLE_READ: return TransactionIsolation::REPEATABLE_READ;
+ case sql::TRANSACTION_READ_COMMITTED: return TransactionIsolation::READ_COMMITTED;
+ case sql::TRANSACTION_READ_UNCOMMITTED: return TransactionIsolation::READ_UNCOMMITTED;
+ default:
+ ;
+ }
+ } catch (sql::SQLException & e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, getConnectionEncoding());
+ }
+ return TransactionIsolation::NONE;
+}
+/* }}} */
+
+
+/* {{{ OConnection::getTypeMap() -I- */
+Reference<XNameAccess> SAL_CALL OConnection::getTypeMap()
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OConnection::getTypeMap");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OConnection_BASE::rBHelper.bDisposed);
+
+ Reference<XNameAccess > t;
+ {
+ t = m_typeMap;
+ }
+ return (t);
+}
+/* }}} */
+
+
+/* {{{ OConnection::setTypeMap() -I- */
+void SAL_CALL OConnection::setTypeMap(const Reference<XNameAccess >& typeMap)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OConnection::setTypeMap");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OConnection_BASE::rBHelper.bDisposed);
+
+ m_typeMap = typeMap;
+}
+/* }}} */
+
+
+// XCloseable
+/* {{{ OConnection::close() -I- */
+void SAL_CALL OConnection::close()
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OConnection::close");
+ /*
+ we need block, because the mutex is a local variable,
+ which will guard the block
+ */
+ {
+ // we just dispose us
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OConnection_BASE::rBHelper.bDisposed);
+ }
+ dispose();
+}
+/* }}} */
+
+
+// XWarningsSupplier
+/* {{{ OConnection::getWarnings() -I- */
+Any SAL_CALL OConnection::getWarnings()
+ throw(SQLException, RuntimeException)
+{
+ Any x = Any();
+ OSL_TRACE("OConnection::getWarnings");
+ // when you collected some warnings -> return it
+ return x;
+}
+/* }}} */
+
+
+/* {{{ OConnection::clearWarnings() -I- */
+void SAL_CALL OConnection::clearWarnings()
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OConnection::clearWarnings");
+ // you should clear your collected warnings here#
+}
+/* }}} */
+
+
+/* {{{ OConnection::buildTypeInfo() -I- */
+void OConnection::buildTypeInfo()
+ throw(SQLException)
+{
+ OSL_TRACE("OConnection::buildTypeInfo");
+}
+/* }}} */
+
+
+/* {{{ OConnection::disposing() -I- */
+void OConnection::disposing()
+{
+ OSL_TRACE("OConnection::disposing");
+ // we noticed that we should be destroied in near future so we have to dispose our statements
+ MutexGuard aGuard(m_aMutex);
+
+ for (OWeakRefArray::iterator i = m_aStatements.begin(); i != m_aStatements.end() ; ++i) {
+ Reference< XComponent > xComp(i->get(), UNO_QUERY);
+ if (xComp.is()) {
+ xComp->dispose();
+ }
+ }
+ m_aStatements.clear();
+
+ m_bClosed = sal_True;
+ m_xMetaData = WeakReference< XDatabaseMetaData >();
+
+ dispose_ChildImpl();
+ OConnection_BASE::disposing();
+}
+/* }}} */
+
+
+/* ToDo - upcast the connection to MySQL_Connection and use ::getSessionVariable() */
+
+/* {{{ OConnection::getMysqlVariable() -I- */
+OUString OConnection::getMysqlVariable(const char *varname)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OConnection::getMysqlVariable");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OConnection_BASE::rBHelper.bDisposed);
+
+ OUString ret;
+ ::rtl::OUStringBuffer aStatement;
+ aStatement.appendAscii( "SHOW SESSION VARIABLES LIKE '" );
+ aStatement.appendAscii( varname );
+ aStatement.append( sal_Unicode( '\'' ) );
+
+ try {
+ XStatement * stmt = new OStatement(this, m_settings.cppConnection->createStatement());
+ Reference< XResultSet > rs = stmt->executeQuery( aStatement.makeStringAndClear() );
+ if (rs.is() && rs->next()) {
+ Reference< XRow > xRow(rs, UNO_QUERY);
+ ret = xRow->getString(2);
+ }
+ } catch (sql::SQLException & e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, getConnectionEncoding());
+ }
+
+ return ret;
+}
+/* }}} */
+
+
+/* {{{ OConnection::getMysqlVersion() -I- */
+sal_Int32 OConnection::getMysqlVersion()
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OConnection::getMysqlVersion");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OConnection_BASE::rBHelper.bDisposed);
+
+ sal_Int32 version(0);
+ try {
+ version = 10000 * m_settings.cppConnection->getMetaData()->getDatabaseMajorVersion();
+ version += 100 * m_settings.cppConnection->getMetaData()->getDatabaseMinorVersion();
+ version += m_settings.cppConnection->getMetaData()->getDatabasePatchVersion();
+ } catch (sql::SQLException & e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, getConnectionEncoding());
+ }
+ return version;
+}
+/* }}} */
+
+
+/* {{{ OConnection::sdbcColumnType() -I- */
+// TODO: Not used
+//sal_Int32 OConnection::sdbcColumnType(OUString typeName)
+//{
+// OSL_TRACE("OConnection::sdbcColumnType");
+// int i = 0;
+// while (mysqlc_types[i].typeName) {
+// if (OUString::createFromAscii(mysqlc_types[i].typeName).equals(
+// typeName.toAsciiUpperCase()))
+// {
+// return mysqlc_types[i].dataType;
+// }
+// i++;
+// }
+// return 0;
+//}
+// -----------------------------------------------------------------------------
+::rtl::OUString OConnection::transFormPreparedStatement(const ::rtl::OUString& _sSQL)
+{
+ ::rtl::OUString sSqlStatement = _sSQL;
+ if ( !m_xParameterSubstitution.is() ) {
+ try {
+ Sequence< Any > aArgs(1);
+ Reference< XConnection> xCon = this;
+ aArgs[0] <<= NamedValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ActiveConnection")), makeAny(xCon));
+
+ m_xParameterSubstitution.set(m_rDriver.getFactory()->createInstanceWithArguments(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.helper.ParameterSubstitution")),aArgs),UNO_QUERY);
+ } catch(const Exception&) {}
+ }
+ if ( m_xParameterSubstitution.is() ) {
+ try {
+ sSqlStatement = m_xParameterSubstitution->substituteVariables(sSqlStatement,sal_True);
+ } catch(const Exception&) { }
+ }
+ return sSqlStatement;
+}
+
+/* }}} */
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
diff --git a/mysqlc/source/mysqlc_connection.hxx b/mysqlc/source/mysqlc_connection.hxx
new file mode 100644
index 000000000000..0b17a0a362e2
--- /dev/null
+++ b/mysqlc/source/mysqlc_connection.hxx
@@ -0,0 +1,250 @@
+/*************************************************************************
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2008 by Sun Microsystems, Inc.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* $RCSfile: mysqlc_connection.hxx,v $
+*
+* $Revision: 1.1.2.4 $
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+************************************************************************/
+
+#ifndef MYSQLC_CONNECTION_HXX
+#define MYSQLC_CONNECTION_HXX
+
+#include "mysqlc_subcomponent.hxx"
+#include "mysqlc_types.hxx"
+
+#include <boost/shared_ptr.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <com/sun/star/sdbc/ColumnSearch.hpp>
+#include <com/sun/star/sdbc/ColumnValue.hpp>
+#include <com/sun/star/sdbc/DataType.hpp>
+#include <com/sun/star/sdbc/SQLWarning.hpp>
+#include <com/sun/star/sdbc/XConnection.hpp>
+#include <com/sun/star/sdbc/XWarningsSupplier.hpp>
+#include <com/sun/star/util/XStringSubstitution.hpp>
+
+#include <cppconn/driver.h>
+#include <cppuhelper/compbase3.hxx>
+#include <cppuhelper/weakref.hxx>
+#include <rtl/string.hxx>
+
+#include <map>
+
+#define UNUSED_PARAM __attribute__((unused))
+
+namespace sql
+{
+ class SQLException;
+}
+
+namespace connectivity
+{
+ class OMetaConnection;
+ class ODatabaseMetaData;
+
+ namespace mysqlc
+ {
+ using ::rtl::OUString;
+ using ::com::sun::star::sdbc::SQLWarning;
+ using ::com::sun::star::sdbc::SQLException;
+ using ::com::sun::star::uno::RuntimeException;
+ typedef ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XStatement > my_XStatementRef;
+ typedef ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XPreparedStatement > my_XPreparedStatementRef;
+ typedef ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > my_XNameAccessRef;
+ typedef ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > my_XDatabaseMetaDataRef;
+
+ typedef ::cppu::WeakComponentImplHelper3< ::com::sun::star::sdbc::XConnection,
+ ::com::sun::star::sdbc::XWarningsSupplier,
+ ::com::sun::star::lang::XServiceInfo
+ > OMetaConnection_BASE;
+ struct ConnectionSettings
+ {
+ rtl_TextEncoding encoding;
+ std::auto_ptr<sql::Connection> cppConnection;
+ OUString schema;
+ OUString quoteIdentifier;
+ OUString connectionURL;
+ sal_Bool readOnly;
+ };
+
+ class MysqlCDriver;
+
+ typedef OMetaConnection_BASE OConnection_BASE;
+
+ typedef std::vector< ::com::sun::star::uno::WeakReferenceHelper > OWeakRefArray;
+
+ class OConnection : public OBase_Mutex,
+ public OConnection_BASE,
+ public connectivity::mysqlc::OSubComponent<OConnection, OConnection_BASE>
+ {
+ friend class connectivity::mysqlc::OSubComponent<OConnection, OConnection_BASE>;
+
+ private:
+ ConnectionSettings m_settings;
+
+ private:
+ ::com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > m_typeMap;
+ ::com::sun::star::uno::Reference< com::sun::star::util::XStringSubstitution > m_xParameterSubstitution;
+ protected:
+
+ //====================================================================
+ // Data attributes
+ //====================================================================
+ ::com::sun::star::uno::WeakReference< ::com::sun::star::sdbc::XDatabaseMetaData > m_xMetaData;
+
+ OWeakRefArray m_aStatements; // vector containing a list
+ // of all the Statement objects
+ // for this Connection
+
+ SQLWarning m_aLastWarning; // Last SQLWarning generated by an operation
+ OUString m_aURL; // URL of connection
+ OUString m_sUser; // the user name
+ MysqlCDriver& m_rDriver; // Pointer to the owning driver object
+ sql::Driver* cppDriver;
+
+ sal_Bool m_bClosed;
+ sal_Bool m_bUseCatalog; // should we use the catalog on filebased databases
+ sal_Bool m_bUseOldDateFormat;
+
+
+ void buildTypeInfo() throw(SQLException);
+ public:
+ OUString getMysqlVariable(const char *varname)
+ throw(SQLException, RuntimeException);
+
+ sal_Int32 getMysqlVersion()
+ throw(SQLException, RuntimeException);
+
+ virtual void construct(const OUString& url,const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info)
+ throw(SQLException);
+
+ OConnection(MysqlCDriver& _rDriver, sql::Driver * cppDriver);
+ virtual ~OConnection();
+
+ void closeAllStatements () throw(SQLException);
+
+
+ rtl_TextEncoding getConnectionEncoding() { return m_settings.encoding; }
+
+
+ // OComponentHelper
+ virtual void SAL_CALL disposing(void);
+
+ // XInterface
+ virtual void SAL_CALL release() throw();
+
+ // XServiceInfo
+ DECLARE_SERVICE_INFO();
+ // XConnection
+ my_XStatementRef SAL_CALL createStatement()
+ throw(SQLException, RuntimeException);
+
+ my_XPreparedStatementRef SAL_CALL prepareStatement(const OUString& sql)
+ throw(SQLException, RuntimeException);
+
+ my_XPreparedStatementRef SAL_CALL prepareCall(const OUString& sql)
+ throw(SQLException, RuntimeException);
+
+ OUString SAL_CALL nativeSQL(const OUString& sql)
+ throw(SQLException, RuntimeException);
+
+ void SAL_CALL setAutoCommit(sal_Bool autoCommit)
+ throw(SQLException, RuntimeException);
+
+ sal_Bool SAL_CALL getAutoCommit()
+ throw(SQLException, RuntimeException);
+
+ void SAL_CALL commit()
+ throw(SQLException, RuntimeException);
+
+ void SAL_CALL rollback()
+ throw(SQLException, RuntimeException);
+
+ sal_Bool SAL_CALL isClosed()
+ throw(SQLException, RuntimeException);
+
+ my_XDatabaseMetaDataRef SAL_CALL getMetaData()
+ throw(SQLException, RuntimeException);
+
+ void SAL_CALL setReadOnly(sal_Bool readOnly)
+ throw(SQLException, RuntimeException);
+
+ sal_Bool SAL_CALL isReadOnly()
+ throw(SQLException, RuntimeException);
+
+ void SAL_CALL setCatalog(const OUString& catalog)
+ throw(SQLException, RuntimeException);
+
+ OUString SAL_CALL getCatalog()
+ throw(SQLException, RuntimeException);
+
+ void SAL_CALL setTransactionIsolation(sal_Int32 level)
+ throw(SQLException, RuntimeException);
+
+ sal_Int32 SAL_CALL getTransactionIsolation()
+ throw(SQLException, RuntimeException);
+
+ my_XNameAccessRef SAL_CALL getTypeMap()
+ throw(SQLException, RuntimeException);
+
+ void SAL_CALL setTypeMap(const my_XNameAccessRef& typeMap)
+ throw(SQLException, RuntimeException);
+ // XCloseable
+ void SAL_CALL close()
+ throw(SQLException, RuntimeException);
+ // XWarningsSupplier
+ ::com::sun::star::uno::Any SAL_CALL getWarnings()
+ throw(SQLException, RuntimeException);
+ void SAL_CALL clearWarnings()
+ throw(SQLException, RuntimeException);
+
+ // TODO: Not used
+ //sal_Int32 sdbcColumnType(OUString typeName);
+ inline const ConnectionSettings& getConnectionSettings() const { return m_settings; }
+ ::rtl::OUString transFormPreparedStatement(const ::rtl::OUString& _sSQL);
+
+ // should we use the catalog on filebased databases
+ inline sal_Bool isCatalogUsed() const { return m_bUseCatalog; }
+ inline OUString getUserName() const { return m_sUser; }
+ inline const MysqlCDriver& getDriver() const { return m_rDriver;}
+ inline rtl_TextEncoding getTextEncoding() const { return m_settings.encoding; }
+
+ }; /* OConnection */
+ // TODO: Not used.
+ //inline OUString getPattern(OUString p) { return (p.getLength()) ? p : ASC2OU("%"); }
+ } /* mysqlc */
+} /* connectivity */
+#endif // MYSQLC_CONNECTION_HXX
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
+
diff --git a/mysqlc/source/mysqlc_databasemetadata.cxx b/mysqlc/source/mysqlc_databasemetadata.cxx
new file mode 100644
index 000000000000..30911dda97cf
--- /dev/null
+++ b/mysqlc/source/mysqlc_databasemetadata.cxx
@@ -0,0 +1,2215 @@
+/*************************************************************************
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2008 by Sun Microsystems, Inc.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* $RCSfile: mysqlc_databasemetadata.cxx,v $
+*
+* $Revision: 1.1.2.5 $
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+************************************************************************/
+#include "mysqlc_databasemetadata.hxx"
+#include <com/sun/star/sdbc/DataType.hpp>
+#include <com/sun/star/sdbc/ResultSetType.hpp>
+#include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
+#include <com/sun/star/sdbc/TransactionIsolation.hpp>
+#include <com/sun/star/sdbc/KeyRule.hpp>
+#include <com/sun/star/sdbc/Deferrability.hpp>
+#include <com/sun/star/sdbc/IndexType.hpp>
+#include <com/sun/star/sdbc/BestRowScope.hpp>
+#include <com/sun/star/sdbc/ColumnType.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+
+
+#include "mysqlc_general.hxx"
+#include "mysqlc_statement.hxx"
+#include "mysqlc_driver.hxx"
+#include "mysqlc_preparedstatement.hxx"
+
+#include <stdio.h>
+
+using namespace connectivity::mysqlc;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::beans;
+using namespace com::sun::star::sdbc;
+using ::rtl::OUString;
+using mysqlc_sdbc_driver::getStringFromAny;
+
+#include <cppconn/connection.h>
+#include <cppconn/resultset.h>
+#include <cppconn/metadata.h>
+#include <cppconn/statement.h>
+#include <cppconn/prepared_statement.h>
+
+static std::string wild("%");
+
+using ::rtl::OUStringToOString;
+
+// -----------------------------------------------------------------------------
+void lcl_setRows_throw(const Reference< XResultSet >& _xResultSet,sal_Int32 _nType,const std::vector< std::vector< Any > >& _rRows)
+{
+ Reference< XInitialization> xIni(_xResultSet,UNO_QUERY);
+ Sequence< Any > aArgs(2);
+ aArgs[0] <<= _nType;
+
+ Sequence< Sequence< Any > > aRows(_rRows.size());
+
+ std::vector< std::vector< Any > >::const_iterator aIter = _rRows.begin();
+ Sequence< Any > * pRowsIter = aRows.getArray();
+ Sequence< Any > * pRowsEnd = pRowsIter + aRows.getLength();
+ for (; pRowsIter != pRowsEnd;++pRowsIter,++aIter) {
+ if (!aIter->empty()) {
+ Sequence<Any> aSeq(&(*aIter->begin()),aIter->size());
+ (*pRowsIter) = aSeq;
+ }
+ }
+ aArgs[1] <<= aRows;
+ xIni->initialize(aArgs);
+}
+
+
+/* {{{ ODatabaseMetaData::ODatabaseMetaData() -I- */
+ODatabaseMetaData::ODatabaseMetaData(OConnection& _rCon)
+ :m_rConnection(_rCon)
+ ,m_bUseCatalog(sal_True)
+ ,meta(_rCon.getConnectionSettings().cppConnection->getMetaData())
+ ,identifier_quote_string_set(false)
+{
+ OSL_TRACE("ODatabaseMetaData::ODatabaseMetaData");
+ if (!m_rConnection.isCatalogUsed())
+ {
+ osl_incrementInterlockedCount(&m_refCount);
+ m_bUseCatalog = !(usesLocalFiles() || usesLocalFilePerTable());
+ osl_decrementInterlockedCount(&m_refCount);
+ }
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::~ODatabaseMetaData() -I- */
+ODatabaseMetaData::~ODatabaseMetaData()
+{
+ OSL_TRACE("ODatabaseMetaData::~ODatabaseMetaData");
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::impl_getStringMetaData() -I- */
+OUString ODatabaseMetaData::impl_getStringMetaData(const sal_Char* _methodName, const std::string& (sql::DatabaseMetaData::*_Method)() )
+{
+ OSL_TRACE( "mysqlc::ODatabaseMetaData::%s", _methodName);
+ OUString stringMetaData;
+ try {
+ stringMetaData = mysqlc_sdbc_driver::convert((meta->*_Method)(), m_rConnection.getConnectionEncoding());
+ } catch (sql::MethodNotImplementedException) {
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException(_methodName, *this);
+ } catch (sql::InvalidArgumentException) {
+ mysqlc_sdbc_driver::throwInvalidArgumentException(_methodName, *this);
+ } catch (const sql::SQLException& e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_rConnection.getConnectionEncoding());
+ }
+ return stringMetaData;
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::impl_getStringMetaData() -I- */
+OUString ODatabaseMetaData::impl_getStringMetaData(const sal_Char* _methodName, std::string (sql::DatabaseMetaData::*_Method)() )
+{
+ OSL_TRACE( "mysqlc::ODatabaseMetaData::%s", _methodName);
+ OUString stringMetaData;
+ try {
+ stringMetaData = mysqlc_sdbc_driver::convert((meta->*_Method)(), m_rConnection.getConnectionEncoding());
+ } catch (sql::MethodNotImplementedException) {
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException(_methodName, *this);
+ } catch (sql::InvalidArgumentException) {
+ mysqlc_sdbc_driver::throwInvalidArgumentException(_methodName, *this);
+ } catch (const sql::SQLException& e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_rConnection.getConnectionEncoding());
+ }
+ return stringMetaData;
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::impl_getStringMetaData() -I- */
+OUString ODatabaseMetaData::impl_getStringMetaData(const sal_Char* _methodName, const sql::SQLString& (sql::DatabaseMetaData::*_Method)() )
+{
+ OSL_TRACE( "mysqlc::ODatabaseMetaData::%s", _methodName);
+ OUString stringMetaData;
+ try {
+ stringMetaData = mysqlc_sdbc_driver::convert((meta->*_Method)(), m_rConnection.getConnectionEncoding());
+ } catch (sql::MethodNotImplementedException) {
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException(_methodName, *this);
+ } catch (sql::InvalidArgumentException) {
+ mysqlc_sdbc_driver::throwInvalidArgumentException(_methodName, *this);
+ } catch (const sql::SQLException& e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_rConnection.getConnectionEncoding());
+ }
+ return stringMetaData;
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::impl_getStringMetaData() -I- */
+OUString ODatabaseMetaData::impl_getStringMetaData(const sal_Char* _methodName, sql::SQLString (sql::DatabaseMetaData::*_Method)() )
+{
+ OSL_TRACE( "mysqlc::ODatabaseMetaData::%s", _methodName);
+ OUString stringMetaData;
+ try {
+ stringMetaData = mysqlc_sdbc_driver::convert((meta->*_Method)(), m_rConnection.getConnectionEncoding());
+ } catch (sql::MethodNotImplementedException) {
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException(_methodName, *this);
+ } catch (sql::InvalidArgumentException) {
+ mysqlc_sdbc_driver::throwInvalidArgumentException(_methodName, *this);
+ } catch (const sql::SQLException& e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_rConnection.getConnectionEncoding());
+ }
+ return stringMetaData;
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::impl_getInt32MetaData() -I- */
+sal_Int32 ODatabaseMetaData::impl_getInt32MetaData(const sal_Char* _methodName, unsigned int (sql::DatabaseMetaData::*_Method)() )
+{
+ OSL_TRACE( "mysqlc::ODatabaseMetaData::%s", _methodName);
+ sal_Int32 int32MetaData(0);
+ try {
+ int32MetaData = (meta->*_Method)();
+ } catch (sql::MethodNotImplementedException) {
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException(_methodName, *this);
+ } catch (sql::InvalidArgumentException) {
+ mysqlc_sdbc_driver::throwInvalidArgumentException(_methodName, *this);
+ } catch (const sql::SQLException& e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_rConnection.getConnectionEncoding());
+ }
+ return int32MetaData;
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::impl_getBoolMetaData() -I- */
+sal_Bool ODatabaseMetaData::impl_getBoolMetaData(const sal_Char* _methodName, bool (sql::DatabaseMetaData::*_Method)() )
+{
+ OSL_TRACE( "mysqlc::ODatabaseMetaData::%s", _methodName);
+ sal_Bool boolMetaData(0);
+ try {
+ boolMetaData = (meta->*_Method)() ? sal_True : sal_False;
+ } catch (sql::MethodNotImplementedException) {
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException(_methodName, *this);
+ } catch (sql::InvalidArgumentException) {
+ mysqlc_sdbc_driver::throwInvalidArgumentException(_methodName, *this);
+ } catch (const sql::SQLException& e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_rConnection.getConnectionEncoding());
+ }
+ return boolMetaData;
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::impl_getBoolMetaData() -I- */
+sal_Bool ODatabaseMetaData::impl_getBoolMetaData(const sal_Char* _methodName, bool (sql::DatabaseMetaData::*_Method)(int), sal_Int32 _arg )
+{
+ OSL_TRACE( "mysqlc::ODatabaseMetaData::%s", _methodName);
+ sal_Bool boolMetaData(0);
+ try {
+ boolMetaData = (meta->*_Method)( _arg ) ? sal_True : sal_False;
+ } catch (sql::MethodNotImplementedException) {
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException(_methodName, *this);
+ } catch (sql::InvalidArgumentException) {
+ mysqlc_sdbc_driver::throwInvalidArgumentException(_methodName, *this);
+ } catch (const sql::SQLException& e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_rConnection.getConnectionEncoding());
+ }
+ return boolMetaData;
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::impl_getRSTypeMetaData() -I- */
+sal_Bool ODatabaseMetaData::impl_getRSTypeMetaData(const sal_Char* _methodName, bool (sql::DatabaseMetaData::*_Method)(int), sal_Int32 _resultSetType )
+{
+ int resultSetType(sql::ResultSet::TYPE_FORWARD_ONLY);
+ switch ( _resultSetType ) {
+ case ResultSetType::SCROLL_INSENSITIVE: resultSetType = sql::ResultSet::TYPE_SCROLL_INSENSITIVE; break;
+ case ResultSetType::SCROLL_SENSITIVE: resultSetType = sql::ResultSet::TYPE_SCROLL_SENSITIVE; break;
+ }
+
+ return impl_getBoolMetaData(_methodName, _Method, resultSetType);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::getCatalogSeparator() -I- */
+OUString SAL_CALL ODatabaseMetaData::getCatalogSeparator()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getStringMetaData("getCatalogSeparator", &sql::DatabaseMetaData::getCatalogSeparator);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::getMaxBinaryLiteralLength() -I- */
+sal_Int32 SAL_CALL ODatabaseMetaData::getMaxBinaryLiteralLength()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getInt32MetaData("getMaxBinaryLiteralLength", &sql::DatabaseMetaData::getMaxBinaryLiteralLength);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::getMaxRowSize() -I- */
+sal_Int32 SAL_CALL ODatabaseMetaData::getMaxRowSize()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getInt32MetaData("getMaxRowSize", &sql::DatabaseMetaData::getMaxRowSize);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::getMaxCatalogNameLength() -I- */
+sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCatalogNameLength()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getInt32MetaData("getMaxCatalogNameLength", &sql::DatabaseMetaData::getMaxCatalogNameLength);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::getMaxCharLiteralLength() -I- */
+sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCharLiteralLength()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getInt32MetaData("getMaxCharLiteralLength", &sql::DatabaseMetaData::getMaxCharLiteralLength);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::getMaxColumnNameLength() -I- */
+sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnNameLength()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getInt32MetaData("getMaxColumnNameLength", &sql::DatabaseMetaData::getMaxColumnNameLength);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::getMaxColumnsInIndex() -I- */
+sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInIndex()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getInt32MetaData("getMaxColumnsInIndex", &sql::DatabaseMetaData::getMaxColumnsInIndex);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::getMaxCursorNameLength() -I- */
+sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCursorNameLength()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getInt32MetaData("getMaxCursorNameLength", &sql::DatabaseMetaData::getMaxCursorNameLength);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::getMaxConnections() -I- */
+sal_Int32 SAL_CALL ODatabaseMetaData::getMaxConnections()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getInt32MetaData("getMaxConnections", &sql::DatabaseMetaData::getMaxConnections);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::getMaxColumnsInTable() -I- */
+sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInTable()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getInt32MetaData("getMaxColumnsInTable", &sql::DatabaseMetaData::getMaxColumnsInTable);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::getMaxStatementLength() -I- */
+sal_Int32 SAL_CALL ODatabaseMetaData::getMaxStatementLength()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getInt32MetaData("getMaxStatementLength", &sql::DatabaseMetaData::getMaxStatementLength);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::getMaxTableNameLength() -I- */
+sal_Int32 SAL_CALL ODatabaseMetaData::getMaxTableNameLength()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getInt32MetaData("getMaxTableNameLength", &sql::DatabaseMetaData::getMaxTableNameLength);
+}
+/* }}} */
+
+/* {{{ ODatabaseMetaData::getMaxTablesInSelect() -I- */
+sal_Int32 SAL_CALL ODatabaseMetaData::getMaxTablesInSelect()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getInt32MetaData("getMaxTablesInSelect", &sql::DatabaseMetaData::getMaxTablesInSelect);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::doesMaxRowSizeIncludeBlobs() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::doesMaxRowSizeIncludeBlobs()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("doesMaxRowSizeIncludeBlobs", &sql::DatabaseMetaData::doesMaxRowSizeIncludeBlobs);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::storesLowerCaseQuotedIdentifiers() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::storesLowerCaseQuotedIdentifiers()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("storesLowerCaseQuotedIdentifiers", &sql::DatabaseMetaData::storesLowerCaseQuotedIdentifiers);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::storesLowerCaseIdentifiers() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::storesLowerCaseIdentifiers()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("storesLowerCaseIdentifiers", &sql::DatabaseMetaData::storesLowerCaseIdentifiers);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::storesMixedCaseQuotedIdentifiers() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::storesMixedCaseQuotedIdentifiers()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("storesMixedCaseQuotedIdentifiers", &sql::DatabaseMetaData::storesMixedCaseQuotedIdentifiers);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::storesMixedCaseIdentifiers() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::storesMixedCaseIdentifiers()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("storesMixedCaseIdentifiers", &sql::DatabaseMetaData::storesMixedCaseIdentifiers);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::storesUpperCaseQuotedIdentifiers() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::storesUpperCaseQuotedIdentifiers()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("storesUpperCaseQuotedIdentifiers", &sql::DatabaseMetaData::storesUpperCaseQuotedIdentifiers);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::storesUpperCaseIdentifiers() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::storesUpperCaseIdentifiers()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("storesUpperCaseIdentifiers", &sql::DatabaseMetaData::storesUpperCaseIdentifiers);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::supportsAlterTableWithAddColumn() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::supportsAlterTableWithAddColumn()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("supportsAlterTableWithAddColumn", &sql::DatabaseMetaData::supportsAlterTableWithAddColumn);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::supportsAlterTableWithDropColumn() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::supportsAlterTableWithDropColumn()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("supportsAlterTableWithDropColumn", &sql::DatabaseMetaData::supportsAlterTableWithDropColumn);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::getMaxIndexLength() -I- */
+sal_Int32 SAL_CALL ODatabaseMetaData::getMaxIndexLength()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getInt32MetaData("getMaxIndexLength", &sql::DatabaseMetaData::getMaxIndexLength);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::supportsNonNullableColumns() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::supportsNonNullableColumns()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("supportsNonNullableColumns", &sql::DatabaseMetaData::supportsNonNullableColumns);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::getCatalogTerm() -I- */
+OUString SAL_CALL ODatabaseMetaData::getCatalogTerm()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getStringMetaData("getCatalogTerm", &sql::DatabaseMetaData::getCatalogTerm);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::getIdentifierQuoteString() -I- */
+OUString SAL_CALL ODatabaseMetaData::getIdentifierQuoteString()
+ throw(SQLException, RuntimeException)
+{
+ if (identifier_quote_string_set == false) {
+ identifier_quote_string = impl_getStringMetaData("getIdentifierQuoteString", &sql::DatabaseMetaData::getIdentifierQuoteString);
+ identifier_quote_string_set = true;
+ }
+ return identifier_quote_string;
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::getExtraNameCharacters() -I- */
+OUString SAL_CALL ODatabaseMetaData::getExtraNameCharacters()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getStringMetaData("getExtraNameCharacters", &sql::DatabaseMetaData::getExtraNameCharacters);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::supportsDifferentTableCorrelationNames() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::supportsDifferentTableCorrelationNames()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("supportsDifferentTableCorrelationNames", &sql::DatabaseMetaData::supportsDifferentTableCorrelationNames);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::isCatalogAtStart() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::isCatalogAtStart()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("isCatalogAtStart", &sql::DatabaseMetaData::isCatalogAtStart);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::dataDefinitionIgnoredInTransactions() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::dataDefinitionIgnoredInTransactions()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("dataDefinitionIgnoredInTransactions", &sql::DatabaseMetaData::dataDefinitionIgnoredInTransactions);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::dataDefinitionCausesTransactionCommit() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::dataDefinitionCausesTransactionCommit()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("dataDefinitionCausesTransactionCommit", &sql::DatabaseMetaData::dataDefinitionCausesTransactionCommit);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::supportsDataManipulationTransactionsOnly() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::supportsDataManipulationTransactionsOnly()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("supportsDataManipulationTransactionsOnly", &sql::DatabaseMetaData::supportsDataManipulationTransactionsOnly);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::supportsDataDefinitionAndDataManipulationTransactions() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::supportsDataDefinitionAndDataManipulationTransactions()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("supportsDataDefinitionAndDataManipulationTransactions", &sql::DatabaseMetaData::supportsDataDefinitionAndDataManipulationTransactions);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::supportsPositionedDelete() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::supportsPositionedDelete()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("supportsPositionedDelete", &sql::DatabaseMetaData::supportsPositionedDelete);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::supportsPositionedUpdate() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::supportsPositionedUpdate()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("supportsPositionedUpdate", &sql::DatabaseMetaData::supportsPositionedUpdate);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::supportsOpenStatementsAcrossRollback() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenStatementsAcrossRollback()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("supportsOpenStatementsAcrossRollback", &sql::DatabaseMetaData::supportsOpenStatementsAcrossRollback);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::supportsOpenStatementsAcrossCommit() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenStatementsAcrossCommit()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("supportsOpenStatementsAcrossCommit", &sql::DatabaseMetaData::supportsOpenStatementsAcrossCommit);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::supportsOpenCursorsAcrossCommit() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenCursorsAcrossCommit()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("supportsOpenCursorsAcrossCommit", &sql::DatabaseMetaData::supportsOpenCursorsAcrossCommit);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::supportsOpenCursorsAcrossRollback() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenCursorsAcrossRollback()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("supportsOpenCursorsAcrossRollback", &sql::DatabaseMetaData::supportsOpenCursorsAcrossRollback);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::supportsTransactionIsolationLevel() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::supportsTransactionIsolationLevel(sal_Int32 level)
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("supportsTransactionIsolationLevel", &sql::DatabaseMetaData::supportsTransactionIsolationLevel, level);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::supportsSchemasInDataManipulation() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInDataManipulation()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("supportsSchemasInDataManipulation", &sql::DatabaseMetaData::supportsSchemasInDataManipulation);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::supportsANSI92FullSQL() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92FullSQL()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("supportsANSI92FullSQL", &sql::DatabaseMetaData::supportsANSI92FullSQL);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::supportsANSI92EntryLevelSQL() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92EntryLevelSQL()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("supportsANSI92EntryLevelSQL", &sql::DatabaseMetaData::supportsANSI92EntryLevelSQL);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::supportsIntegrityEnhancementFacility() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::supportsIntegrityEnhancementFacility()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("supportsIntegrityEnhancementFacility", &sql::DatabaseMetaData::supportsIntegrityEnhancementFacility);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::supportsSchemasInIndexDefinitions() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInIndexDefinitions()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("supportsSchemasInIndexDefinitions", &sql::DatabaseMetaData::supportsSchemasInIndexDefinitions);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::supportsSchemasInTableDefinitions() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInTableDefinitions()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("supportsSchemasInTableDefinitions", &sql::DatabaseMetaData::supportsSchemasInTableDefinitions);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::supportsCatalogsInTableDefinitions() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInTableDefinitions()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("supportsCatalogsInTableDefinitions", &sql::DatabaseMetaData::supportsCatalogsInTableDefinitions);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::supportsCatalogsInIndexDefinitions() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInIndexDefinitions()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("supportsCatalogsInIndexDefinitions", &sql::DatabaseMetaData::supportsCatalogsInIndexDefinitions);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::supportsCatalogsInDataManipulation() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInDataManipulation()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("supportsCatalogsInDataManipulation", &sql::DatabaseMetaData::supportsCatalogsInDataManipulation);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::supportsOuterJoins() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::supportsOuterJoins()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("supportsOuterJoins", &sql::DatabaseMetaData::supportsOuterJoins);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::getMaxStatements() -I- */
+sal_Int32 SAL_CALL ODatabaseMetaData::getMaxStatements()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getInt32MetaData("getMaxStatements", &sql::DatabaseMetaData::getMaxStatements);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::getMaxProcedureNameLength() -I- */
+sal_Int32 SAL_CALL ODatabaseMetaData::getMaxProcedureNameLength()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getInt32MetaData("getMaxProcedureNameLength", &sql::DatabaseMetaData::getMaxProcedureNameLength);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::getMaxSchemaNameLength() -I- */
+sal_Int32 SAL_CALL ODatabaseMetaData::getMaxSchemaNameLength()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getInt32MetaData("getMaxSchemaNameLength", &sql::DatabaseMetaData::getMaxSchemaNameLength);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::supportsTransactions() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::supportsTransactions()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("supportsTransactions", &sql::DatabaseMetaData::supportsTransactions);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::allProceduresAreCallable() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::allProceduresAreCallable()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("allProceduresAreCallable", &sql::DatabaseMetaData::allProceduresAreCallable);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::supportsStoredProcedures() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::supportsStoredProcedures()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("supportsStoredProcedures", &sql::DatabaseMetaData::supportsStoredProcedures);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::supportsSelectForUpdate() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::supportsSelectForUpdate()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("supportsSelectForUpdate", &sql::DatabaseMetaData::supportsSelectForUpdate);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::allTablesAreSelectable() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::allTablesAreSelectable()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("allTablesAreSelectable", &sql::DatabaseMetaData::allTablesAreSelectable);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::isReadOnly() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::isReadOnly()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("isReadOnly", &sql::DatabaseMetaData::isReadOnly);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::usesLocalFiles() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::usesLocalFiles()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("usesLocalFiles", &sql::DatabaseMetaData::usesLocalFiles);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::usesLocalFilePerTable() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::usesLocalFilePerTable()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("usesLocalFilePerTable", &sql::DatabaseMetaData::usesLocalFilePerTable);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::supportsTypeConversion() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::supportsTypeConversion()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("supportsTypeConversion", &sql::DatabaseMetaData::supportsTypeConversion);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::nullPlusNonNullIsNull() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::nullPlusNonNullIsNull()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("nullPlusNonNullIsNull", &sql::DatabaseMetaData::nullPlusNonNullIsNull);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::supportsColumnAliasing() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::supportsColumnAliasing()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("supportsColumnAliasing", &sql::DatabaseMetaData::supportsColumnAliasing);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::supportsTableCorrelationNames() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::supportsTableCorrelationNames()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("supportsTableCorrelationNames", &sql::DatabaseMetaData::supportsTableCorrelationNames);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::supportsConvert() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::supportsConvert(sal_Int32 /* fromType */, sal_Int32 /* toType */)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("ODatabaseMetaData::supportsConvert");
+ try {
+ /* ToDo -> use supportsConvert( fromType, toType) */
+ return meta->supportsConvert()? sal_True:sal_False;
+ } catch (sql::MethodNotImplementedException) {
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("ODatabaseMetaData::supportsConvert", *this);
+ } catch (sql::InvalidArgumentException) {
+ mysqlc_sdbc_driver::throwInvalidArgumentException("ODatabaseMetaData::supportsConvert", *this);
+ } catch (const sql::SQLException& e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_rConnection.getConnectionEncoding());
+ }
+ return sal_False;
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::supportsExpressionsInOrderBy() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::supportsExpressionsInOrderBy()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("supportsExpressionsInOrderBy", &sql::DatabaseMetaData::supportsExpressionsInOrderBy);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::supportsGroupBy() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupBy()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("supportsGroupBy", &sql::DatabaseMetaData::supportsGroupBy);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::supportsGroupByBeyondSelect() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupByBeyondSelect()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("supportsGroupByBeyondSelect", &sql::DatabaseMetaData::supportsGroupByBeyondSelect);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::supportsGroupByUnrelated() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupByUnrelated()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("supportsGroupByUnrelated", &sql::DatabaseMetaData::supportsGroupByUnrelated);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::supportsMultipleTransactions() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::supportsMultipleTransactions()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("supportsMultipleTransactions", &sql::DatabaseMetaData::supportsMultipleTransactions);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::supportsMultipleResultSets() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::supportsMultipleResultSets()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("supportsMultipleResultSets", &sql::DatabaseMetaData::supportsMultipleResultSets);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::supportsLikeEscapeClause() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::supportsLikeEscapeClause()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("supportsLikeEscapeClause", &sql::DatabaseMetaData::supportsLikeEscapeClause);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::supportsOrderByUnrelated() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::supportsOrderByUnrelated()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("supportsOrderByUnrelated", &sql::DatabaseMetaData::supportsOrderByUnrelated);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::supportsUnion() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::supportsUnion()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("supportsUnion", &sql::DatabaseMetaData::supportsUnion);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::supportsUnionAll() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::supportsUnionAll()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("supportsUnionAll", &sql::DatabaseMetaData::supportsUnionAll);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::supportsMixedCaseIdentifiers() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::supportsMixedCaseIdentifiers()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("supportsMixedCaseIdentifiers", &sql::DatabaseMetaData::supportsMixedCaseIdentifiers);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::supportsMixedCaseQuotedIdentifiers() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::supportsMixedCaseQuotedIdentifiers()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("supportsMixedCaseQuotedIdentifiers", &sql::DatabaseMetaData::supportsMixedCaseQuotedIdentifiers);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::nullsAreSortedAtEnd() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedAtEnd()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("nullsAreSortedAtEnd", &sql::DatabaseMetaData::nullsAreSortedAtEnd);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::nullsAreSortedAtStart() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedAtStart()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("nullsAreSortedAtStart", &sql::DatabaseMetaData::nullsAreSortedAtStart);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::nullsAreSortedHigh() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedHigh()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("nullsAreSortedHigh", &sql::DatabaseMetaData::nullsAreSortedHigh);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::nullsAreSortedLow() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedLow()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("nullsAreSortedLow", &sql::DatabaseMetaData::nullsAreSortedLow);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::supportsSchemasInProcedureCalls() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInProcedureCalls()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("supportsSchemasInProcedureCalls", &sql::DatabaseMetaData::supportsSchemasInProcedureCalls);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::supportsSchemasInPrivilegeDefinitions() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInPrivilegeDefinitions()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("supportsSchemasInPrivilegeDefinitions", &sql::DatabaseMetaData::supportsSchemasInPrivilegeDefinitions);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::supportsCatalogsInProcedureCalls() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInProcedureCalls()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("supportsCatalogsInProcedureCalls", &sql::DatabaseMetaData::supportsCatalogsInProcedureCalls);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::supportsCatalogsInPrivilegeDefinitions() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInPrivilegeDefinitions()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("supportsCatalogsInPrivilegeDefinitions", &sql::DatabaseMetaData::supportsCatalogsInPrivilegeDefinitions);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::supportsCorrelatedSubqueries() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::supportsCorrelatedSubqueries()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("supportsCorrelatedSubqueries", &sql::DatabaseMetaData::supportsCorrelatedSubqueries);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::supportsSubqueriesInComparisons() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInComparisons()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("supportsSubqueriesInComparisons", &sql::DatabaseMetaData::supportsSubqueriesInComparisons);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::supportsSubqueriesInExists() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInExists()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("supportsSubqueriesInExists", &sql::DatabaseMetaData::supportsSubqueriesInExists);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::supportsSubqueriesInIns() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInIns()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("supportsSubqueriesInIns", &sql::DatabaseMetaData::supportsSubqueriesInIns);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::supportsSubqueriesInQuantifieds() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInQuantifieds()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("supportsSubqueriesInQuantifieds", &sql::DatabaseMetaData::supportsSubqueriesInQuantifieds);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::supportsANSI92IntermediateSQL() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92IntermediateSQL()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("supportsANSI92IntermediateSQL", &sql::DatabaseMetaData::supportsANSI92IntermediateSQL);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::getURL() -I- */
+OUString SAL_CALL ODatabaseMetaData::getURL()
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("ODatabaseMetaData::getURL");
+ return m_rConnection.getConnectionSettings().connectionURL;
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::getUserName() -I- */
+OUString SAL_CALL ODatabaseMetaData::getUserName()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getStringMetaData("getUserName", &sql::DatabaseMetaData::getUserName);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::getDriverName() -I- */
+OUString SAL_CALL ODatabaseMetaData::getDriverName()
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("ODatabaseMetaData::getDriverName");
+ OUString aValue( RTL_CONSTASCII_USTRINGPARAM( "MySQL Connector/OO.org" ) );
+ return aValue;
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::getDriverVersion() -I- */
+OUString SAL_CALL ODatabaseMetaData::getDriverVersion()
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("ODatabaseMetaData::getDriverVersion");
+ static const OUString sVersion( RTL_CONSTASCII_USTRINGPARAM( "0.9.2" ) );
+ return sVersion;
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::getDatabaseProductVersion() -I- */
+OUString SAL_CALL ODatabaseMetaData::getDatabaseProductVersion()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getStringMetaData("getDatabaseProductVersion", &sql::DatabaseMetaData::getDatabaseProductVersion);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::getDatabaseProductName() -I- */
+OUString SAL_CALL ODatabaseMetaData::getDatabaseProductName()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getStringMetaData("getDatabaseProductName", &sql::DatabaseMetaData::getDatabaseProductName);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::getProcedureTerm() -I- */
+OUString SAL_CALL ODatabaseMetaData::getProcedureTerm()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getStringMetaData("getProcedureTerm", &sql::DatabaseMetaData::getProcedureTerm);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::getSchemaTerm() -I- */
+OUString SAL_CALL ODatabaseMetaData::getSchemaTerm()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getStringMetaData("getSchemaTerm", &sql::DatabaseMetaData::getSchemaTerm);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::getDriverMajorVersion() -I- */
+sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMajorVersion()
+ throw(RuntimeException)
+{
+ OSL_TRACE("ODatabaseMetaData::getDriverMajorVersion");
+ return MYSQLC_VERSION_MAJOR;
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::getDefaultTransactionIsolation() -I- */
+sal_Int32 SAL_CALL ODatabaseMetaData::getDefaultTransactionIsolation()
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("ODatabaseMetaData::getDefaultTransactionIsolation");
+ try {
+ switch (meta->getDefaultTransactionIsolation()) {
+ case sql::TRANSACTION_SERIALIZABLE: return TransactionIsolation::SERIALIZABLE;
+ case sql::TRANSACTION_REPEATABLE_READ: return TransactionIsolation::REPEATABLE_READ;
+ case sql::TRANSACTION_READ_COMMITTED: return TransactionIsolation::READ_COMMITTED;
+ case sql::TRANSACTION_READ_UNCOMMITTED: return TransactionIsolation::READ_UNCOMMITTED;
+ }
+ } catch (sql::MethodNotImplementedException) {
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("ODatabaseMetaData::getDriverMajorVersion", *this);
+ } catch (sql::InvalidArgumentException) {
+ mysqlc_sdbc_driver::throwInvalidArgumentException("ODatabaseMetaData::getDriverMajorVersion", *this);
+ } catch (const sql::SQLException& e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_rConnection.getConnectionEncoding());
+ }
+ return TransactionIsolation::NONE;
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::getDriverMinorVersion() -I- */
+sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMinorVersion()
+ throw(RuntimeException)
+{
+ OSL_TRACE("ODatabaseMetaData::getDriverMinorVersion");
+ return MYSQLC_VERSION_MINOR;
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::getSQLKeywords() -I- */
+OUString SAL_CALL ODatabaseMetaData::getSQLKeywords()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getStringMetaData("getSQLKeywords", &sql::DatabaseMetaData::getSQLKeywords);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::getSearchStringEscape() -I- */
+OUString SAL_CALL ODatabaseMetaData::getSearchStringEscape()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getStringMetaData("getSearchStringEscape", &sql::DatabaseMetaData::getSearchStringEscape);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::getStringFunctions() -I- */
+OUString SAL_CALL ODatabaseMetaData::getStringFunctions()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getStringMetaData("getStringFunctions", &sql::DatabaseMetaData::getStringFunctions);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::getTimeDateFunctions() -I- */
+OUString SAL_CALL ODatabaseMetaData::getTimeDateFunctions()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getStringMetaData("getTimeDateFunctions", &sql::DatabaseMetaData::getTimeDateFunctions);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::getSystemFunctions() -I- */
+OUString SAL_CALL ODatabaseMetaData::getSystemFunctions()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getStringMetaData("getSystemFunctions", &sql::DatabaseMetaData::getSystemFunctions);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::getNumericFunctions() -I- */
+OUString SAL_CALL ODatabaseMetaData::getNumericFunctions()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getStringMetaData("getNumericFunctions", &sql::DatabaseMetaData::getNumericFunctions);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::supportsExtendedSQLGrammar() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::supportsExtendedSQLGrammar()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("supportsExtendedSQLGrammar", &sql::DatabaseMetaData::supportsExtendedSQLGrammar);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::supportsCoreSQLGrammar() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::supportsCoreSQLGrammar()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("supportsCoreSQLGrammar", &sql::DatabaseMetaData::supportsCoreSQLGrammar);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::supportsMinimumSQLGrammar() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::supportsMinimumSQLGrammar()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("supportsMinimumSQLGrammar", &sql::DatabaseMetaData::supportsMinimumSQLGrammar);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::supportsFullOuterJoins() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::supportsFullOuterJoins()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("supportsFullOuterJoins", &sql::DatabaseMetaData::supportsFullOuterJoins);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::supportsLimitedOuterJoins() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::supportsLimitedOuterJoins()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("supportsLimitedOuterJoins", &sql::DatabaseMetaData::supportsLimitedOuterJoins);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::getMaxColumnsInGroupBy() -I- */
+sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInGroupBy()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getInt32MetaData("getMaxColumnsInGroupBy", &sql::DatabaseMetaData::getMaxColumnsInGroupBy);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::getMaxColumnsInOrderBy() -I- */
+sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInOrderBy()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getInt32MetaData("getMaxColumnsInOrderBy", &sql::DatabaseMetaData::getMaxColumnsInOrderBy);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::getMaxColumnsInSelect() -I- */
+sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInSelect()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getInt32MetaData("getMaxColumnsInSelect", &sql::DatabaseMetaData::getMaxColumnsInSelect);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::getMaxUserNameLength() -I- */
+sal_Int32 SAL_CALL ODatabaseMetaData::getMaxUserNameLength()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getInt32MetaData("getMaxUserNameLength", &sql::DatabaseMetaData::getMaxUserNameLength);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::supportsResultSetType() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::supportsResultSetType(sal_Int32 setType)
+ throw(SQLException, RuntimeException)
+{
+ return impl_getRSTypeMetaData("supportsResultSetType", &sql::DatabaseMetaData::supportsResultSetType, setType);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::supportsResultSetConcurrency() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::supportsResultSetConcurrency(sal_Int32 setType, sal_Int32 concurrency)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("ODatabaseMetaData::supportsResultSetConcurrency");
+ /* TODO: Check this out */
+ try {
+ return meta->supportsResultSetConcurrency(setType, concurrency==com::sun::star::sdbc::TransactionIsolation::READ_COMMITTED?
+ sql::TRANSACTION_READ_COMMITTED:
+ (concurrency == com::sun::star::sdbc::TransactionIsolation::SERIALIZABLE?
+ sql::TRANSACTION_SERIALIZABLE:sql::TRANSACTION_SERIALIZABLE))? sal_True:sal_False;
+ } catch (sql::MethodNotImplementedException) {
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("ODatabaseMetaData::supportsResultSetConcurrency", *this);
+ } catch (sql::InvalidArgumentException) {
+ mysqlc_sdbc_driver::throwInvalidArgumentException("ODatabaseMetaData::supportsResultSetConcurrency", *this);
+ } catch (const sql::SQLException& e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_rConnection.getConnectionEncoding());
+ }
+ return sal_False;
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::ownUpdatesAreVisible() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::ownUpdatesAreVisible(sal_Int32 setType)
+ throw(SQLException, RuntimeException)
+{
+ return impl_getRSTypeMetaData("ownUpdatesAreVisible", &sql::DatabaseMetaData::ownUpdatesAreVisible, setType);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::ownDeletesAreVisible() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::ownDeletesAreVisible(sal_Int32 setType)
+ throw(SQLException, RuntimeException)
+{
+ return impl_getRSTypeMetaData("ownDeletesAreVisible", &sql::DatabaseMetaData::ownDeletesAreVisible, setType);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::ownInsertsAreVisible() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::ownInsertsAreVisible(sal_Int32 setType)
+ throw(SQLException, RuntimeException)
+{
+ return impl_getRSTypeMetaData("ownInsertsAreVisible", &sql::DatabaseMetaData::ownInsertsAreVisible, setType);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::othersUpdatesAreVisible() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::othersUpdatesAreVisible(sal_Int32 setType)
+ throw(SQLException, RuntimeException)
+{
+ return impl_getRSTypeMetaData("othersUpdatesAreVisible", &sql::DatabaseMetaData::othersUpdatesAreVisible, setType);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::othersDeletesAreVisible() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::othersDeletesAreVisible(sal_Int32 setType)
+ throw(SQLException, RuntimeException)
+{
+ return impl_getRSTypeMetaData("othersDeletesAreVisible", &sql::DatabaseMetaData::othersDeletesAreVisible, setType);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::othersInsertsAreVisible() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::othersInsertsAreVisible(sal_Int32 setType)
+ throw(SQLException, RuntimeException)
+{
+ return impl_getRSTypeMetaData("othersInsertsAreVisible", &sql::DatabaseMetaData::othersInsertsAreVisible, setType);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::updatesAreDetected() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::updatesAreDetected(sal_Int32 setType)
+ throw(SQLException, RuntimeException)
+{
+ return impl_getRSTypeMetaData("updatesAreDetected", &sql::DatabaseMetaData::updatesAreDetected, setType);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::deletesAreDetected() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::deletesAreDetected(sal_Int32 setType)
+ throw(SQLException, RuntimeException)
+{
+ return impl_getRSTypeMetaData("deletesAreDetected", &sql::DatabaseMetaData::deletesAreDetected, setType);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::insertsAreDetected() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::insertsAreDetected(sal_Int32 setType)
+ throw(SQLException, RuntimeException)
+{
+ return impl_getRSTypeMetaData("insertsAreDetected", &sql::DatabaseMetaData::insertsAreDetected, setType);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::supportsBatchUpdates() -I- */
+sal_Bool SAL_CALL ODatabaseMetaData::supportsBatchUpdates()
+ throw(SQLException, RuntimeException)
+{
+ return impl_getBoolMetaData("supportsBatchUpdates", &sql::DatabaseMetaData::supportsBatchUpdates);
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::getConnection() -I- */
+Reference< XConnection > SAL_CALL ODatabaseMetaData::getConnection()
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("ODatabaseMetaData::getConnection");
+ return (Reference< XConnection >)&m_rConnection;
+}
+/* }}} */
+
+
+/*
+ Here follow all methods which return(a resultset
+ the first methods is an example implementation how to use this resultset
+ of course you could implement it on your and you should do this because
+ the general way is more memory expensive
+*/
+
+/* {{{ ODatabaseMetaData::getTableTypes() -I- */
+Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTableTypes()
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("ODatabaseMetaData::getTableTypes");
+ const char * table_types[] = {"TABLE", "VIEW"};
+ sal_Int32 requiredVersion[] = {0, 50000};
+
+ Reference< XResultSet > xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.helper.DatabaseMetaDataResultSet"))),UNO_QUERY);
+ std::vector< std::vector< Any > > rRows;
+ rtl_TextEncoding encoding = m_rConnection.getConnectionEncoding();
+
+ for (sal_uInt32 i = 0; i < 2; i++) {
+ if (m_rConnection.getMysqlVersion() >= requiredVersion[i]) {
+ std::vector< Any > aRow(1);
+ aRow.push_back(makeAny(mysqlc_sdbc_driver::convert(table_types[i], encoding)));
+ rRows.push_back(aRow);
+ }
+ }
+ lcl_setRows_throw(xResultSet, 5 ,rRows);
+ return xResultSet;
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::getTypeInfo() -I- */
+Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTypeInfo()
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("ODatabaseMetaData::getTypeInfo");
+ Reference< XResultSet > xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.helper.DatabaseMetaDataResultSet"))),UNO_QUERY);
+
+ std::vector< std::vector< Any > > rRows;
+
+ rtl_TextEncoding encoding = m_rConnection.getConnectionEncoding();
+ unsigned int i = 0;
+ while (mysqlc_types[i].typeName) {
+ std::vector< Any > aRow(1);
+
+ aRow.push_back(makeAny(mysqlc_sdbc_driver::convert(mysqlc_types[i].typeName, encoding)));
+ aRow.push_back(makeAny(mysqlc_types[i].dataType));
+ aRow.push_back(makeAny(mysqlc_types[i].precision));
+ aRow.push_back(makeAny(mysqlc_sdbc_driver::convert(mysqlc_types[i].literalPrefix, encoding)));
+ aRow.push_back(makeAny(mysqlc_sdbc_driver::convert(mysqlc_types[i].literalSuffix, encoding)));
+ aRow.push_back(makeAny(mysqlc_sdbc_driver::convert(mysqlc_types[i].createParams, encoding)));
+ aRow.push_back(makeAny(mysqlc_types[i].nullable));
+ aRow.push_back(makeAny(mysqlc_types[i].caseSensitive));
+ aRow.push_back(makeAny(mysqlc_types[i].searchable));
+ aRow.push_back(makeAny(mysqlc_types[i].isUnsigned));
+ aRow.push_back(makeAny(mysqlc_types[i].fixedPrecScale));
+ aRow.push_back(makeAny(mysqlc_types[i].autoIncrement));
+ aRow.push_back(makeAny(mysqlc_sdbc_driver::convert(mysqlc_types[i].localTypeName, encoding)));
+ aRow.push_back(makeAny(mysqlc_types[i].minScale));
+ aRow.push_back(makeAny(mysqlc_types[i].maxScale));
+ aRow.push_back(makeAny(sal_Int32(0)));
+ aRow.push_back(makeAny(sal_Int32(0)));
+ aRow.push_back(makeAny(sal_Int32(10)));
+
+ rRows.push_back(aRow);
+ i++;
+ }
+
+ lcl_setRows_throw(xResultSet, 14, rRows);
+ return xResultSet;
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::getCatalogs() -I- */
+Reference< XResultSet > SAL_CALL ODatabaseMetaData::getCatalogs()
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("ODatabaseMetaData::getCatalogs");
+
+ Reference< XResultSet > xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.helper.DatabaseMetaDataResultSet"))),UNO_QUERY);
+ std::vector< std::vector< Any > > rRows;
+
+ try {
+ rtl_TextEncoding encoding = m_rConnection.getConnectionEncoding();
+ std::auto_ptr< sql::ResultSet> rset( meta->getCatalogs());
+ sql::ResultSetMetaData * rs_meta = rset->getMetaData();
+ sal_uInt32 columns = rs_meta->getColumnCount();
+ while (rset->next()) {
+ std::vector< Any > aRow(1);
+ for (sal_uInt32 i = 1; i <= columns; i++) {
+ aRow.push_back(makeAny(mysqlc_sdbc_driver::convert(rset->getString(i), encoding)));
+ }
+ rRows.push_back(aRow);
+ }
+ } catch (sql::MethodNotImplementedException) {
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("ODatabaseMetaData::getCatalogs", *this);
+ } catch (sql::InvalidArgumentException) {
+ mysqlc_sdbc_driver::throwInvalidArgumentException("ODatabaseMetaData::getCatalogs", *this);
+ } catch (const sql::SQLException& e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_rConnection.getConnectionEncoding());
+ }
+
+ lcl_setRows_throw(xResultSet, 0, rRows);
+ return xResultSet;
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::getSchemas() -I- */
+Reference< XResultSet > SAL_CALL ODatabaseMetaData::getSchemas()
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("ODatabaseMetaData::getSchemas");
+
+ Reference< XResultSet > xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.helper.DatabaseMetaDataResultSet"))),UNO_QUERY);
+ std::vector< std::vector< Any > > rRows;
+
+ try {
+ rtl_TextEncoding encoding = m_rConnection.getConnectionEncoding();
+ std::auto_ptr< sql::ResultSet> rset( meta->getSchemas());
+ sql::ResultSetMetaData * rs_meta = rset->getMetaData();
+ sal_uInt32 columns = rs_meta->getColumnCount();
+ while (rset->next()) {
+ std::vector< Any > aRow(1);
+ bool informationSchema = false;
+ for (sal_uInt32 i = 1; i <= columns; i++) {
+ sql::SQLString columnStringValue = rset->getString(i);
+ if (i == 1) { // TABLE_SCHEM
+ informationSchema = (0 == columnStringValue.compare("information_schema"));
+ }
+ aRow.push_back(makeAny(mysqlc_sdbc_driver::convert(columnStringValue, encoding)));
+ }
+ if (!informationSchema ) {
+ rRows.push_back(aRow);
+ }
+ }
+ } catch (sql::MethodNotImplementedException) {
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("ODatabaseMetaData::getSchemas", *this);
+ } catch (sql::InvalidArgumentException) {
+ mysqlc_sdbc_driver::throwInvalidArgumentException("ODatabaseMetaData::getSchemas", *this);
+ } catch (const sql::SQLException& e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_rConnection.getConnectionEncoding());
+ }
+
+ lcl_setRows_throw(xResultSet, 1, rRows);
+ return xResultSet;
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::getColumnPrivileges() -I- */
+Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumnPrivileges(
+ const Any& catalog,
+ const OUString& schema,
+ const OUString& table,
+ const OUString& columnNamePattern)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("ODatabaseMetaData::getColumnPrivileges");
+ Reference< XResultSet > xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.helper.DatabaseMetaDataResultSet"))),UNO_QUERY);
+ std::vector< std::vector< Any > > rRows;
+
+ std::string cat(catalog.hasValue()? OUStringToOString(getStringFromAny(catalog), m_rConnection.getConnectionEncoding()).getStr():""),
+ sch(OUStringToOString(schema, m_rConnection.getConnectionEncoding()).getStr()),
+ tab(OUStringToOString(table, m_rConnection.getConnectionEncoding()).getStr()),
+ cNamePattern(OUStringToOString(columnNamePattern, m_rConnection.getConnectionEncoding()).getStr());
+ try {
+ rtl_TextEncoding encoding = m_rConnection.getConnectionEncoding();
+ std::auto_ptr< sql::ResultSet> rset( meta->getColumnPrivileges(cat, sch, tab, cNamePattern.compare("")? cNamePattern:wild));
+
+ sql::ResultSetMetaData * rs_meta = rset->getMetaData();
+ sal_uInt32 columns = rs_meta->getColumnCount();
+ while (rset->next()) {
+ std::vector< Any > aRow(1);
+ for (sal_uInt32 i = 1; i <= columns; i++) {
+ aRow.push_back(makeAny(mysqlc_sdbc_driver::convert(rset->getString(i), encoding)));
+ }
+ rRows.push_back(aRow);
+ }
+ } catch (sql::MethodNotImplementedException) {
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("ODatabaseMetaData::getColumnPrivileges", *this);
+ } catch (sql::InvalidArgumentException) {
+ mysqlc_sdbc_driver::throwInvalidArgumentException("ODatabaseMetaData::getColumnPrivileges", *this);
+ } catch (const sql::SQLException& e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_rConnection.getConnectionEncoding());
+ }
+
+ lcl_setRows_throw(xResultSet, 2, rRows);
+ return xResultSet;
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::getColumns() -I- */
+Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumns(
+ const Any& catalog,
+ const OUString& schemaPattern,
+ const OUString& tableNamePattern,
+ const OUString& columnNamePattern)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("ODatabaseMetaData::getColumns");
+ Reference< XResultSet > xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.helper.DatabaseMetaDataResultSet"))),UNO_QUERY);
+ std::vector< std::vector< Any > > rRows;
+ std::string cat(catalog.hasValue()? OUStringToOString(getStringFromAny(catalog), m_rConnection.getConnectionEncoding()).getStr():""),
+ sPattern(OUStringToOString(schemaPattern, m_rConnection.getConnectionEncoding()).getStr()),
+ tNamePattern(OUStringToOString(tableNamePattern, m_rConnection.getConnectionEncoding()).getStr()),
+ cNamePattern(OUStringToOString(columnNamePattern, m_rConnection.getConnectionEncoding()).getStr());
+
+ try {
+ std::auto_ptr< sql::ResultSet> rset( meta->getColumns(cat,
+ sPattern.compare("")? sPattern:wild,
+ tNamePattern.compare("")? tNamePattern:wild,
+ cNamePattern.compare("")? cNamePattern:wild));
+ rtl_TextEncoding encoding = m_rConnection.getConnectionEncoding();
+ sql::ResultSetMetaData * rs_meta = rset->getMetaData();
+ sal_uInt32 columns = rs_meta->getColumnCount();
+ while (rset->next()) {
+ std::vector< Any > aRow(1);
+ for (sal_uInt32 i = 1; i <= columns; i++) {
+ if (i == 5) { // ColumnType
+ sal_Int32 sdbc_type = mysqlc_sdbc_driver::mysqlToOOOType(atoi(rset->getString(i).c_str()));
+ aRow.push_back(makeAny(sdbc_type));
+ } else {
+ aRow.push_back(makeAny(mysqlc_sdbc_driver::convert(rset->getString(i), encoding)));
+ }
+ }
+ rRows.push_back(aRow);
+ }
+ } catch (sql::MethodNotImplementedException) {
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("ODatabaseMetaData::getColumns", *this);
+ } catch (sql::InvalidArgumentException) {
+ mysqlc_sdbc_driver::throwInvalidArgumentException("ODatabaseMetaData::getColumns", *this);
+ } catch (const sql::SQLException& e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_rConnection.getConnectionEncoding());
+ }
+ lcl_setRows_throw(xResultSet, 3, rRows);
+ return xResultSet;
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::getTables() -I- */
+Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables(
+ const Any& catalog,
+ const OUString& schemaPattern,
+ const OUString& tableNamePattern,
+ const Sequence< OUString >& types )
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("ODatabaseMetaData::getTables");
+ sal_Int32 nLength = types.getLength();
+
+ Reference< XResultSet > xResultSet(getOwnConnection().
+ getDriver().getFactory()->createInstance(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.helper.DatabaseMetaDataResultSet"))),UNO_QUERY);
+ std::vector< std::vector< Any > > rRows;
+
+ std::string cat(catalog.hasValue()? OUStringToOString(getStringFromAny(catalog), m_rConnection.getConnectionEncoding()).getStr():""),
+ sPattern(OUStringToOString(schemaPattern, m_rConnection.getConnectionEncoding()).getStr()),
+ tNamePattern(OUStringToOString(tableNamePattern, m_rConnection.getConnectionEncoding()).getStr());
+
+ std::list<sql::SQLString> tabTypes;
+ for (const OUString *pStart = types.getConstArray(), *p = pStart, *pEnd = pStart + nLength; p != pEnd; ++p) {
+ tabTypes.push_back(OUStringToOString(*p, m_rConnection.getConnectionEncoding()).getStr());
+ }
+
+ try {
+ std::auto_ptr< sql::ResultSet> rset( meta->getTables(cat,
+ sPattern.compare("")? sPattern:wild,
+ tNamePattern.compare("")? tNamePattern:wild,
+ tabTypes));
+
+ rtl_TextEncoding encoding = m_rConnection.getConnectionEncoding();
+ sql::ResultSetMetaData * rs_meta = rset->getMetaData();
+ sal_uInt32 columns = rs_meta->getColumnCount();
+ while (rset->next()) {
+ std::vector< Any > aRow(1);
+ bool informationSchema = false;
+ for (sal_uInt32 i = 1; (i <= columns) && !informationSchema; ++i) {
+ sql::SQLString columnStringValue = rset->getString(i);
+ if (i == 2) { // TABLE_SCHEM
+ informationSchema = ( 0 == columnStringValue.compare("information_schema"));
+ }
+ aRow.push_back(makeAny(mysqlc_sdbc_driver::convert(columnStringValue, encoding)));
+ }
+ if (!informationSchema) {
+ rRows.push_back(aRow);
+ }
+ }
+ } catch (sql::MethodNotImplementedException) {
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("ODatabaseMetaData::getTables", *this);
+ } catch (sql::InvalidArgumentException) {
+ mysqlc_sdbc_driver::throwInvalidArgumentException("ODatabaseMetaData::getTables", *this);
+ } catch (const sql::SQLException& e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_rConnection.getConnectionEncoding());
+ }
+
+ lcl_setRows_throw(xResultSet, 4, rRows);
+ return xResultSet;
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::getProcedureColumns() -I- */
+Reference< XResultSet > SAL_CALL ODatabaseMetaData::getProcedureColumns(
+ const Any& /* catalog */,
+ const OUString& /* schemaPattern */,
+ const OUString& /* procedureNamePattern */,
+ const OUString& /* columnNamePattern */)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("ODatabaseMetaData::getProcedureColumns");
+ // Currently there is no information available
+ return NULL;
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::getProcedures() -I- */
+Reference< XResultSet > SAL_CALL ODatabaseMetaData::getProcedures(
+ const Any& catalog,
+ const OUString& schemaPattern,
+ const OUString& procedureNamePattern)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("ODatabaseMetaData::getProcedures");
+ Reference< XResultSet > xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.helper.DatabaseMetaDataResultSet"))),UNO_QUERY);
+ std::vector< std::vector< Any > > rRows;
+
+ std::string cat(catalog.hasValue()? OUStringToOString(getStringFromAny(catalog), m_rConnection.getConnectionEncoding()).getStr():""),
+ sPattern(OUStringToOString(schemaPattern, m_rConnection.getConnectionEncoding()).getStr()),
+ pNamePattern(OUStringToOString(procedureNamePattern, m_rConnection.getConnectionEncoding()).getStr());
+
+
+ try {
+ std::auto_ptr< sql::ResultSet> rset( meta->getProcedures(cat,
+ sPattern.compare("")? sPattern:wild,
+ pNamePattern.compare("")? pNamePattern:wild));
+
+ rtl_TextEncoding encoding = m_rConnection.getConnectionEncoding();
+ sql::ResultSetMetaData * rs_meta = rset->getMetaData();
+ sal_uInt32 columns = rs_meta->getColumnCount();
+ while (rset->next()) {
+ std::vector< Any > aRow(1);
+ for (sal_uInt32 i = 1; i <= columns; i++) {
+ aRow.push_back(makeAny(mysqlc_sdbc_driver::convert(rset->getString(i), encoding)));
+ }
+ rRows.push_back(aRow);
+ }
+ } catch (sql::MethodNotImplementedException) {
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("ODatabaseMetaData::getProcedures", *this);
+ } catch (sql::InvalidArgumentException) {
+ mysqlc_sdbc_driver::throwInvalidArgumentException("ODatabaseMetaData::getProcedures", *this);
+ } catch (const sql::SQLException& e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_rConnection.getConnectionEncoding());
+ }
+
+ lcl_setRows_throw(xResultSet, 7,rRows);
+ return xResultSet;
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::getVersionColumns() -I- */
+Reference< XResultSet > SAL_CALL ODatabaseMetaData::getVersionColumns(
+ const Any& /* catalog */,
+ const OUString& /* schema */,
+ const OUString& /* table */)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("ODatabaseMetaData::getVersionColumns");
+ Reference< XResultSet > xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.helper.DatabaseMetaDataResultSet"))),UNO_QUERY);
+ std::vector< std::vector< Any > > rRows;
+ lcl_setRows_throw(xResultSet, 16,rRows);
+ return xResultSet;
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::getExportedKeys() -I- */
+Reference< XResultSet > SAL_CALL ODatabaseMetaData::getExportedKeys(
+ const Any& catalog ,
+ const OUString& schema ,
+ const OUString& table )
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("ODatabaseMetaData::getExportedKeys");
+ Reference< XResultSet > xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.helper.DatabaseMetaDataResultSet"))),UNO_QUERY);
+ std::vector< std::vector< Any > > rRows;
+ std::string cat(catalog.hasValue()? OUStringToOString(getStringFromAny(catalog), m_rConnection.getConnectionEncoding()).getStr():""),
+ sch(OUStringToOString(schema, m_rConnection.getConnectionEncoding()).getStr()),
+ tab(OUStringToOString(table, m_rConnection.getConnectionEncoding()).getStr());
+
+ try {
+ rtl_TextEncoding encoding = m_rConnection.getConnectionEncoding();
+ std::auto_ptr< sql::ResultSet> rset( meta->getExportedKeys(cat, sch, tab));
+ sql::ResultSetMetaData * rs_meta = rset->getMetaData();
+ sal_uInt32 columns = rs_meta->getColumnCount();
+ while (rset->next()) {
+ std::vector< Any > aRow(1);
+ for (sal_uInt32 i = 1; i <= columns; i++) {
+ aRow.push_back(makeAny(mysqlc_sdbc_driver::convert(rset->getString(i), encoding)));
+ }
+ rRows.push_back(aRow);
+ }
+ } catch (sql::MethodNotImplementedException) {
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("ODatabaseMetaData::getExportedKeys", *this);
+ } catch (sql::InvalidArgumentException) {
+ mysqlc_sdbc_driver::throwInvalidArgumentException("ODatabaseMetaData::getExportedKeys", *this);
+ } catch (const sql::SQLException& e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_rConnection.getConnectionEncoding());
+ }
+
+ lcl_setRows_throw(xResultSet, 8, rRows);
+ return xResultSet;
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::getImportedKeys() -I- */
+Reference< XResultSet > SAL_CALL ODatabaseMetaData::getImportedKeys(
+ const Any& catalog,
+ const OUString& schema,
+ const OUString& table)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("ODatabaseMetaData::getImportedKeys");
+
+ Reference< XResultSet > xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.helper.DatabaseMetaDataResultSet"))),UNO_QUERY);
+ std::vector< std::vector< Any > > rRows;
+
+ std::string cat(catalog.hasValue()? OUStringToOString(getStringFromAny(catalog), m_rConnection.getConnectionEncoding()).getStr():""),
+ sch(OUStringToOString(schema, m_rConnection.getConnectionEncoding()).getStr()),
+ tab(OUStringToOString(table, m_rConnection.getConnectionEncoding()).getStr());
+
+ try {
+ rtl_TextEncoding encoding = m_rConnection.getConnectionEncoding();
+ std::auto_ptr< sql::ResultSet> rset( meta->getImportedKeys(cat, sch, tab));
+ sql::ResultSetMetaData * rs_meta = rset->getMetaData();
+ sal_uInt32 columns = rs_meta->getColumnCount();
+ while (rset->next()) {
+ std::vector< Any > aRow(1);
+ for (sal_uInt32 i = 1; i <= columns; i++) {
+ aRow.push_back(makeAny(mysqlc_sdbc_driver::convert(rset->getString(i), encoding)));
+ }
+ rRows.push_back(aRow);
+ }
+ } catch (sql::MethodNotImplementedException) {
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("ODatabaseMetaData::getImportedKeys", *this);
+ } catch (sql::InvalidArgumentException) {
+ mysqlc_sdbc_driver::throwInvalidArgumentException("ODatabaseMetaData::getImportedKeys", *this);
+ } catch (const sql::SQLException& e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_rConnection.getConnectionEncoding());
+ }
+
+ lcl_setRows_throw(xResultSet,9,rRows);
+ return xResultSet;
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::getPrimaryKeys() -I- */
+Reference< XResultSet > SAL_CALL ODatabaseMetaData::getPrimaryKeys(
+ const Any& catalog,
+ const OUString& schema,
+ const OUString& table)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("ODatabaseMetaData::getPrimaryKeys");
+ Reference< XResultSet > xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.helper.DatabaseMetaDataResultSet"))),UNO_QUERY);
+ std::vector< std::vector< Any > > rRows;
+
+ std::string cat(catalog.hasValue()? OUStringToOString(getStringFromAny(catalog), m_rConnection.getConnectionEncoding()).getStr():""),
+ sch(OUStringToOString(schema, m_rConnection.getConnectionEncoding()).getStr()),
+ tab(OUStringToOString(table, m_rConnection.getConnectionEncoding()).getStr());
+
+ try {
+ rtl_TextEncoding encoding = m_rConnection.getConnectionEncoding();
+ std::auto_ptr< sql::ResultSet> rset( meta->getPrimaryKeys(cat, sch, tab));
+ sql::ResultSetMetaData * rs_meta = rset->getMetaData();
+ sal_uInt32 columns = rs_meta->getColumnCount();
+ while (rset->next()) {
+ std::vector< Any > aRow(1);
+ for (sal_uInt32 i = 1; i <= columns; i++) {
+ aRow.push_back(makeAny(mysqlc_sdbc_driver::convert(rset->getString(i), encoding)));
+ }
+ rRows.push_back(aRow);
+ }
+ } catch (sql::MethodNotImplementedException) {
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("ODatabaseMetaData::getPrimaryKeys", *this);
+ } catch (sql::InvalidArgumentException) {
+ mysqlc_sdbc_driver::throwInvalidArgumentException("ODatabaseMetaData::getPrimaryKeys", *this);
+ } catch (const sql::SQLException& e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_rConnection.getConnectionEncoding());
+ }
+
+ lcl_setRows_throw(xResultSet, 10, rRows);
+ return xResultSet;
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::getIndexInfo() -I- */
+Reference< XResultSet > SAL_CALL ODatabaseMetaData::getIndexInfo(
+ const Any& catalog,
+ const OUString& schema,
+ const OUString& table,
+ sal_Bool unique,
+ sal_Bool approximate)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("ODatabaseMetaData::getIndexInfo");
+ Reference< XResultSet > xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.helper.DatabaseMetaDataResultSet"))),UNO_QUERY);
+ std::vector< std::vector< Any > > rRows;
+
+ std::string cat(catalog.hasValue()? OUStringToOString(getStringFromAny(catalog), m_rConnection.getConnectionEncoding()).getStr():""),
+ sch(OUStringToOString(schema, m_rConnection.getConnectionEncoding()).getStr()),
+ tab(OUStringToOString(table, m_rConnection.getConnectionEncoding()).getStr());
+
+ try {
+ rtl_TextEncoding encoding = m_rConnection.getConnectionEncoding();
+ std::auto_ptr< sql::ResultSet> rset( meta->getIndexInfo(cat, sch, tab, unique, approximate));
+ sql::ResultSetMetaData * rs_meta = rset->getMetaData();
+ sal_uInt32 columns = rs_meta->getColumnCount();
+ while (rset->next()) {
+ std::vector< Any > aRow(1);
+ for (sal_uInt32 i = 1; i <= columns; i++) {
+ aRow.push_back(makeAny(mysqlc_sdbc_driver::convert(rset->getString(i), encoding)));
+ }
+ rRows.push_back(aRow);
+ }
+ } catch (sql::MethodNotImplementedException) {
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("ODatabaseMetaData::getIndexInfo", *this);
+ } catch (sql::InvalidArgumentException) {
+ mysqlc_sdbc_driver::throwInvalidArgumentException("ODatabaseMetaData::getIndexInfo", *this);
+ } catch (const sql::SQLException& e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_rConnection.getConnectionEncoding());
+ }
+
+ lcl_setRows_throw(xResultSet, 11, rRows);
+ return xResultSet;
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::getBestRowIdentifier() -I- */
+Reference< XResultSet > SAL_CALL ODatabaseMetaData::getBestRowIdentifier(
+ const Any& catalog,
+ const OUString& schema,
+ const OUString& table,
+ sal_Int32 scope,
+ sal_Bool nullable)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("ODatabaseMetaData::getBestRowIdentifier");
+ Reference< XResultSet > xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.helper.DatabaseMetaDataResultSet"))),UNO_QUERY);
+ std::vector< std::vector< Any > > rRows;
+
+ std::string cat(catalog.hasValue()? OUStringToOString(getStringFromAny(catalog), m_rConnection.getConnectionEncoding()).getStr():""),
+ sch(OUStringToOString(schema, m_rConnection.getConnectionEncoding()).getStr()),
+ tab(OUStringToOString(table, m_rConnection.getConnectionEncoding()).getStr());
+
+ try {
+ rtl_TextEncoding encoding = m_rConnection.getConnectionEncoding();
+ std::auto_ptr< sql::ResultSet> rset( meta->getBestRowIdentifier(cat, sch, tab, scope, nullable));
+ sql::ResultSetMetaData * rs_meta = rset->getMetaData();
+ sal_uInt32 columns = rs_meta->getColumnCount();
+ while (rset->next()) {
+ std::vector< Any > aRow(1);
+ for (sal_uInt32 i = 1; i <= columns; i++) {
+ aRow.push_back(makeAny(mysqlc_sdbc_driver::convert(rset->getString(i), encoding)));
+ }
+ rRows.push_back(aRow);
+ }
+ } catch (sql::MethodNotImplementedException) {
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("ODatabaseMetaData::getBestRowIdentifier", *this);
+ } catch (sql::InvalidArgumentException) {
+ mysqlc_sdbc_driver::throwInvalidArgumentException("ODatabaseMetaData::getBestRowIdentifier", *this);
+ } catch (const sql::SQLException& e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_rConnection.getConnectionEncoding());
+ }
+
+ lcl_setRows_throw(xResultSet, 15, rRows);
+ return xResultSet;
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::getTablePrivileges() -I- */
+Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTablePrivileges(
+ const Any& catalog,
+ const OUString& schemaPattern,
+ const OUString& tableNamePattern)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("ODatabaseMetaData::getTablePrivileges");
+ Reference< XResultSet > xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.helper.DatabaseMetaDataResultSet"))),UNO_QUERY);
+ std::vector< std::vector< Any > > rRows;
+
+ std::string cat(catalog.hasValue()? OUStringToOString(getStringFromAny(catalog), m_rConnection.getConnectionEncoding()).getStr():""),
+ sPattern(OUStringToOString(schemaPattern, m_rConnection.getConnectionEncoding()).getStr()),
+ tPattern(OUStringToOString(tableNamePattern, m_rConnection.getConnectionEncoding()).getStr());
+
+ try {
+ static bool fakeTablePrivileges = false;
+ if (fakeTablePrivileges) {
+ static const sal_Char* allPrivileges[] = {
+ "ALTER", "DELETE", "DROP", "INDEX", "INSERT", "LOCK TABLES", "SELECT", "UPDATE"
+ };
+ Any userName; userName <<= getUserName();
+ for (size_t i = 0; i < sizeof( allPrivileges ) / sizeof( allPrivileges[0]); ++i) {
+ std::vector< Any > aRow;
+ aRow.push_back(makeAny( sal_Int32( i ) ));
+ aRow.push_back(catalog); // TABLE_CAT
+ aRow.push_back(makeAny( schemaPattern )); // TABLE_SCHEM
+ aRow.push_back(makeAny( tableNamePattern )); // TABLE_NAME
+ aRow.push_back(Any()); // GRANTOR
+ aRow.push_back(userName); // GRANTEE
+ aRow.push_back(makeAny( ::rtl::OUString::createFromAscii( allPrivileges[i] ) )); // PRIVILEGE
+ aRow.push_back(Any()); // IS_GRANTABLE
+
+ rRows.push_back(aRow);
+ }
+ } else {
+ rtl_TextEncoding encoding = m_rConnection.getConnectionEncoding();
+ std::auto_ptr< sql::ResultSet> rset( meta->getTablePrivileges(cat, sPattern.compare("")? sPattern:wild, tPattern.compare("")? tPattern:wild));
+ sql::ResultSetMetaData * rs_meta = rset->getMetaData();
+ sal_uInt32 columns = rs_meta->getColumnCount();
+ while (rset->next()) {
+ std::vector< Any > aRow(1);
+ for (sal_uInt32 i = 1; i <= columns; i++) {
+ aRow.push_back(makeAny(mysqlc_sdbc_driver::convert(rset->getString(i), encoding)));
+ }
+ rRows.push_back(aRow);
+ }
+ }
+ } catch (sql::MethodNotImplementedException) {
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("ODatabaseMetaData::getTablePrivileges", *this);
+ } catch (sql::InvalidArgumentException) {
+ mysqlc_sdbc_driver::throwInvalidArgumentException("ODatabaseMetaData::getTablePrivileges", *this);
+ } catch (const sql::SQLException& e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_rConnection.getConnectionEncoding());
+ }
+
+ lcl_setRows_throw(xResultSet,12,rRows);
+ return xResultSet;
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::getCrossReference() -I- */
+Reference< XResultSet > SAL_CALL ODatabaseMetaData::getCrossReference(
+ const Any& primaryCatalog,
+ const OUString& primarySchema,
+ const OUString& primaryTable,
+ const Any& foreignCatalog,
+ const OUString& foreignSchema,
+ const OUString& foreignTable)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("ODatabaseMetaData::getCrossReference");
+ Reference< XResultSet > xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.helper.DatabaseMetaDataResultSet"))),UNO_QUERY);
+ std::vector< std::vector< Any > > rRows;
+
+ std::string primaryCat(primaryCatalog.hasValue()? OUStringToOString(getStringFromAny(primaryCatalog), m_rConnection.getConnectionEncoding()).getStr():""),
+ foreignCat(foreignCatalog.hasValue()? OUStringToOString(getStringFromAny(foreignCatalog), m_rConnection.getConnectionEncoding()).getStr():""),
+ pSchema(OUStringToOString(primarySchema, m_rConnection.getConnectionEncoding()).getStr()),
+ pTable(OUStringToOString(primaryTable, m_rConnection.getConnectionEncoding()).getStr()),
+ fSchema(OUStringToOString(foreignSchema, m_rConnection.getConnectionEncoding()).getStr()),
+ fTable(OUStringToOString(foreignTable, m_rConnection.getConnectionEncoding()).getStr());
+
+ try {
+ rtl_TextEncoding encoding = m_rConnection.getConnectionEncoding();
+ std::auto_ptr< sql::ResultSet> rset( meta->getCrossReference(primaryCat, pSchema, pTable, foreignCat, fSchema, fTable));
+ sql::ResultSetMetaData * rs_meta = rset->getMetaData();
+ sal_uInt32 columns = rs_meta->getColumnCount();
+ while (rset->next()) {
+ std::vector< Any > aRow(1);
+ for (sal_uInt32 i = 1; i <= columns; i++) {
+ aRow.push_back(makeAny(mysqlc_sdbc_driver::convert(rset->getString(i), encoding)));
+ }
+ rRows.push_back(aRow);
+ }
+ } catch (sql::MethodNotImplementedException) {
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("ODatabaseMetaData::getCrossReference", *this);
+ } catch (sql::InvalidArgumentException) {
+ mysqlc_sdbc_driver::throwInvalidArgumentException("ODatabaseMetaData::getCrossReference", *this);
+ } catch (const sql::SQLException& e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_rConnection.getConnectionEncoding());
+ }
+
+ lcl_setRows_throw(xResultSet,13,rRows);
+ return xResultSet;
+}
+/* }}} */
+
+
+/* {{{ ODatabaseMetaData::getUDTs() -I- */
+Reference< XResultSet > SAL_CALL ODatabaseMetaData::getUDTs(
+ const Any& /* catalog */,
+ const OUString& /* schemaPattern */,
+ const OUString& /* typeNamePattern */,
+ const Sequence< sal_Int32 >& /* types */)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("ODatabaseMetaData::getUDTs");
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("ODatabaseMetaData::getUDTs", *this);
+ return NULL;
+}
+/* }}} */
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
+
diff --git a/mysqlc/source/mysqlc_databasemetadata.hxx b/mysqlc/source/mysqlc_databasemetadata.hxx
new file mode 100644
index 000000000000..8e6680c3ac20
--- /dev/null
+++ b/mysqlc/source/mysqlc_databasemetadata.hxx
@@ -0,0 +1,243 @@
+/*************************************************************************
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2008 by Sun Microsystems, Inc.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* $RCSfile: mysqlc_databasemetadata.hxx,v $
+*
+* $Revision: 1.1.2.3 $
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+************************************************************************/
+
+#ifndef CONNECTIVITY_SDATABASEMETADATA_HXX
+#define CONNECTIVITY_SDATABASEMETADATA_HXX
+
+#include "mysqlc_connection.hxx"
+
+#ifndef _COM_SUN_STAR_SDBC_XDATABASEMETADATA_HPP_
+#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
+#endif
+#ifndef _CPPUHELPER_IMPLBASE1_HXX_
+#include <cppuhelper/implbase1.hxx>
+#endif
+
+#include <cppconn/metadata.h>
+
+namespace connectivity
+{
+ namespace mysqlc
+ {
+ typedef ::com::sun::star::sdbc::SQLException my_SQLException;
+ typedef ::com::sun::star::uno::RuntimeException my_RuntimeException;
+ typedef ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > my_XResultSetRef;
+ using ::com::sun::star::uno::Any;
+ using ::rtl::OUString;
+
+ //**************************************************************
+ //************ Class: ODatabaseMetaData
+ //**************************************************************
+
+ typedef ::cppu::WeakImplHelper1< ::com::sun::star::sdbc::XDatabaseMetaData> ODatabaseMetaData_BASE;
+
+ class ODatabaseMetaData : public ODatabaseMetaData_BASE
+ {
+ OConnection& m_rConnection;
+ sal_Bool m_bUseCatalog;
+ protected:
+ sql::DatabaseMetaData * meta;
+ OUString identifier_quote_string;
+ bool identifier_quote_string_set;
+
+ private:
+ OUString impl_getStringMetaData( const sal_Char* _methodName, const std::string& (sql::DatabaseMetaData::*_Method)() );
+ OUString impl_getStringMetaData( const sal_Char* _methodName, std::string (sql::DatabaseMetaData::*_Method)() );
+ OUString impl_getStringMetaData( const sal_Char* _methodName, const sql::SQLString& (sql::DatabaseMetaData::*_Method)() );
+ OUString impl_getStringMetaData( const sal_Char* _methodName, sql::SQLString (sql::DatabaseMetaData::*_Method)() );
+ sal_Int32 impl_getInt32MetaData( const sal_Char* _methodName, unsigned int (sql::DatabaseMetaData::*_Method)() );
+ sal_Bool impl_getBoolMetaData( const sal_Char* _methodName, bool (sql::DatabaseMetaData::*_Method)() );
+ sal_Bool impl_getBoolMetaData( const sal_Char* _methodName, bool (sql::DatabaseMetaData::*_Method)(int), sal_Int32 _arg );
+ sal_Bool impl_getRSTypeMetaData( const sal_Char* _methodName, bool (sql::DatabaseMetaData::*_Method)(int), sal_Int32 _resultSetType );
+
+ public:
+ inline const OConnection& getOwnConnection() const { return m_rConnection; }
+
+ ODatabaseMetaData(OConnection& _rCon);
+ virtual ~ODatabaseMetaData();
+
+ // as I mentioned before this interface is really BIG
+ // XDatabaseMetaData
+ sal_Bool SAL_CALL allProceduresAreCallable() throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL allTablesAreSelectable() throw(my_SQLException, my_RuntimeException);
+ OUString SAL_CALL getURL() throw(my_SQLException, my_RuntimeException);
+ OUString SAL_CALL getUserName() throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL isReadOnly() throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL nullsAreSortedHigh() throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL nullsAreSortedLow() throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL nullsAreSortedAtStart() throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL nullsAreSortedAtEnd() throw(my_SQLException, my_RuntimeException);
+ OUString SAL_CALL getDatabaseProductName() throw(my_SQLException, my_RuntimeException);
+ OUString SAL_CALL getDatabaseProductVersion() throw(my_SQLException, my_RuntimeException);
+ OUString SAL_CALL getDriverName() throw(my_SQLException, my_RuntimeException);
+ OUString SAL_CALL getDriverVersion() throw(my_SQLException, my_RuntimeException);
+ sal_Int32 SAL_CALL getDriverMajorVersion() throw(my_RuntimeException);
+ sal_Int32 SAL_CALL getDriverMinorVersion() throw(my_RuntimeException);
+ sal_Bool SAL_CALL usesLocalFiles() throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL usesLocalFilePerTable() throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL supportsMixedCaseIdentifiers() throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL storesUpperCaseIdentifiers() throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL storesLowerCaseIdentifiers() throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL storesMixedCaseIdentifiers() throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL supportsMixedCaseQuotedIdentifiers() throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL storesUpperCaseQuotedIdentifiers() throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL storesLowerCaseQuotedIdentifiers() throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL storesMixedCaseQuotedIdentifiers() throw(my_SQLException, my_RuntimeException);
+ OUString SAL_CALL getIdentifierQuoteString() throw(my_SQLException, my_RuntimeException);
+ OUString SAL_CALL getSQLKeywords() throw(my_SQLException, my_RuntimeException);
+ OUString SAL_CALL getNumericFunctions() throw(my_SQLException, my_RuntimeException);
+ OUString SAL_CALL getStringFunctions() throw(my_SQLException, my_RuntimeException);
+ OUString SAL_CALL getSystemFunctions() throw(my_SQLException, my_RuntimeException);
+ OUString SAL_CALL getTimeDateFunctions() throw(my_SQLException, my_RuntimeException);
+ OUString SAL_CALL getSearchStringEscape() throw(my_SQLException, my_RuntimeException);
+ OUString SAL_CALL getExtraNameCharacters() throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL supportsAlterTableWithAddColumn() throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL supportsAlterTableWithDropColumn() throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL supportsColumnAliasing() throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL nullPlusNonNullIsNull() throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL supportsTypeConversion() throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL supportsConvert(sal_Int32 fromType, sal_Int32 toType)
+ throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL supportsTableCorrelationNames() throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL supportsDifferentTableCorrelationNames() throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL supportsExpressionsInOrderBy() throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL supportsOrderByUnrelated() throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL supportsGroupBy() throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL supportsGroupByUnrelated() throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL supportsGroupByBeyondSelect() throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL supportsLikeEscapeClause() throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL supportsMultipleResultSets() throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL supportsMultipleTransactions() throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL supportsNonNullableColumns() throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL supportsMinimumSQLGrammar() throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL supportsCoreSQLGrammar() throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL supportsExtendedSQLGrammar() throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL supportsANSI92EntryLevelSQL() throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL supportsANSI92IntermediateSQL() throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL supportsANSI92FullSQL() throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL supportsIntegrityEnhancementFacility()throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL supportsOuterJoins() throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL supportsFullOuterJoins() throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL supportsLimitedOuterJoins() throw(my_SQLException, my_RuntimeException);
+ OUString SAL_CALL getSchemaTerm() throw(my_SQLException, my_RuntimeException);
+ OUString SAL_CALL getProcedureTerm() throw(my_SQLException, my_RuntimeException);
+ OUString SAL_CALL getCatalogTerm() throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL isCatalogAtStart() throw(my_SQLException, my_RuntimeException);
+ OUString SAL_CALL getCatalogSeparator() throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL supportsSchemasInDataManipulation() throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL supportsSchemasInProcedureCalls() throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL supportsSchemasInTableDefinitions() throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL supportsSchemasInIndexDefinitions() throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL supportsSchemasInPrivilegeDefinitions() throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL supportsCatalogsInDataManipulation() throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL supportsCatalogsInProcedureCalls() throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL supportsCatalogsInTableDefinitions() throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL supportsCatalogsInIndexDefinitions() throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL supportsCatalogsInPrivilegeDefinitions() throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL supportsPositionedDelete() throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL supportsPositionedUpdate() throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL supportsSelectForUpdate() throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL supportsStoredProcedures() throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL supportsSubqueriesInComparisons() throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL supportsSubqueriesInExists() throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL supportsSubqueriesInIns() throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL supportsSubqueriesInQuantifieds() throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL supportsCorrelatedSubqueries() throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL supportsUnion() throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL supportsUnionAll() throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL supportsOpenCursorsAcrossCommit() throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL supportsOpenCursorsAcrossRollback() throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL supportsOpenStatementsAcrossCommit() throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL supportsOpenStatementsAcrossRollback() throw(my_SQLException, my_RuntimeException);
+ sal_Int32 SAL_CALL getMaxBinaryLiteralLength() throw(my_SQLException, my_RuntimeException);
+ sal_Int32 SAL_CALL getMaxCharLiteralLength() throw(my_SQLException, my_RuntimeException);
+ sal_Int32 SAL_CALL getMaxColumnNameLength() throw(my_SQLException, my_RuntimeException);
+ sal_Int32 SAL_CALL getMaxColumnsInGroupBy() throw(my_SQLException, my_RuntimeException);
+ sal_Int32 SAL_CALL getMaxColumnsInIndex() throw(my_SQLException, my_RuntimeException);
+ sal_Int32 SAL_CALL getMaxColumnsInOrderBy() throw(my_SQLException, my_RuntimeException);
+ sal_Int32 SAL_CALL getMaxColumnsInSelect() throw(my_SQLException, my_RuntimeException);
+ sal_Int32 SAL_CALL getMaxColumnsInTable() throw(my_SQLException, my_RuntimeException);
+ sal_Int32 SAL_CALL getMaxConnections() throw(my_SQLException, my_RuntimeException);
+ sal_Int32 SAL_CALL getMaxCursorNameLength() throw(my_SQLException, my_RuntimeException);
+ sal_Int32 SAL_CALL getMaxIndexLength() throw(my_SQLException, my_RuntimeException);
+ sal_Int32 SAL_CALL getMaxSchemaNameLength() throw(my_SQLException, my_RuntimeException);
+ sal_Int32 SAL_CALL getMaxProcedureNameLength() throw(my_SQLException, my_RuntimeException);
+ sal_Int32 SAL_CALL getMaxCatalogNameLength() throw(my_SQLException, my_RuntimeException);
+ sal_Int32 SAL_CALL getMaxRowSize() throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL doesMaxRowSizeIncludeBlobs() throw(my_SQLException, my_RuntimeException);
+ sal_Int32 SAL_CALL getMaxStatementLength() throw(my_SQLException, my_RuntimeException);
+ sal_Int32 SAL_CALL getMaxStatements() throw(my_SQLException, my_RuntimeException);
+ sal_Int32 SAL_CALL getMaxTableNameLength() throw(my_SQLException, my_RuntimeException);
+ sal_Int32 SAL_CALL getMaxTablesInSelect() throw(my_SQLException, my_RuntimeException);
+ sal_Int32 SAL_CALL getMaxUserNameLength() throw(my_SQLException, my_RuntimeException);
+ sal_Int32 SAL_CALL getDefaultTransactionIsolation() throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL supportsTransactions() throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL supportsTransactionIsolationLevel(sal_Int32 level)
+ throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL supportsDataDefinitionAndDataManipulationTransactions()
+ throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL supportsDataManipulationTransactionsOnly()throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL dataDefinitionCausesTransactionCommit() throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL dataDefinitionIgnoredInTransactions() throw(my_SQLException, my_RuntimeException);
+ my_XResultSetRef SAL_CALL getProcedures(const Any& catalog, const OUString& schemaPattern, const OUString& procedureNamePattern) throw(my_SQLException, my_RuntimeException);
+ my_XResultSetRef SAL_CALL getProcedureColumns(const Any& catalog, const OUString& schemaPattern, const OUString& procedureNamePattern, const OUString& columnNamePattern) throw(my_SQLException, my_RuntimeException);
+ my_XResultSetRef SAL_CALL getTables(const Any& catalog, const OUString& schemaPattern, const OUString& tableNamePattern, const ::com::sun::star::uno::Sequence< OUString >& types) throw(my_SQLException, my_RuntimeException);
+ my_XResultSetRef SAL_CALL getSchemas() throw(my_SQLException, my_RuntimeException);
+ my_XResultSetRef SAL_CALL getCatalogs() throw(my_SQLException, my_RuntimeException);
+ my_XResultSetRef SAL_CALL getTableTypes() throw(my_SQLException, my_RuntimeException);
+ my_XResultSetRef SAL_CALL getColumns(const Any& catalog, const OUString& schemaPattern, const OUString& tableNamePattern, const OUString& columnNamePattern) throw(my_SQLException, my_RuntimeException);
+ my_XResultSetRef SAL_CALL getColumnPrivileges(const Any& catalog, const OUString& schema, const OUString& table, const OUString& columnNamePattern) throw(my_SQLException, my_RuntimeException);
+ my_XResultSetRef SAL_CALL getTablePrivileges(const Any& catalog, const OUString& schemaPattern, const OUString& tableNamePattern) throw(my_SQLException, my_RuntimeException);
+ my_XResultSetRef SAL_CALL getBestRowIdentifier(const Any& catalog, const OUString& schema, const OUString& table, sal_Int32 scope, sal_Bool nullable) throw(my_SQLException, my_RuntimeException);
+ my_XResultSetRef SAL_CALL getVersionColumns(const Any& catalog, const OUString& schema, const OUString& table) throw(my_SQLException, my_RuntimeException);
+ my_XResultSetRef SAL_CALL getPrimaryKeys(const Any& catalog, const OUString& schema, const OUString& table) throw(my_SQLException, my_RuntimeException);
+ my_XResultSetRef SAL_CALL getImportedKeys(const Any& catalog, const OUString& schema, const OUString& table) throw(my_SQLException, my_RuntimeException);
+ my_XResultSetRef SAL_CALL getExportedKeys(const Any& catalog, const OUString& schema, const OUString& table) throw(my_SQLException, my_RuntimeException);
+ my_XResultSetRef SAL_CALL getCrossReference(const Any& primaryCatalog, const OUString& primarySchema, const OUString& primaryTable, const Any& foreignCatalog, const OUString& foreignSchema, const OUString& foreignTable) throw(my_SQLException, my_RuntimeException);
+ my_XResultSetRef SAL_CALL getTypeInfo() throw(my_SQLException, my_RuntimeException);
+ my_XResultSetRef SAL_CALL getIndexInfo(const Any& catalog, const OUString& schema, const OUString& table, sal_Bool unique, sal_Bool approximate) throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL supportsResultSetType(sal_Int32 setType) throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL supportsResultSetConcurrency(sal_Int32 setType, sal_Int32 concurrency) throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL ownUpdatesAreVisible(sal_Int32 setType) throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL ownDeletesAreVisible(sal_Int32 setType) throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL ownInsertsAreVisible(sal_Int32 setType) throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL othersUpdatesAreVisible(sal_Int32 setType)throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL othersDeletesAreVisible(sal_Int32 setType)throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL othersInsertsAreVisible(sal_Int32 setType)throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL updatesAreDetected(sal_Int32 setType) throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL deletesAreDetected(sal_Int32 setType) throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL insertsAreDetected(sal_Int32 setType) throw(my_SQLException, my_RuntimeException);
+ sal_Bool SAL_CALL supportsBatchUpdates() throw(my_SQLException, my_RuntimeException);
+ my_XResultSetRef SAL_CALL getUDTs(const Any& catalog, const OUString& schemaPattern, const OUString& typeNamePattern, const ::com::sun::star::uno::Sequence< sal_Int32 >& types) throw(my_SQLException, my_RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL getConnection() throw(my_SQLException, my_RuntimeException);
+ };
+ }
+}
+
+#endif // CONNECTIVITY_SDATABASEMETADATA_HXX
diff --git a/mysqlc/source/mysqlc_driver.cxx b/mysqlc/source/mysqlc_driver.cxx
new file mode 100644
index 000000000000..af312af89d00
--- /dev/null
+++ b/mysqlc/source/mysqlc_driver.cxx
@@ -0,0 +1,368 @@
+/*************************************************************************
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2008 by Sun Microsystems, Inc.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* $RCSfile: mysqlc_driver.cxx,v $
+*
+* $Revision: 1.1.2.5 $
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+************************************************************************/
+#include "mysqlc_driver.hxx"
+#include "mysqlc_connection.hxx"
+#include "mysqlc_general.hxx"
+
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::beans;
+using namespace com::sun::star::sdbc;
+using namespace connectivity::mysqlc;
+using ::rtl::OUString;
+#include <stdio.h>
+
+#include <cppconn/exception.h>
+
+#ifdef SYSTEM_MYSQL_CPPCONN
+ #include <mysql_driver.h>
+#endif
+
+
+/* {{{ MysqlCDriver::MysqlCDriver() -I- */
+MysqlCDriver::MysqlCDriver(const Reference< XMultiServiceFactory >& _rxFactory)
+ : ODriver_BASE(m_aMutex)
+ ,m_xFactory(_rxFactory)
+#ifndef SYSTEM_MYSQL_CPPCONN
+ ,m_hCppConnModule( NULL )
+ ,m_bAttemptedLoadCppConn( false )
+#endif
+{
+ OSL_TRACE("MysqlCDriver::MysqlCDriver");
+ cppDriver = NULL;
+}
+/* }}} */
+
+
+/* {{{ MysqlCDriver::disposing() -I- */
+void MysqlCDriver::disposing()
+{
+ OSL_TRACE("MysqlCDriver::disposing");
+ ::osl::MutexGuard aGuard(m_aMutex);
+
+ // when driver will be destroied so all our connections have to be destroied as well
+ for (OWeakRefArray::iterator i = m_xConnections.begin(); m_xConnections.end() != i; ++i)
+ {
+ Reference< XComponent > xComp(i->get(), UNO_QUERY);
+ if (xComp.is()) {
+ xComp->dispose();
+ }
+ }
+ m_xConnections.clear();
+
+ ODriver_BASE::disposing();
+}
+/* }}} */
+
+
+// static ServiceInfo
+/* {{{ MysqlCDriver::getImplementationName_Static() -I- */
+OUString MysqlCDriver::getImplementationName_Static()
+ throw(RuntimeException)
+{
+ OSL_TRACE("MysqlCDriver::getImplementationName_Static");
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.sdbc.mysqlc.MysqlCDriver" ) );
+}
+/* }}} */
+
+
+/* {{{ MysqlCDriver::getSupportedServiceNames_Static() -I- */
+Sequence< OUString > MysqlCDriver::getSupportedServiceNames_Static()
+ throw(RuntimeException)
+{
+ OSL_TRACE("MysqlCDriver::getSupportedServiceNames_Static");
+ // which service is supported
+ // for more information @see com.sun.star.sdbc.Driver
+ Sequence< OUString > aSNS(1);
+ aSNS[0] = OUString::createFromAscii("com.sun.star.sdbc.Driver");
+ return aSNS;
+}
+/* }}} */
+
+
+/* {{{ MysqlCDriver::getImplementationName() -I- */
+OUString SAL_CALL MysqlCDriver::getImplementationName()
+ throw(RuntimeException)
+{
+ OSL_TRACE("MysqlCDriver::getImplementationName");
+ return getImplementationName_Static();
+}
+/* }}} */
+
+
+/* {{{ MysqlCDriver::supportsService() -I- */
+sal_Bool SAL_CALL MysqlCDriver::supportsService(const OUString& _rServiceName)
+ throw(RuntimeException)
+{
+ OSL_TRACE("MysqlCDriver::supportsService");
+ Sequence< OUString > aSupported(getSupportedServiceNames());
+ const OUString* pSupported = aSupported.getConstArray();
+ const OUString* pEnd = pSupported + aSupported.getLength();
+ for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported){}
+
+ return (pSupported != pEnd);
+}
+/* }}} */
+
+
+/* {{{ MysqlCDriver::getSupportedServiceNames() -I- */
+Sequence< OUString > SAL_CALL MysqlCDriver::getSupportedServiceNames()
+ throw(RuntimeException)
+{
+ OSL_TRACE("MysqlCDriver::getSupportedServiceNames");
+ return getSupportedServiceNames_Static();
+}
+/* }}} */
+
+
+extern "C" { static void SAL_CALL thisModule() {} }
+
+void MysqlCDriver::impl_initCppConn_lck_throw()
+{
+#ifdef SYSTEM_MYSQL_CPPCONN
+ cppDriver = get_driver_instance();
+#else
+ if ( !m_bAttemptedLoadCppConn )
+ {
+ const ::rtl::OUString sModuleName = ::rtl::OUString::createFromAscii( CPPCONN_LIB );
+ m_hCppConnModule = osl_loadModuleRelative( &thisModule, sModuleName.pData, 0 );
+ m_bAttemptedLoadCppConn = true;
+ }
+
+ // attempted to load - was it successful?
+ if ( !m_hCppConnModule )
+ {
+ OSL_ENSURE( false, "MysqlCDriver::impl_initCppConn_lck_throw: could not load the " CPPCONN_LIB " library!");
+ throw SQLException(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unable to load the " CPPCONN_LIB " library." ) ),
+ *this,
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "08001" ) ), // "unable to connect"
+ 0,
+ Any()
+ );
+ }
+
+ // find the factory symbol
+ const ::rtl::OUString sSymbolName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "sql_mysql_get_driver_instance" ) );
+ typedef void* (* FGetMySQLDriver)();
+
+ const FGetMySQLDriver pFactoryFunction = (FGetMySQLDriver)( osl_getFunctionSymbol( m_hCppConnModule, sSymbolName.pData ) );
+ if ( !pFactoryFunction )
+ {
+ OSL_ENSURE( false, "MysqlCDriver::impl_initCppConn_lck_throw: could not find the factory symbol in " CPPCONN_LIB "!");
+ throw SQLException(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( CPPCONN_LIB " is invalid: missing the driver factory function." ) ),
+ *this,
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "08001" ) ), // "unable to connect"
+ 0,
+ Any()
+ );
+ }
+
+ cppDriver = static_cast< sql::Driver* >( (*pFactoryFunction)() );
+#endif
+ if ( !cppDriver )
+ {
+ throw SQLException(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unable to obtain the MySQL_Driver instance from Connector/C++." ) ),
+ *this,
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "08001" ) ), // "unable to connect"
+ 0,
+ Any()
+ );
+ }
+}
+
+/* {{{ MysqlCDriver::connect() -I- */
+Reference< XConnection > SAL_CALL MysqlCDriver::connect(const OUString& url, const Sequence< PropertyValue >& info)
+ throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ OSL_TRACE("MysqlCDriver::connect");
+ if (!acceptsURL(url)) {
+ return NULL;
+ }
+
+ if ( !cppDriver )
+ {
+ impl_initCppConn_lck_throw();
+ OSL_POSTCOND( cppDriver, "MySQLCDriver::connect: internal error." );
+ if ( !cppDriver )
+ throw RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MySQLCDriver::connect: internal error." ) ), *this );
+ }
+
+ Reference< XConnection > xConn;
+ // create a new connection with the given properties and append it to our vector
+ try {
+ OConnection* pCon = new OConnection(*this, cppDriver);
+ xConn = pCon;
+
+ pCon->construct(url,info);
+ m_xConnections.push_back(WeakReferenceHelper(*pCon));
+ }
+ catch (sql::SQLException &e)
+ {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, getDefaultEncoding());
+ }
+ return xConn;
+}
+/* }}} */
+
+
+/* {{{ MysqlCDriver::acceptsURL() -I- */
+sal_Bool SAL_CALL MysqlCDriver::acceptsURL(const OUString& url)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("MysqlCDriver::acceptsURL");
+ return (!url.compareTo(OUString::createFromAscii("sdbc:mysqlc:"), sizeof("sdbc:mysqlc:")-1));
+}
+/* }}} */
+
+
+/* {{{ MysqlCDriver::getPropertyInfo() -I- */
+Sequence< DriverPropertyInfo > SAL_CALL MysqlCDriver::getPropertyInfo(const OUString& url, const Sequence< PropertyValue >& /* info */)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("MysqlCDriver::getPropertyInfo");
+ if (acceptsURL(url)) {
+ ::std::vector< DriverPropertyInfo > aDriverInfo;
+
+ aDriverInfo.push_back(DriverPropertyInfo(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("Hostname"))
+ ,OUString(RTL_CONSTASCII_USTRINGPARAM("Name of host"))
+ ,sal_True
+ ,OUString::createFromAscii("localhost")
+ ,Sequence< OUString >())
+ );
+ aDriverInfo.push_back(DriverPropertyInfo(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("Port"))
+ ,OUString(RTL_CONSTASCII_USTRINGPARAM("Port"))
+ ,sal_True
+ ,OUString::createFromAscii("3306")
+ ,Sequence< OUString >())
+ );
+ return Sequence< DriverPropertyInfo >(&(aDriverInfo[0]),aDriverInfo.size());
+ }
+
+ return Sequence< DriverPropertyInfo >();
+}
+/* }}} */
+
+
+/* {{{ MysqlCDriver::getMajorVersion() -I- */
+sal_Int32 SAL_CALL MysqlCDriver::getMajorVersion()
+ throw(RuntimeException)
+{
+ OSL_TRACE("MysqlCDriver::getMajorVersion");
+ return MYSQLC_VERSION_MAJOR;
+}
+/* }}} */
+
+
+/* {{{ MysqlCDriver::getMinorVersion() -I- */
+sal_Int32 SAL_CALL MysqlCDriver::getMinorVersion()
+ throw(RuntimeException)
+{
+ OSL_TRACE("MysqlCDriver::getMinorVersion");
+ return MYSQLC_VERSION_MINOR;
+}
+/* }}} */
+
+
+namespace connectivity
+{
+namespace mysqlc
+{
+
+Reference< XInterface > SAL_CALL MysqlCDriver_CreateInstance(const Reference< XMultiServiceFactory >& _rxFactory)
+ throw(::com::sun::star::uno::Exception)
+{
+ return(*(new MysqlCDriver(_rxFactory)));
+}
+
+/* {{{ connectivity::mysqlc::release() -I- */
+void release(oslInterlockedCount& _refCount,
+ ::cppu::OBroadcastHelper& rBHelper,
+ Reference< XInterface >& _xInterface,
+ ::com::sun::star::lang::XComponent* _pObject)
+{
+ if (osl_decrementInterlockedCount(&_refCount) == 0) {
+ osl_incrementInterlockedCount(&_refCount);
+
+ if (!rBHelper.bDisposed && !rBHelper.bInDispose) {
+ // remember the parent
+ Reference< XInterface > xParent;
+ {
+ ::osl::MutexGuard aGuard(rBHelper.rMutex);
+ xParent = _xInterface;
+ _xInterface = NULL;
+ }
+
+ // First dispose
+ _pObject->dispose();
+
+ // only the alive ref holds the object
+ OSL_ASSERT(_refCount == 1);
+
+ // release the parent in the destructor
+ if (xParent.is()) {
+ ::osl::MutexGuard aGuard(rBHelper.rMutex);
+ _xInterface = xParent;
+ }
+ }
+ } else {
+ osl_incrementInterlockedCount(&_refCount);
+ }
+}
+/* }}} */
+
+
+
+/* {{{ connectivity::mysqlc::checkDisposed() -I- */
+void checkDisposed(sal_Bool _bThrow)
+ throw (DisposedException)
+{
+ if (_bThrow) {
+ throw DisposedException();
+ }
+}
+/* }}} */
+
+} /* mysqlc */
+} /* connectivity */
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
diff --git a/mysqlc/source/mysqlc_driver.hxx b/mysqlc/source/mysqlc_driver.hxx
new file mode 100644
index 000000000000..ede8eb9002f0
--- /dev/null
+++ b/mysqlc/source/mysqlc_driver.hxx
@@ -0,0 +1,118 @@
+/*************************************************************************
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2008 by Sun Microsystems, Inc.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* $RCSfile: mysqlc_driver.hxx,v $
+*
+* $Revision: 1.1.2.4 $
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+************************************************************************/
+
+#ifndef MYSQLC_SDRIVER_HXX
+#define MYSQLC_SDRIVER_HXX
+
+#include "mysqlc_connection.hxx"
+
+#include <com/sun/star/sdbc/XDriver.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+
+#include <cppuhelper/compbase2.hxx>
+#include <cppconn/driver.h>
+#include <osl/module.h>
+
+namespace connectivity
+{
+ namespace mysqlc
+ {
+ using ::rtl::OUString;
+ using ::com::sun::star::sdbc::SQLException;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::uno::Exception;
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::Sequence;
+ Reference< ::com::sun::star::uno::XInterface > SAL_CALL MysqlCDriver_CreateInstance(const Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) throw(Exception);
+
+ typedef ::cppu::WeakComponentImplHelper2< ::com::sun::star::sdbc::XDriver,
+ ::com::sun::star::lang::XServiceInfo > ODriver_BASE;
+
+ typedef void* (SAL_CALL * OMysqlCConnection_CreateInstanceFunction)(void* _pDriver);
+
+ class MysqlCDriver : public ODriver_BASE
+ {
+ protected:
+ Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory;
+ ::osl::Mutex m_aMutex; // mutex is need to control member access
+ OWeakRefArray m_xConnections; // vector containing a list
+ // of all the Connection objects
+ // for this Driver
+#ifndef SYSTEM_MYSQL_CPPCONN
+ oslModule m_hCppConnModule;
+ bool m_bAttemptedLoadCppConn;
+#endif
+
+ sql::Driver * cppDriver;
+
+ public:
+
+ MysqlCDriver(const Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory);
+
+ // OComponentHelper
+ void SAL_CALL disposing(void);
+ // XInterface
+ static OUString getImplementationName_Static() throw(RuntimeException);
+ static Sequence< OUString > getSupportedServiceNames_Static() throw(RuntimeException);
+
+ // XServiceInfo
+ OUString SAL_CALL getImplementationName() throw(RuntimeException);
+ sal_Bool SAL_CALL supportsService(const OUString& ServiceName) throw(RuntimeException);
+ Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(RuntimeException);
+
+ // XDriver
+ Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL connect(const OUString& url, const Sequence< ::com::sun::star::beans::PropertyValue >& info)
+ throw(SQLException, RuntimeException);
+
+ sal_Bool SAL_CALL acceptsURL(const OUString& url) throw(SQLException, RuntimeException);
+ Sequence< ::com::sun::star::sdbc::DriverPropertyInfo > SAL_CALL getPropertyInfo(const OUString& url, const Sequence< ::com::sun::star::beans::PropertyValue >& info)
+ throw(SQLException, RuntimeException);
+
+ sal_Int32 SAL_CALL getMajorVersion() throw(RuntimeException);
+ sal_Int32 SAL_CALL getMinorVersion() throw(RuntimeException);
+
+ inline Reference< ::com::sun::star::lang::XMultiServiceFactory > getFactory() const { return m_xFactory; }
+
+ rtl_TextEncoding getDefaultEncoding() { return RTL_TEXTENCODING_UTF8; }
+
+ private:
+ void impl_initCppConn_lck_throw();
+ };
+ } /* mysqlc */
+} /* connectivity */
+
+#endif // MYSQLC_SDRIVER_HXX
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
diff --git a/mysqlc/source/mysqlc_general.cxx b/mysqlc/source/mysqlc_general.cxx
new file mode 100644
index 000000000000..54058f0cef8c
--- /dev/null
+++ b/mysqlc/source/mysqlc_general.cxx
@@ -0,0 +1,176 @@
+/*************************************************************************
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2008 by Sun Microsystems, Inc.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* $RCSfile: mysqlc_general.cxx,v $
+*
+* $Revision: 1.1.2.3 $
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+************************************************************************/
+#include "mysqlc_general.hxx"
+#include "mysqlc_resultsetmetadata.hxx"
+
+#include <cppconn/exception.h>
+#include <cppconn/datatype.h>
+
+using com::sun::star::sdbc::SQLException;
+
+using com::sun::star::uno::UNO_QUERY;
+using com::sun::star::uno::Reference;
+using com::sun::star::uno::XInterface;
+using com::sun::star::uno::Any;
+using ::rtl::OUString;
+
+namespace mysqlc_sdbc_driver
+{
+// -----------------------------------------------------------------------------
+void throwFeatureNotImplementedException( const sal_Char* _pAsciiFeatureName, const Reference< XInterface >& _rxContext, const Any* _pNextException )
+ throw (SQLException)
+{
+ const ::rtl::OUString sMessage = ::rtl::OUString::createFromAscii( _pAsciiFeatureName ) + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ": feature not implemented." ) );
+ throw SQLException(
+ sMessage,
+ _rxContext,
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HYC00")),
+ 0,
+ _pNextException ? *_pNextException : Any()
+ );
+}
+
+
+void throwInvalidArgumentException( const sal_Char* _pAsciiFeatureName, const Reference< XInterface >& _rxContext, const Any* _pNextException )
+ throw (SQLException)
+{
+ const ::rtl::OUString sMessage = ::rtl::OUString::createFromAscii( _pAsciiFeatureName ) + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ": invalid arguments." ) );
+ throw SQLException(
+ sMessage,
+ _rxContext,
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HYC00")),
+ 0,
+ _pNextException ? *_pNextException : Any()
+ );
+}
+
+void translateAndThrow(const ::sql::SQLException& _error, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _context, const rtl_TextEncoding encoding)
+{
+ throw SQLException(
+ convert(_error.what(), encoding),
+ _context,
+ convert(_error.getSQLState(), encoding),
+ _error.getErrorCode(),
+ Any()
+ );
+}
+
+
+OUString getStringFromAny(const Any& _rAny)
+{
+ OUString nReturn;
+ OSL_VERIFY( _rAny >>= nReturn );
+ return nReturn;
+}
+
+
+int mysqlToOOOType(int cppConnType)
+ throw ()
+{
+ switch (cppConnType) {
+ case sql::DataType::BIT:
+ return com::sun::star::sdbc::DataType::VARCHAR;
+
+ case sql::DataType::TINYINT:
+ return com::sun::star::sdbc::DataType::TINYINT;
+
+ case sql::DataType::SMALLINT:
+ return com::sun::star::sdbc::DataType::SMALLINT;
+
+ case sql::DataType::INTEGER:
+ return com::sun::star::sdbc::DataType::INTEGER;
+
+ case sql::DataType::BIGINT:
+ return com::sun::star::sdbc::DataType::BIGINT;
+
+ case sql::DataType::REAL:
+ return com::sun::star::sdbc::DataType::REAL;
+
+ case sql::DataType::DOUBLE:
+ return com::sun::star::sdbc::DataType::DOUBLE;
+
+ case sql::DataType::DECIMAL:
+ return com::sun::star::sdbc::DataType::DECIMAL;
+
+ case sql::DataType::CHAR:
+ return com::sun::star::sdbc::DataType::CHAR;
+
+ case sql::DataType::BINARY:
+ return com::sun::star::sdbc::DataType::BINARY;
+
+ case sql::DataType::ENUM:
+ case sql::DataType::SET:
+ case sql::DataType::VARCHAR:
+ return com::sun::star::sdbc::DataType::VARCHAR;
+
+ case sql::DataType::VARBINARY:
+ return com::sun::star::sdbc::DataType::VARBINARY;
+
+ case sql::DataType::LONGVARCHAR:
+ return com::sun::star::sdbc::DataType::LONGVARCHAR;
+
+ case sql::DataType::LONGVARBINARY:
+ return com::sun::star::sdbc::DataType::LONGVARBINARY;
+
+ case sql::DataType::TIMESTAMP:
+ return com::sun::star::sdbc::DataType::TIMESTAMP;
+
+ case sql::DataType::DATE:
+ return com::sun::star::sdbc::DataType::DATE;
+
+ case sql::DataType::TIME:
+ return com::sun::star::sdbc::DataType::TIME;
+
+ case sql::DataType::GEOMETRY:
+ return com::sun::star::sdbc::DataType::VARCHAR;
+
+ case sql::DataType::SQLNULL:
+ return com::sun::star::sdbc::DataType::SQLNULL;
+
+ case sql::DataType::UNKNOWN:
+ return com::sun::star::sdbc::DataType::VARCHAR;
+ }
+
+ OSL_ENSURE( false, "mysqlToOOOType: unhandled case, falling back to VARCHAR" );
+ return com::sun::star::sdbc::DataType::VARCHAR;
+}
+
+
+::rtl::OUString convert(const ::std::string& _string, const rtl_TextEncoding encoding)
+{
+ return ::rtl::OUString( _string.c_str(), _string.size(), encoding );
+}
+
+::std::string convert(const ::rtl::OUString& _string, const rtl_TextEncoding encoding)
+{
+ return ::std::string( ::rtl::OUStringToOString( _string, encoding ).getStr() );
+}
+
+
+} /* namespace */
diff --git a/mysqlc/source/mysqlc_general.hxx b/mysqlc/source/mysqlc_general.hxx
new file mode 100644
index 000000000000..43cf1c8ef86e
--- /dev/null
+++ b/mysqlc/source/mysqlc_general.hxx
@@ -0,0 +1,66 @@
+/*************************************************************************
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2008 by Sun Microsystems, Inc.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* $RCSfile: mysqlc_general.hxx,v $
+*
+* $Revision: 1.1.2.3 $
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+************************************************************************/
+
+#ifndef _MYSQLC_GENERAL_
+#define _MYSQLC_GENERAL_
+
+#include <cppconn/exception.h>
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/sdbc/SQLException.hpp>
+
+namespace mysqlc_sdbc_driver
+{
+ rtl::OUString getStringFromAny(const ::com::sun::star::uno::Any& _rAny);
+
+ void throwFeatureNotImplementedException(
+ const sal_Char* _pAsciiFeatureName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContext,
+ const ::com::sun::star::uno::Any* _pNextException = NULL
+ )
+ throw (::com::sun::star::sdbc::SQLException);
+
+ void throwInvalidArgumentException(
+ const sal_Char* _pAsciiFeatureName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContext,
+ const ::com::sun::star::uno::Any* _pNextException = NULL
+ )
+ throw (::com::sun::star::sdbc::SQLException);
+
+ void translateAndThrow(const ::sql::SQLException& _error, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _context, const rtl_TextEncoding encoding);
+
+ int mysqlToOOOType(int mysqlType) throw ();
+
+
+ ::rtl::OUString convert(const ::std::string& _string, const rtl_TextEncoding encoding);
+
+ ::std::string convert(const ::rtl::OUString& _string, const rtl_TextEncoding encoding);
+}
+
+#endif
diff --git a/mysqlc/source/mysqlc_preparedstatement.cxx b/mysqlc/source/mysqlc_preparedstatement.cxx
new file mode 100644
index 000000000000..a6c1cedb2acb
--- /dev/null
+++ b/mysqlc/source/mysqlc_preparedstatement.cxx
@@ -0,0 +1,944 @@
+/*************************************************************************
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2008 by Sun Microsystems, Inc.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* $RCSfile: mysqlc_preparedstatement.cxx,v $
+*
+* $Revision: 1.1.2.5 $
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+************************************************************************/
+
+#include "mysqlc_general.hxx"
+#include "mysqlc_preparedstatement.hxx"
+#include "mysqlc_propertyids.hxx"
+#include "mysqlc_resultsetmetadata.hxx"
+
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/sdbc/DataType.hpp>
+
+#include <cppconn/connection.h>
+#include <cppconn/exception.h>
+#include <cppconn/parameter_metadata.h>
+#include <cppconn/prepared_statement.h>
+#include <cppconn/statement.h>
+#include <cppuhelper/typeprovider.hxx>
+#include <osl/diagnose.h>
+
+#include <stdio.h>
+
+using namespace connectivity::mysqlc;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::beans;
+using namespace com::sun::star::sdbc;
+using namespace com::sun::star::container;
+using namespace com::sun::star::io;
+using namespace com::sun::star::util;
+using ::osl::MutexGuard;
+using mysqlc_sdbc_driver::getStringFromAny;
+
+
+/* {{{ my_i_to_a() -I- */
+static inline char * my_i_to_a(char * buf, size_t buf_size, int a)
+{
+ snprintf(buf, buf_size, "%d", a);
+ return buf;
+}
+/* }}} */
+
+
+IMPLEMENT_SERVICE_INFO(OPreparedStatement,"com.sun.star.sdbcx.mysqlc.PreparedStatement","com.sun.star.sdbc.PreparedStatement");
+
+
+/* {{{ OPreparedStatement::OPreparedStatement() -I- */
+OPreparedStatement::OPreparedStatement(OConnection* _pConnection, sql::PreparedStatement * _cppPrepStmt)
+ :OCommonStatement(_pConnection, _cppPrepStmt)
+{
+ OSL_TRACE("OPreparedStatement::OPreparedStatement");
+ m_pConnection = _pConnection;
+ m_pConnection->acquire();
+
+ try {
+ m_paramCount = ((sql::PreparedStatement *)cppStatement)->getParameterMetaData()->getParameterCount();
+ } catch (sql::SQLException &e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_pConnection->getConnectionEncoding());
+ }
+}
+/* }}} */
+
+
+/* {{{ OPreparedStatement::~OPreparedStatement() -I- */
+OPreparedStatement::~OPreparedStatement()
+{
+ OSL_TRACE("OPreparedStatement::~OPreparedStatement");
+}
+/* }}} */
+
+
+/* {{{ OPreparedStatement::acquire() -I- */
+void SAL_CALL OPreparedStatement::acquire()
+ throw()
+{
+ OSL_TRACE("OPreparedStatement::acquire");
+ OCommonStatement::acquire();
+}
+/* }}} */
+
+
+/* {{{ OPreparedStatement::release() -I- */
+void SAL_CALL OPreparedStatement::release()
+ throw()
+{
+ OSL_TRACE("OPreparedStatement::release");
+ OCommonStatement::release();
+}
+/* }}} */
+
+
+/* {{{ OPreparedStatement::queryInterface() -I- */
+Any SAL_CALL OPreparedStatement::queryInterface(const Type & rType)
+ throw(RuntimeException)
+{
+ OSL_TRACE("OPreparedStatement::queryInterface");
+ Any aRet = OCommonStatement::queryInterface(rType);
+ if (!aRet.hasValue()) {
+ aRet = OPreparedStatement_BASE::queryInterface(rType);
+ }
+ return (aRet);
+}
+/* }}} */
+
+
+/* {{{ OPreparedStatement::getPropertySetInfo() -I- */
+Sequence< Type > SAL_CALL OPreparedStatement::getTypes()
+ throw(RuntimeException)
+{
+ OSL_TRACE("OPreparedStatement::getTypes");
+ return concatSequences(OPreparedStatement_BASE::getTypes(), OCommonStatement::getTypes());
+}
+/* }}} */
+
+
+/* {{{ OPreparedStatement::getMetaData() -I- */
+Reference< XResultSetMetaData > SAL_CALL OPreparedStatement::getMetaData()
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OPreparedStatement::getMetaData");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OPreparedStatement::rBHelper.bDisposed);
+
+ try {
+ if (!m_xMetaData.is()) {
+ m_xMetaData = new OResultSetMetaData(
+ ((sql::PreparedStatement *)cppStatement)->getMetaData(),
+ getOwnConnection()->getConnectionEncoding()
+ );
+ }
+ } catch (sql::MethodNotImplementedException) {
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OPreparedStatement::getMetaData", *this);
+ } catch (sql::SQLException &e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_pConnection->getConnectionEncoding());
+ }
+ return m_xMetaData;
+}
+/* }}} */
+
+
+/* {{{ OPreparedStatement::close() -I- */
+void SAL_CALL OPreparedStatement::close()
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OPreparedStatement::close");
+
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OPreparedStatement::rBHelper.bDisposed);
+
+ try {
+ clearWarnings();
+ clearParameters();
+ OCommonStatement::close();
+ } catch (SQLException) {
+ // If we get an error, ignore
+ }
+
+ // Remove this Statement object from the Connection object's
+ // list
+}
+/* }}} */
+
+
+/* {{{ OPreparedStatement::execute() -I- */
+sal_Bool SAL_CALL OPreparedStatement::execute()
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OPreparedStatement::execute");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OPreparedStatement::rBHelper.bDisposed);
+
+ sal_Bool success = sal_False;
+ try {
+ success = ((sql::PreparedStatement *)cppStatement)->execute()? sal_True:sal_False;
+ } catch (sql::SQLException &e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_pConnection->getConnectionEncoding());
+ }
+ return success;
+}
+/* }}} */
+
+
+/* {{{ OPreparedStatement::executeUpdate() -I- */
+sal_Int32 SAL_CALL OPreparedStatement::executeUpdate()
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OPreparedStatement::executeUpdate");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OPreparedStatement::rBHelper.bDisposed);
+
+ sal_Int32 affectedRows = sal_False;
+ try {
+ affectedRows = ((sql::PreparedStatement *)cppStatement)->executeUpdate();
+ } catch (sql::SQLException &e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_pConnection->getConnectionEncoding());
+ }
+ return affectedRows;
+}
+/* }}} */
+
+
+/* {{{ OPreparedStatement::getPropertySetInfo() -I- */
+void SAL_CALL OPreparedStatement::setString(sal_Int32 parameter, const OUString& x)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OPreparedStatement::setString");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OPreparedStatement::rBHelper.bDisposed);
+ checkParameterIndex(parameter);
+
+ try {
+ std::string stringie(::rtl::OUStringToOString(x, m_pConnection->getConnectionEncoding()).getStr());
+ ((sql::PreparedStatement *)cppStatement)->setString(parameter, stringie);
+ } catch (sql::MethodNotImplementedException) {
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OPreparedStatement::clearParameters", *this);
+ } catch (sql::SQLException &e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_pConnection->getConnectionEncoding());
+ }
+}
+/* }}} */
+
+
+/* {{{ OPreparedStatement::getConnection() -I- */
+Reference< XConnection > SAL_CALL OPreparedStatement::getConnection()
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OPreparedStatement::getConnection");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OPreparedStatement::rBHelper.bDisposed);
+
+ return (Reference< XConnection >)m_pConnection;
+}
+/* }}} */
+
+Reference< XResultSet > SAL_CALL OPreparedStatement::executeQuery(const OUString& sql)
+ throw(SQLException, RuntimeException)
+{
+ return OCommonStatement::executeQuery( sql );
+}
+
+sal_Int32 SAL_CALL OPreparedStatement::executeUpdate(const OUString& sql)
+ throw(SQLException, RuntimeException)
+{
+ return OCommonStatement::executeUpdate( sql );
+}
+
+sal_Bool SAL_CALL OPreparedStatement::execute( const OUString& sql )
+ throw(SQLException, RuntimeException)
+{
+ return OCommonStatement::execute( sql );
+}
+
+/* {{{ OPreparedStatement::executeQuery() -I- */
+Reference< XResultSet > SAL_CALL OPreparedStatement::executeQuery()
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OPreparedStatement::executeQuery");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OPreparedStatement::rBHelper.bDisposed);
+
+ Reference< XResultSet > xResultSet;
+ try {
+ sql::ResultSet * res = ((sql::PreparedStatement *)cppStatement)->executeQuery();
+ xResultSet = new OResultSet(this, res, getOwnConnection()->getConnectionEncoding());
+ } catch (sql::SQLException &e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_pConnection->getConnectionEncoding());
+ }
+ return xResultSet;
+}
+/* }}} */
+
+
+/* {{{ OPreparedStatement::setBoolean() -I- */
+void SAL_CALL OPreparedStatement::setBoolean(sal_Int32 parameter, sal_Bool x)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OPreparedStatement::setBoolean");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OPreparedStatement::rBHelper.bDisposed);
+ checkParameterIndex(parameter);
+
+ try {
+ ((sql::PreparedStatement *)cppStatement)->setBoolean(parameter, x);
+ } catch (sql::MethodNotImplementedException) {
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OPreparedStatement::setBoolean", *this);
+ } catch (sql::SQLException &e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_pConnection->getConnectionEncoding());
+ }
+}
+/* }}} */
+
+
+/* {{{ OPreparedStatement::setByte() -I- */
+void SAL_CALL OPreparedStatement::setByte(sal_Int32 parameter, sal_Int8 x)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OPreparedStatement::setByte");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OPreparedStatement::rBHelper.bDisposed);
+ checkParameterIndex(parameter);
+
+ try {
+ ((sql::PreparedStatement *)cppStatement)->setInt(parameter, x);
+ } catch (sql::MethodNotImplementedException) {
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OPreparedStatement::setByte", *this);
+ } catch (sql::SQLException &e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_pConnection->getConnectionEncoding());
+ }
+}
+/* }}} */
+
+
+/* {{{ OPreparedStatement::setDate() -I- */
+void SAL_CALL OPreparedStatement::setDate(sal_Int32 parameter, const Date& aData)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OPreparedStatement::setDate");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OPreparedStatement::rBHelper.bDisposed);
+ checkParameterIndex(parameter);
+
+ std::string dateStr;
+ char buf[20];
+ dateStr.append(my_i_to_a(buf, sizeof(buf)-1, aData.Year));
+ dateStr.append("-", 1);
+ dateStr.append(my_i_to_a(buf, sizeof(buf)-1, aData.Month));
+ dateStr.append("-", 1);
+ dateStr.append(my_i_to_a(buf, sizeof(buf)-1, aData.Day));
+
+ try {
+ ((sql::PreparedStatement *)cppStatement)->setDateTime(parameter, dateStr);
+ } catch (sql::MethodNotImplementedException) {
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OPreparedStatement::setDate", *this);
+ } catch (sql::SQLException &e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_pConnection->getConnectionEncoding());
+ }
+}
+/* }}} */
+
+
+/* {{{ OPreparedStatement::setTime() -I- */
+void SAL_CALL OPreparedStatement::setTime(sal_Int32 parameter, const Time& aVal)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OPreparedStatement::setTime");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OPreparedStatement::rBHelper.bDisposed);
+ checkParameterIndex(parameter);
+
+ std::string timeStr;
+ char buf[20];
+ timeStr.append(my_i_to_a(buf, sizeof(buf)-1, aVal.Hours));
+ timeStr.append(":", 1);
+ timeStr.append(my_i_to_a(buf, sizeof(buf)-1, aVal.Minutes));
+ timeStr.append(":", 1);
+ timeStr.append(my_i_to_a(buf, sizeof(buf)-1, aVal.Seconds));
+
+ try {
+ ((sql::PreparedStatement *)cppStatement)->setDateTime(parameter, timeStr);
+ } catch (sql::MethodNotImplementedException) {
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OPreparedStatement::setTime", *this);
+ } catch (sql::SQLException &e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_pConnection->getConnectionEncoding());
+ }
+}
+/* }}} */
+
+
+/* {{{ OPreparedStatement::setTimestamp() -I- */
+void SAL_CALL OPreparedStatement::setTimestamp(sal_Int32 parameter, const DateTime& aVal)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OPreparedStatement::setTimestamp");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OPreparedStatement::rBHelper.bDisposed);
+ checkParameterIndex(parameter);
+
+ std::string timeStr;
+ char buf[20];
+ timeStr.append(my_i_to_a(buf, sizeof(buf)-1, aVal.Year));
+ timeStr.append("-", 1);
+ timeStr.append(my_i_to_a(buf, sizeof(buf)-1, aVal.Month));
+ timeStr.append("-", 1);
+ timeStr.append(my_i_to_a(buf, sizeof(buf)-1, aVal.Day));
+
+ timeStr.append(" ", 1);
+
+ timeStr.append(my_i_to_a(buf, sizeof(buf)-1, aVal.Hours));
+ timeStr.append(":", 1);
+ timeStr.append(my_i_to_a(buf, sizeof(buf)-1, aVal.Minutes));
+ timeStr.append(":", 1);
+ timeStr.append(my_i_to_a(buf, sizeof(buf)-1, aVal.Seconds));
+
+ try {
+ ((sql::PreparedStatement *)cppStatement)->setDateTime(parameter, timeStr);
+ } catch (sql::MethodNotImplementedException) {
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OPreparedStatement::setTimestamp", *this);
+ } catch (sql::SQLException &e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_pConnection->getConnectionEncoding());
+ }
+}
+/* }}} */
+
+
+/* {{{ OPreparedStatement::setDouble() -I- */
+void SAL_CALL OPreparedStatement::setDouble(sal_Int32 parameter, double x)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OPreparedStatement::setDouble");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OPreparedStatement::rBHelper.bDisposed);
+ checkParameterIndex(parameter);
+
+ try {
+ ((sql::PreparedStatement *)cppStatement)->setDouble(parameter, x);
+ } catch (sql::MethodNotImplementedException) {
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OPreparedStatement::setDouble", *this);
+ } catch (sql::SQLException &e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_pConnection->getConnectionEncoding());
+ }
+}
+/* }}} */
+
+
+/* {{{ OPreparedStatement::setFloat() -I- */
+void SAL_CALL OPreparedStatement::setFloat(sal_Int32 parameter, float x)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OPreparedStatement::setFloat");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OPreparedStatement::rBHelper.bDisposed);
+ checkParameterIndex(parameter);
+
+ try {
+ ((sql::PreparedStatement *)cppStatement)->setDouble(parameter, x);
+ } catch (sql::MethodNotImplementedException) {
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OPreparedStatement::setFloat", *this);
+ } catch (sql::SQLException &e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_pConnection->getConnectionEncoding());
+ }
+}
+/* }}} */
+
+
+/* {{{ OPreparedStatement::setInt() -I- */
+void SAL_CALL OPreparedStatement::setInt(sal_Int32 parameter, sal_Int32 x)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OPreparedStatement::setInt");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OPreparedStatement::rBHelper.bDisposed);
+ checkParameterIndex(parameter);
+
+ try {
+ ((sql::PreparedStatement *)cppStatement)->setInt(parameter, x);
+ } catch (sql::MethodNotImplementedException) {
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OPreparedStatement::setInt", *this);
+ } catch (sql::SQLException &e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_pConnection->getConnectionEncoding());
+ }
+}
+/* }}} */
+
+
+/* {{{ OPreparedStatement::setLong() -I- */
+void SAL_CALL OPreparedStatement::setLong(sal_Int32 parameter, sal_Int64 aVal)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OPreparedStatement::setLong");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OPreparedStatement::rBHelper.bDisposed);
+ checkParameterIndex(parameter);
+
+ try {
+ ((sql::PreparedStatement *)cppStatement)->setInt64(parameter, aVal);
+ } catch (sql::MethodNotImplementedException) {
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OPreparedStatement::setLong", *this);
+ } catch (sql::SQLException &e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_pConnection->getConnectionEncoding());
+ }
+}
+/* }}} */
+
+
+/* {{{ OPreparedStatement::setNull() -I- */
+void SAL_CALL OPreparedStatement::setNull(sal_Int32 parameter, sal_Int32 sqlType)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OPreparedStatement::setNull");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OPreparedStatement::rBHelper.bDisposed);
+ checkParameterIndex(parameter);
+
+ try {
+ ((sql::PreparedStatement *)cppStatement)->setNull(parameter, sqlType);
+ } catch (sql::MethodNotImplementedException) {
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OPreparedStatement::setNull", *this);
+ } catch (sql::SQLException &e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_pConnection->getConnectionEncoding());
+ }
+}
+/* }}} */
+
+
+/* {{{ OPreparedStatement::setClob() -U- */
+void SAL_CALL OPreparedStatement::setClob(sal_Int32 parameter, const Reference< XClob >& /* x */)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OPreparedStatement::setClob");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OPreparedStatement::rBHelper.bDisposed);
+ checkParameterIndex(parameter);
+
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OPreparedStatement::setClob", *this);
+}
+/* }}} */
+
+
+/* {{{ OPreparedStatement::setBlob() -U- */
+void SAL_CALL OPreparedStatement::setBlob(sal_Int32 parameter, const Reference< XBlob >& /* x */)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OPreparedStatement::setBlob");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OPreparedStatement::rBHelper.bDisposed);
+ checkParameterIndex(parameter);
+
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OPreparedStatement::setBlob", *this);
+}
+/* }}} */
+
+
+/* {{{ OPreparedStatement::setArray() -U- */
+void SAL_CALL OPreparedStatement::setArray(sal_Int32 parameter, const Reference< XArray >& /* x */)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OPreparedStatement::setArray");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OPreparedStatement::rBHelper.bDisposed);
+ checkParameterIndex(parameter);
+
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OPreparedStatement::setArray", *this);
+}
+/* }}} */
+
+
+/* {{{ OPreparedStatement::setRef() -U- */
+void SAL_CALL OPreparedStatement::setRef(sal_Int32 parameter, const Reference< XRef >& /* x */)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OPreparedStatement::setRef");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OPreparedStatement::rBHelper.bDisposed);
+ checkParameterIndex(parameter);
+
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OPreparedStatement::setRef", *this);
+}
+/* }}} */
+
+namespace
+{
+ template < class COMPLEXTYPE >
+ bool impl_setObject( const Reference< XParameters >& _rxParam, sal_Int32 _parameterIndex, const Any& _value,
+ void ( SAL_CALL XParameters::*_Setter )( sal_Int32, const COMPLEXTYPE& ), bool _throwIfNotExtractable )
+ {
+ COMPLEXTYPE aValue;
+ if ( _value >>= aValue )
+ {
+ (_rxParam.get()->*_Setter)( _parameterIndex, aValue );
+ return true;
+ }
+
+ if ( _throwIfNotExtractable )
+ mysqlc_sdbc_driver::throwInvalidArgumentException( "OPreparedStatement::setObjectWithInfo", _rxParam );
+ return false;
+ }
+
+ template < class INTTYPE >
+ void impl_setObject( const Reference< XParameters >& _rxParam, sal_Int32 _parameterIndex, const Any& _value,
+ void ( SAL_CALL XParameters::*_Setter )( sal_Int32, INTTYPE ) )
+ {
+ sal_Int32 nValue(0);
+ if ( !( _value >>= nValue ) )
+ mysqlc_sdbc_driver::throwInvalidArgumentException( "OPreparedStatement::setObjectWithInfo", _rxParam );
+ (_rxParam.get()->*_Setter)( _parameterIndex, (INTTYPE)nValue );
+ }
+}
+
+/* {{{ OPreparedStatement::setObjectWithInfo() -U- */
+void SAL_CALL OPreparedStatement::setObjectWithInfo(sal_Int32 _parameterIndex, const Any& _value, sal_Int32 _targetSqlType, sal_Int32 /* scale */)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OPreparedStatement::setObjectWithInfo");
+ checkDisposed(OPreparedStatement::rBHelper.bDisposed);
+ MutexGuard aGuard(m_aMutex);
+ checkParameterIndex( _parameterIndex );
+
+ if ( !_value.hasValue() )
+ {
+ setNull( _parameterIndex, _targetSqlType );
+ return;
+ }
+
+ switch ( _targetSqlType )
+ {
+ case DataType::DECIMAL:
+ case DataType::NUMERIC:
+ {
+ double nValue(0);
+ if ( _value >>= nValue )
+ {
+ setDouble( _parameterIndex, nValue );
+ break;
+ }
+ }
+ // run through
+
+ case DataType::CHAR:
+ case DataType::VARCHAR:
+ case DataType::LONGVARCHAR:
+ impl_setObject( this, _parameterIndex, _value, &XParameters::setString, true );
+ break;
+
+ case DataType::BIGINT:
+ {
+ sal_Int64 nValue = 0;
+ if ( !( _value >>= nValue ) )
+ mysqlc_sdbc_driver::throwInvalidArgumentException( "OPreparedStatement::setObjectWithInfo", *this );
+ setLong( _parameterIndex, nValue );
+ }
+ break;
+
+ case DataType::FLOAT:
+ case DataType::REAL:
+ {
+ float nValue = 0;
+ if ( _value >>= nValue )
+ {
+ setFloat(_parameterIndex,nValue);
+ break;
+ }
+ }
+ // run through if we couldn't set a float value
+
+ case DataType::DOUBLE:
+ {
+ double nValue(0);
+ if ( !( _value >>= nValue ) )
+ mysqlc_sdbc_driver::throwInvalidArgumentException( "OPreparedStatement::setObjectWithInfo", *this );
+ setDouble( _parameterIndex, nValue );
+ }
+ break;
+
+ case DataType::DATE:
+ impl_setObject( this, _parameterIndex, _value, &XParameters::setDate, true );
+ break;
+
+ case DataType::TIME:
+ impl_setObject( this, _parameterIndex, _value, &XParameters::setTime, true );
+ break;
+
+ case DataType::TIMESTAMP:
+ impl_setObject( this, _parameterIndex, _value, &XParameters::setTimestamp, true );
+ break;
+
+ case DataType::BINARY:
+ case DataType::VARBINARY:
+ case DataType::LONGVARBINARY:
+ {
+ if ( impl_setObject( this, _parameterIndex, _value, &XParameters::setBytes, false )
+ || impl_setObject( this, _parameterIndex, _value, &XParameters::setBlob, false )
+ || impl_setObject( this, _parameterIndex, _value, &XParameters::setClob, false )
+ )
+ break;
+
+ Reference< ::com::sun::star::io::XInputStream > xBinStream;
+ if ( _value >>= xBinStream )
+ {
+ setBinaryStream( _parameterIndex, xBinStream, xBinStream->available() );
+ break;
+ }
+
+ mysqlc_sdbc_driver::throwInvalidArgumentException( "OPreparedStatement::setObjectWithInfo", *this );
+ }
+ break;
+
+ case DataType::BIT:
+ case DataType::BOOLEAN:
+ {
+ bool bValue( false );
+ if ( _value >>= bValue )
+ {
+ setBoolean( _parameterIndex, bValue );
+ break;
+ }
+ sal_Int32 nValue( 0 );
+ if ( _value >>= nValue )
+ {
+ setBoolean( _parameterIndex, ( nValue != 0 ) );
+ break;
+ }
+ mysqlc_sdbc_driver::throwInvalidArgumentException( "OPreparedStatement::setObjectWithInfo", *this );
+ }
+ break;
+
+ case DataType::TINYINT:
+ impl_setObject( this, _parameterIndex, _value, &XParameters::setByte );
+ break;
+
+ case DataType::SMALLINT:
+ impl_setObject( this, _parameterIndex, _value, &XParameters::setShort );
+ break;
+
+ case DataType::INTEGER:
+ impl_setObject( this, _parameterIndex, _value, &XParameters::setInt );
+ break;
+
+ default:
+ mysqlc_sdbc_driver::throwInvalidArgumentException( "OPreparedStatement::setObjectWithInfo", *this );
+ break;
+ }
+}
+/* }}} */
+
+
+/* {{{ OPreparedStatement::setObjectNull() -U- */
+void SAL_CALL OPreparedStatement::setObjectNull(sal_Int32 parameter, sal_Int32 /* sqlType */, const OUString& /* typeName */)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OPreparedStatement::setObjectNull");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OPreparedStatement::rBHelper.bDisposed);
+ checkParameterIndex(parameter);
+
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OPreparedStatement::setObjectNull", *this);
+}
+/* }}} */
+
+
+/* {{{ OPreparedStatement::setObject() -U- */
+void SAL_CALL OPreparedStatement::setObject(sal_Int32 parameter, const Any& /* x */)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OPreparedStatement::setObject");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OPreparedStatement::rBHelper.bDisposed);
+ checkParameterIndex(parameter);
+
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OPreparedStatement::setObject", *this);
+}
+/* }}} */
+
+
+/* {{{ OPreparedStatement::setShort() -I- */
+void SAL_CALL OPreparedStatement::setShort(sal_Int32 parameter, sal_Int16 x)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OPreparedStatement::setShort");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OPreparedStatement::rBHelper.bDisposed);
+ checkParameterIndex(parameter);
+
+ try {
+ ((sql::PreparedStatement *)cppStatement)->setInt(parameter, x);
+ } catch (sql::MethodNotImplementedException) {
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OPreparedStatement::setShort", *this);
+ } catch (sql::SQLException &e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_pConnection->getConnectionEncoding());
+ }
+}
+/* }}} */
+
+
+/* {{{ OPreparedStatement::setBytes() -I- */
+void SAL_CALL OPreparedStatement::setBytes(sal_Int32 parameter, const Sequence< sal_Int8 >& x)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OPreparedStatement::setBytes");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OPreparedStatement::rBHelper.bDisposed);
+ checkParameterIndex(parameter);
+
+ std::string blobby((char *)x.getConstArray(), x.getLength());
+ try {
+ ((sql::PreparedStatement *)cppStatement)->setString(parameter, blobby);
+ } catch (sql::MethodNotImplementedException) {
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OPreparedStatement::setBytes", *this);
+ } catch (sql::SQLException &e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_pConnection->getConnectionEncoding());
+ }
+}
+/* }}} */
+
+
+/* {{{ OPreparedStatement::setCharacterStream() -U- */
+void SAL_CALL OPreparedStatement::setCharacterStream(sal_Int32 parameter,
+ const Reference< XInputStream >& /* x */,
+ sal_Int32 /* length */)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OPreparedStatement::setCharacterStream");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OPreparedStatement::rBHelper.bDisposed);
+ checkParameterIndex(parameter);
+
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OPreparedStatement::setCharacterStream", *this);
+}
+/* }}} */
+
+
+/* {{{ OPreparedStatement::setBinaryStream() -U- */
+void SAL_CALL OPreparedStatement::setBinaryStream(sal_Int32 parameter,
+ const Reference< XInputStream >& /* x */,
+ sal_Int32 /* length */)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OPreparedStatement::setBinaryStream");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OPreparedStatement::rBHelper.bDisposed);
+ checkParameterIndex(parameter);
+
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OPreparedStatement::setBinaryStream", *this);
+}
+/* }}} */
+
+
+/* {{{ OPreparedStatement::clearParameters() -I- */
+void SAL_CALL OPreparedStatement::clearParameters()
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OPreparedStatement::clearParameters");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OPreparedStatement::rBHelper.bDisposed);
+
+ try {
+ ((sql::PreparedStatement *)cppStatement)->clearParameters();
+ } catch (sql::MethodNotImplementedException) {
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OPreparedStatement::clearParameters", *this);
+ } catch (sql::SQLException &e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_pConnection->getConnectionEncoding());
+ }
+}
+/* }}} */
+
+
+/* {{{ OPreparedStatement::clearBatch() -U- */
+void SAL_CALL OPreparedStatement::clearBatch()
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OPreparedStatement::clearBatch");
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OPreparedStatement::clearBatch", *this);
+}
+/* }}} */
+
+
+/* {{{ OPreparedStatement::addBatch() -U- */
+void SAL_CALL OPreparedStatement::addBatch()
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OPreparedStatement::addBatch");
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OPreparedStatement::addBatch", *this);
+}
+/* }}} */
+
+
+/* {{{ OPreparedStatement::executeBatch() -I- */
+Sequence< sal_Int32 > SAL_CALL OPreparedStatement::executeBatch()
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OPreparedStatement::executeBatch");
+ Sequence< sal_Int32 > aRet= Sequence< sal_Int32 > ();
+ return aRet;
+}
+/* }}} */
+
+
+/* {{{ OPreparedStatement::setFastPropertyValue_NoBroadcast() -I- */
+void OPreparedStatement::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue)
+ throw(Exception)
+{
+ OSL_TRACE("OPreparedStatement::setFastPropertyValue_NoBroadcast");
+ switch(nHandle)
+ {
+ case PROPERTY_ID_RESULTSETCONCURRENCY:
+ break;
+ case PROPERTY_ID_RESULTSETTYPE:
+ break;
+ case PROPERTY_ID_FETCHDIRECTION:
+ break;
+ case PROPERTY_ID_USEBOOKMARKS:
+ break;
+ default:
+ /* XXX: Recursion ?? */
+ OPreparedStatement::setFastPropertyValue_NoBroadcast(nHandle,rValue);
+ }
+}
+/* }}} */
+
+
+/* {{{ OPreparedStatement::checkParameterIndex() -I- */
+void OPreparedStatement::checkParameterIndex(sal_Int32 column)
+{
+ OSL_TRACE("OPreparedStatement::checkColumnIndex");
+ if (column < 1 || column > (sal_Int32) m_paramCount) {
+ OUString buf( RTL_CONSTASCII_USTRINGPARAM( "Parameter index out of range" ) );
+ throw SQLException(buf, *this, OUString(), 1, Any ());
+ }
+}
+/* }}} */
+
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
diff --git a/mysqlc/source/mysqlc_preparedstatement.hxx b/mysqlc/source/mysqlc_preparedstatement.hxx
new file mode 100644
index 000000000000..f58e59982aaa
--- /dev/null
+++ b/mysqlc/source/mysqlc_preparedstatement.hxx
@@ -0,0 +1,194 @@
+/*************************************************************************
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2008 by Sun Microsystems, Inc.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* $RCSfile: mysqlc_preparedstatement.hxx,v $
+*
+* $Revision: 1.1.2.4 $
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+************************************************************************/
+
+#ifndef CONNECTIVITY_SPREPAREDSTATEMENT_HXX
+#define CONNECTIVITY_SPREPAREDSTATEMENT_HXX
+#include "mysqlc_statement.hxx"
+#include "mysqlc_resultset.hxx"
+
+#ifndef _COM_SUN_STAR_SDBC_XPREPAREDSTATEMENT_HPP_
+#include <com/sun/star/sdbc/XPreparedStatement.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XPARAMETERS_HPP_
+#include <com/sun/star/sdbc/XParameters.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XRESULTSETMETADATASUPPLIER_HPP_
+#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XPREPAREDBATCHEXECUTION_HPP_
+#include <com/sun/star/sdbc/XPreparedBatchExecution.hpp>
+#endif
+#ifndef _COM_SUN_STAR_IO_XINPUTSTREAM_HPP_
+#include <com/sun/star/io/XInputStream.hpp>
+#endif
+
+#include <cppconn/prepared_statement.h>
+
+namespace connectivity
+{
+ namespace mysqlc
+ {
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::uno::Type;
+ using ::com::sun::star::sdbc::SQLException;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::sdbc::XResultSetMetaData;
+
+ class OBoundParam;
+ typedef ::cppu::ImplHelper5< ::com::sun::star::sdbc::XPreparedStatement,
+ ::com::sun::star::sdbc::XParameters,
+ ::com::sun::star::sdbc::XPreparedBatchExecution,
+ ::com::sun::star::sdbc::XResultSetMetaDataSupplier,
+ ::com::sun::star::lang::XServiceInfo> OPreparedStatement_BASE;
+
+ class OPreparedStatement : public OCommonStatement,
+ public OPreparedStatement_BASE
+ {
+ protected:
+ unsigned int m_paramCount; // number of placeholders
+ sal_Int32 m_nNumParams; // Number of parameter markers for the prepared statement
+ Reference< XResultSetMetaData > m_xMetaData;
+
+ void checkParameterIndex(sal_Int32 parameter);
+
+ protected:
+ void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const Any& rValue)
+ throw (::com::sun::star::uno::Exception);
+ virtual ~OPreparedStatement();
+ public:
+ DECLARE_SERVICE_INFO();
+ OPreparedStatement(OConnection* _pConnection, sql::PreparedStatement * cppPrepStmt);
+
+ //XInterface
+ Any SAL_CALL queryInterface(const Type & rType) throw(RuntimeException);
+ void SAL_CALL acquire() throw();
+ void SAL_CALL release() throw();
+
+ //XTypeProvider
+ ::com::sun::star::uno::Sequence< Type > SAL_CALL getTypes()
+ throw(RuntimeException);
+
+ // XPreparedStatement
+ Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL executeQuery() throw(SQLException, RuntimeException);
+ sal_Int32 SAL_CALL executeUpdate() throw(SQLException, RuntimeException);
+ sal_Bool SAL_CALL execute() throw(SQLException, RuntimeException);
+ Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL getConnection() throw(SQLException, RuntimeException);
+
+ // XStatement
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL executeQuery(const OUString& sql)
+ throw(SQLException, RuntimeException);
+ sal_Int32 SAL_CALL executeUpdate(const OUString& sql)
+ throw(SQLException, RuntimeException);
+ sal_Bool SAL_CALL execute( const OUString& sql )
+ throw(SQLException, RuntimeException);
+
+ // XParameters
+ void SAL_CALL setNull(sal_Int32 parameter, sal_Int32 sqlType) throw(SQLException, RuntimeException);
+
+ void SAL_CALL setObjectNull(sal_Int32 parameter, sal_Int32 sqlType, const OUString& typeName)
+ throw(SQLException, RuntimeException);
+
+ void SAL_CALL setBoolean(sal_Int32 parameter, sal_Bool x) throw(SQLException, RuntimeException);
+
+ void SAL_CALL setByte(sal_Int32 parameter, sal_Int8 x) throw(SQLException, RuntimeException);
+
+ void SAL_CALL setShort(sal_Int32 parameter, sal_Int16 x) throw(SQLException, RuntimeException);
+
+ void SAL_CALL setInt(sal_Int32 parameter, sal_Int32 x) throw(SQLException, RuntimeException);
+
+ void SAL_CALL setLong(sal_Int32 parameter, sal_Int64 x) throw(SQLException, RuntimeException);
+
+ void SAL_CALL setFloat(sal_Int32 parameter, float x) throw(SQLException, RuntimeException);
+
+ void SAL_CALL setDouble(sal_Int32 parameter, double x) throw(SQLException, RuntimeException);
+
+ void SAL_CALL setString(sal_Int32 parameter, const OUString& x) throw(SQLException, RuntimeException);
+
+ void SAL_CALL setBytes(sal_Int32 parameter, const ::com::sun::star::uno::Sequence< sal_Int8 >& x)
+ throw(SQLException, RuntimeException);
+
+ void SAL_CALL setDate(sal_Int32 parameter, const ::com::sun::star::util::Date& x)
+ throw(SQLException, RuntimeException);
+
+ void SAL_CALL setTime(sal_Int32 parameter, const ::com::sun::star::util::Time& x)
+ throw(SQLException, RuntimeException);
+ void SAL_CALL setTimestamp(sal_Int32 parameter, const ::com::sun::star::util::DateTime& x)
+ throw(SQLException, RuntimeException);
+
+ void SAL_CALL setBinaryStream(sal_Int32 parameter, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length)
+ throw(SQLException, RuntimeException);
+
+ void SAL_CALL setCharacterStream(sal_Int32 parameter, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length)
+ throw(SQLException, RuntimeException);
+
+ void SAL_CALL setObject(sal_Int32 parameter, const Any& x) throw(SQLException, RuntimeException);
+
+ void SAL_CALL setObjectWithInfo(sal_Int32 parameter, const Any& x, sal_Int32 targetSqlType, sal_Int32 scale)
+ throw(SQLException, RuntimeException);
+
+ void SAL_CALL setRef(sal_Int32 parameter, const Reference< ::com::sun::star::sdbc::XRef >& x)
+ throw(SQLException, RuntimeException);
+
+ void SAL_CALL setBlob(sal_Int32 parameter, const Reference< ::com::sun::star::sdbc::XBlob >& x)
+ throw(SQLException, RuntimeException);
+
+ void SAL_CALL setClob(sal_Int32 parameter, const Reference< ::com::sun::star::sdbc::XClob >& x)
+ throw(SQLException, RuntimeException);
+
+ void SAL_CALL setArray(sal_Int32 parameter, const Reference< ::com::sun::star::sdbc::XArray >& x)
+ throw(SQLException, RuntimeException);
+
+ void SAL_CALL clearParameters() throw(SQLException, RuntimeException);
+
+ // XPreparedBatchExecution
+ void SAL_CALL addBatch() throw(SQLException, RuntimeException);
+ void SAL_CALL clearBatch() throw(SQLException, RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL executeBatch() throw(SQLException, RuntimeException);
+
+ // XCloseable
+ void SAL_CALL close() throw(SQLException, RuntimeException);
+
+ // XResultSetMetaDataSupplier
+ Reference< ::com::sun::star::sdbc::XResultSetMetaData > SAL_CALL getMetaData()
+ throw(SQLException, RuntimeException);
+ };
+ } /* mysqlc */
+} /* connectivity */
+#endif // CONNECTIVITY_SPREPAREDSTATEMENT_HXX
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
+
diff --git a/mysqlc/source/mysqlc_propertyids.cxx b/mysqlc/source/mysqlc_propertyids.cxx
new file mode 100644
index 000000000000..ae0be046ffb6
--- /dev/null
+++ b/mysqlc/source/mysqlc_propertyids.cxx
@@ -0,0 +1,210 @@
+/*************************************************************************
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2008 by Sun Microsystems, Inc.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* $RCSfile: mysqlc_propertyids.cxx,v $
+*
+* $Revision: 1.1.2.2 $
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+************************************************************************/
+
+#ifndef _OSL_DIAGNOSE_H_
+#include <osl/diagnose.h>
+#endif
+#include "mysqlc_propertyids.hxx"
+
+using ::rtl::OUString;
+
+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() { return "Description"; }
+const sal_Char* getPROPERTY_DEFAULTVALUE() { return "DefaultValue"; }
+
+const sal_Char* getPROPERTY_REFERENCEDTABLE() { return "ReferencedTable"; }
+const sal_Char* getPROPERTY_UPDATERULE() { return "UpdateRule"; }
+const sal_Char* getPROPERTY_DELETERULE() { return "DeleteRule"; }
+const sal_Char* getPROPERTY_CATALOG() { return "Catalog"; }
+const sal_Char* getPROPERTY_ISUNIQUE() { return "IsUnique"; }
+const sal_Char* getPROPERTY_ISPRIMARYKEYINDEX() { return "IsPrimaryKeyIndex"; }
+const sal_Char* getPROPERTY_ISCLUSTERED() { return "IsClustered"; }
+const sal_Char* getPROPERTY_ISASCENDING() { return "IsAscending"; }
+const sal_Char* getPROPERTY_SCHEMANAME() { return "SchemaName"; }
+const sal_Char* getPROPERTY_CATALOGNAME() { return "CatalogName"; }
+const sal_Char* getPROPERTY_COMMAND() { return "Command"; }
+const sal_Char* getPROPERTY_CHECKOPTION() { return "CheckOption"; }
+const sal_Char* getPROPERTY_PASSWORD() { return "Password"; }
+const sal_Char* getPROPERTY_RELATEDCOLUMN() { return "RelatedColumn"; }
+
+const sal_Char* getSTAT_INVALID_INDEX() { return "Invalid descriptor index"; }
+
+const sal_Char* getPROPERTY_FUNCTION() { return "Function"; }
+const sal_Char* getPROPERTY_TABLENAME() { return "TableName"; }
+const sal_Char* getPROPERTY_REALNAME() { return "RealName"; }
+const sal_Char* getPROPERTY_DBASEPRECISIONCHANGED() { return "DbasePrecisionChanged"; }
+const sal_Char* getPROPERTY_ISCURRENCY() { return "IsCurrency"; }
+const sal_Char* getPROPERTY_ISBOOKMARKABLE() { return "IsBookmarkable"; }
+
+const sal_Char* getPROPERTY_FORMATKEY() { return "FormatKey"; }
+const sal_Char* getPROPERTY_LOCALE() { return "Locale"; }
+
+const sal_Char* getPROPERTY_AUTOINCREMENTCREATION() { return "AutoIncrementCreation"; }
+const sal_Char* getPROPERTY_PRIVILEGES() { return "Privileges"; }
+ //============================================================
+ //= error messages
+ //============================================================
+const sal_Char* getERRORMSG_SEQUENCE() { return "Function sequence error"; }
+const sal_Char* getSQLSTATE_SEQUENCE() { return "HY010"; }
+const sal_Char* getSQLSTATE_GENERAL() { return "HY0000"; }
+const sal_Char* getSTR_DELIMITER() { return "/"; }
+
+
+
+/* {{{ OPropertyMap::~OPropertyMap() -I- */
+OPropertyMap::~OPropertyMap()
+{
+ ::std::map<sal_Int32 , rtl_uString*>::iterator aIter = m_aPropertyMap.begin();
+ for(; aIter != m_aPropertyMap.end(); ++aIter) {
+ if (aIter->second) {
+ rtl_uString_release(aIter->second);
+ }
+ }
+}
+/* }}} */
+
+
+/* {{{ OPropertyMap::getNameByIndex() -I- */
+OUString OPropertyMap::getNameByIndex(sal_Int32 idx) const
+{
+ OUString sRet;
+ ::std::map<sal_Int32 , rtl_uString*>::const_iterator aIter = m_aPropertyMap.find(idx);
+ if (aIter == m_aPropertyMap.end()) {
+ sRet = const_cast<OPropertyMap*>(this)->fillValue(idx);
+ } else {
+ sRet = aIter->second;
+ }
+ return sRet;
+}
+/* }}} */
+
+typedef const sal_Char * (*property_callback)();
+
+static const property_callback property_callbacks[PROPERTY_ID_LAST] =
+{
+ NULL, /* PROPERTY_ID_FIRST */
+ getPROPERTY_QUERYTIMEOUT,
+ getPROPERTY_MAXFIELDSIZE,
+ getPROPERTY_MAXROWS,
+ getPROPERTY_CURSORNAME,
+ getPROPERTY_RESULTSETCONCURRENCY,
+ getPROPERTY_RESULTSETTYPE,
+ getPROPERTY_FETCHDIRECTION,
+ getPROPERTY_FETCHSIZE,
+ getPROPERTY_ESCAPEPROCESSING,
+ getPROPERTY_USEBOOKMARKS,
+ // Column
+ getPROPERTY_NAME,
+ getPROPERTY_TYPE,
+ getPROPERTY_TYPENAME,
+ getPROPERTY_PRECISION,
+ getPROPERTY_SCALE,
+ getPROPERTY_ISNULLABLE,
+ getPROPERTY_ISAUTOINCREMENT,
+ getPROPERTY_ISROWVERSION,
+ getPROPERTY_DESCRIPTION,
+ getPROPERTY_DEFAULTVALUE,
+
+ getPROPERTY_REFERENCEDTABLE,
+ getPROPERTY_UPDATERULE,
+ getPROPERTY_DELETERULE,
+ getPROPERTY_CATALOG,
+ getPROPERTY_ISUNIQUE,
+ getPROPERTY_ISPRIMARYKEYINDEX,
+ getPROPERTY_ISCLUSTERED,
+ getPROPERTY_ISASCENDING,
+ getPROPERTY_SCHEMANAME,
+ getPROPERTY_CATALOGNAME,
+
+ getPROPERTY_COMMAND,
+ getPROPERTY_CHECKOPTION,
+ getPROPERTY_PASSWORD,
+ getPROPERTY_RELATEDCOLUMN,
+
+ getPROPERTY_FUNCTION,
+ getPROPERTY_TABLENAME,
+ getPROPERTY_REALNAME,
+ getPROPERTY_DBASEPRECISIONCHANGED,
+ getPROPERTY_ISCURRENCY,
+ getPROPERTY_ISBOOKMARKABLE,
+ getSTAT_INVALID_INDEX,
+ getERRORMSG_SEQUENCE,
+ getSQLSTATE_SEQUENCE,
+ getSQLSTATE_GENERAL,
+ getSTR_DELIMITER,
+ getPROPERTY_FORMATKEY,
+ getPROPERTY_LOCALE,
+ getPROPERTY_AUTOINCREMENTCREATION,
+ getPROPERTY_PRIVILEGES,
+};
+
+
+/* {{{ OPropertyMap::fillValue() -I- */
+OUString OPropertyMap::fillValue(sal_Int32 idx)
+{
+ rtl_uString* pStr = NULL;
+ rtl_uString_newFromAscii(&pStr, property_callbacks[idx]());
+ m_aPropertyMap[idx] = pStr;
+ return pStr;
+}
+/* }}} */
+
+} /* mysqlc */
+} /* connectivity */
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
diff --git a/mysqlc/source/mysqlc_propertyids.hxx b/mysqlc/source/mysqlc_propertyids.hxx
new file mode 100644
index 000000000000..31e756685c04
--- /dev/null
+++ b/mysqlc/source/mysqlc_propertyids.hxx
@@ -0,0 +1,136 @@
+
+#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_
+#define _CONNECTIVITY_PROPERTYIDS_HXX_
+
+// this define has to be set to split the names into different dll's or so's
+// every dll has his own set of property names
+#ifndef _RTL_USTRING_
+#include <rtl/ustring.hxx>
+#endif
+#ifndef _MAP_
+#include <map>
+#endif
+
+namespace connectivity
+{
+namespace mysqlc
+{
+ class OPropertyMap
+ {
+ ::std::map<sal_Int32 , rtl_uString*> m_aPropertyMap;
+
+ ::rtl::OUString fillValue(sal_Int32 _nIndex);
+ public:
+ OPropertyMap()
+ {
+ }
+ ~OPropertyMap();
+ ::rtl::OUString getNameByIndex(sal_Int32 _nIndex) const;
+
+ static OPropertyMap& getPropMap()
+ {
+ static OPropertyMap s_aPropMap;
+ return s_aPropMap;
+ }
+ };
+
+
+ typedef const sal_Char* (*PVFN)();
+
+ struct UStringDescription
+ {
+ const sal_Char* pZeroTerminatedName;
+ sal_Int32 nLength;
+
+ UStringDescription(PVFN _fCharFkt);
+ operator ::rtl::OUString() const { return ::rtl::OUString(pZeroTerminatedName,nLength,RTL_TEXTENCODING_ASCII_US); }
+ ~UStringDescription();
+ private:
+ UStringDescription();
+ };
+
+
+enum
+{
+ PROPERTY_ID_FIRST = 0,
+ PROPERTY_ID_QUERYTIMEOUT,
+ PROPERTY_ID_MAXFIELDSIZE,
+ PROPERTY_ID_MAXROWS,
+ PROPERTY_ID_CURSORNAME,
+ PROPERTY_ID_RESULTSETCONCURRENCY,
+ PROPERTY_ID_RESULTSETTYPE,
+ PROPERTY_ID_FETCHDIRECTION,
+ PROPERTY_ID_FETCHSIZE,
+ PROPERTY_ID_ESCAPEPROCESSING,
+ PROPERTY_ID_USEBOOKMARKS,
+// Column
+ PROPERTY_ID_NAME,
+ PROPERTY_ID_TYPE,
+ PROPERTY_ID_TYPENAME,
+ PROPERTY_ID_PRECISION,
+ PROPERTY_ID_SCALE,
+ PROPERTY_ID_ISNULLABLE,
+ PROPERTY_ID_ISAUTOINCREMENT,
+ PROPERTY_ID_ISROWVERSION,
+ PROPERTY_ID_DESCRIPTION,
+ PROPERTY_ID_DEFAULTVALUE,
+
+ PROPERTY_ID_REFERENCEDTABLE,
+ PROPERTY_ID_UPDATERULE,
+ PROPERTY_ID_DELETERULE,
+ PROPERTY_ID_CATALOG,
+ PROPERTY_ID_ISUNIQUE,
+ PROPERTY_ID_ISPRIMARYKEYINDEX,
+ PROPERTY_ID_ISCLUSTERED,
+ PROPERTY_ID_ISASCENDING,
+ PROPERTY_ID_SCHEMANAME,
+ PROPERTY_ID_CATALOGNAME,
+
+ PROPERTY_ID_COMMAND,
+ PROPERTY_ID_CHECKOPTION,
+ PROPERTY_ID_PASSWORD,
+ PROPERTY_ID_RELATEDCOLUMN,
+
+ PROPERTY_ID_FUNCTION,
+ PROPERTY_ID_TABLENAME,
+ PROPERTY_ID_REALNAME,
+ PROPERTY_ID_DBASEPRECISIONCHANGED,
+ PROPERTY_ID_ISCURRENCY,
+ PROPERTY_ID_ISBOOKMARKABLE,
+
+ PROPERTY_ID_INVALID_INDEX,
+ PROPERTY_ID_ERRORMSG_SEQUENCE,
+ PROPERTY_ID_HY010,
+ PROPERTY_ID_HY0000,
+ PROPERTY_ID_DELIMITER,
+ PROPERTY_ID_FORMATKEY,
+ PROPERTY_ID_LOCALE,
+ PROPERTY_ID_IM001,
+
+ PROPERTY_ID_AUTOINCREMENTCREATION,
+
+ PROPERTY_ID_PRIVILEGES,
+
+ PROPERTY_ID_LAST
+};
+}/* mysqlc */
+}/* connectivity */
+
+//------------------------------------------------------------------------------
+#define DECL_PROP1IMPL(varname, type) \
+pProperties[nPos++] = Property(OPropertyMap::getPropMap().getNameByIndex(PROPERTY_ID_##varname), PROPERTY_ID_##varname, ::getCppuType(reinterpret_cast< type*>(NULL)),
+//------------------------------------------------------------------------------
+#define DECL_PROP0(varname, type) \
+ DECL_PROP1IMPL(varname, type) 0)
+//------------------------------------------------------------------------------
+#define DECL_BOOL_PROP1IMPL(varname) \
+ pProperties[nPos++] = Property(OPropertyMap::getPropMap().getNameByIndex(PROPERTY_ID_##varname), PROPERTY_ID_##varname, ::getBooleanCppuType(),
+//------------------------------------------------------------------------------
+#define DECL_BOOL_PROP0(varname) \
+ DECL_BOOL_PROP1IMPL(varname) 0)
+
+
+
+#endif // _CONNECTIVITY_PROPERTYIDS_HXX_
+
+
diff --git a/mysqlc/source/mysqlc_resultset.cxx b/mysqlc/source/mysqlc_resultset.cxx
new file mode 100644
index 000000000000..f6b6861b6a74
--- /dev/null
+++ b/mysqlc/source/mysqlc_resultset.cxx
@@ -0,0 +1,1509 @@
+/*************************************************************************
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2008 by Sun Microsystems, Inc.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* $RCSfile: mysqlc_resultset.cxx,v $
+*
+* $Revision: 1.1.2.5 $
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+************************************************************************/
+
+#include "mysqlc_propertyids.hxx"
+#include "mysqlc_general.hxx"
+#include "mysqlc_resultset.hxx"
+#include "mysqlc_resultsetmetadata.hxx"
+
+#include <com/sun/star/sdbc/DataType.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/sdbcx/CompareBookmark.hpp>
+#include <cppuhelper/typeprovider.hxx>
+#include <com/sun/star/lang/DisposedException.hpp>
+
+using namespace connectivity::mysqlc;
+using namespace cppu;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::beans;
+using namespace com::sun::star::sdbc;
+using namespace com::sun::star::sdbcx;
+using namespace com::sun::star::container;
+using namespace com::sun::star::io;
+using namespace com::sun::star::util;
+using ::osl::MutexGuard;
+using ::rtl::OUString;
+
+#include <cppconn/resultset.h>
+#include <cppconn/resultset_metadata.h>
+
+#include <stdio.h>
+
+
+// IMPLEMENT_SERVICE_INFO(OResultSet,"com.sun.star.sdbcx.OResultSet","com.sun.star.sdbc.ResultSet");
+/* {{{ OResultSet::getImplementationName() -I- */
+OUString SAL_CALL OResultSet::getImplementationName()
+ throw (RuntimeException)
+{
+ OSL_TRACE("OResultSet::getImplementationName");
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdbcx.mysqlc.ResultSet" ) );
+}
+/* }}} */
+
+
+/* {{{ OResultSet::getSupportedServiceNames() -I- */
+Sequence< OUString > SAL_CALL OResultSet::getSupportedServiceNames()
+ throw(RuntimeException)
+{
+ OSL_TRACE("OResultSet::getSupportedServiceNames");
+ Sequence< OUString > aSupported(2);
+ aSupported[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdbc.ResultSet" ) );
+ aSupported[1] = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdbcx.ResultSet" ) );
+ return (aSupported);
+}
+/* }}} */
+
+
+/* {{{ OResultSet::supportsService() -I- */
+sal_Bool SAL_CALL OResultSet::supportsService(const OUString& _rServiceName)
+ throw(RuntimeException)
+{
+ OSL_TRACE("OResultSet::supportsService");
+ Sequence< OUString > aSupported(getSupportedServiceNames());
+ const OUString* pSupported = aSupported.getConstArray();
+ const OUString* pEnd = pSupported + aSupported.getLength();
+ for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported) {}
+
+ return (pSupported != pEnd);
+}
+/* }}} */
+
+
+/* {{{ OResultSet::OResultSet() -I- */
+OResultSet::OResultSet(OCommonStatement * pStmt, sql::ResultSet * result, rtl_TextEncoding _encoding )
+ : OResultSet_BASE(m_aMutex)
+ ,OPropertySetHelper(OResultSet_BASE::rBHelper)
+ ,m_aStatement((OWeakObject*)pStmt)
+ ,m_xMetaData(NULL)
+ ,m_result(result)
+ ,fieldCount( 0 )
+ ,m_encoding( _encoding )
+{
+ OSL_TRACE("OResultSet::OResultSet");
+ try {
+ sql::ResultSetMetaData * rs_meta = m_result->getMetaData();
+ fieldCount = rs_meta->getColumnCount();
+ } catch (sql::SQLException &e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding);
+ }
+}
+/* }}} */
+
+
+/* {{{ OResultSet::~OResultSet() -I- */
+OResultSet::~OResultSet()
+{
+ OSL_TRACE("OResultSet::~OResultSet");
+}
+/* }}} */
+
+
+/* {{{ OResultSet::disposing() -I- */
+void OResultSet::disposing()
+{
+ OSL_TRACE("OResultSet::disposing");
+ OPropertySetHelper::disposing();
+
+ MutexGuard aGuard(m_aMutex);
+
+ m_aStatement = NULL;
+ m_xMetaData = NULL;
+}
+/* }}} */
+
+
+/* {{{ OResultSet::queryInterface() -I- */
+Any SAL_CALL OResultSet::queryInterface(const Type & rType)
+ throw(RuntimeException)
+{
+ OSL_TRACE("OResultSet::queryInterface");
+ Any aRet = OPropertySetHelper::queryInterface(rType);
+ if (!aRet.hasValue()) {
+ aRet = OResultSet_BASE::queryInterface(rType);
+ }
+ return aRet;
+}
+/* }}} */
+
+
+/* {{{ OResultSet::getTypes() -I- */
+Sequence< Type > SAL_CALL OResultSet::getTypes()
+ throw(RuntimeException)
+{
+ OSL_TRACE("OResultSet::getTypes");
+ OTypeCollection aTypes( ::getCppuType((const Reference< XMultiPropertySet > *) NULL),
+ ::getCppuType((const Reference< XFastPropertySet > *) NULL),
+ ::getCppuType((const Reference< XPropertySet > *) NULL));
+
+ return concatSequences(aTypes.getTypes(), OResultSet_BASE::getTypes());
+}
+/* }}} */
+
+
+/* {{{ OResultSet::findColumn() -I- */
+sal_Int32 SAL_CALL OResultSet::findColumn(const OUString& columnName)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSet::findColumn");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+ try {
+ // find the first column with the name columnName
+ sql::ResultSetMetaData * meta = m_result->getMetaData();
+ for (sal_uInt32 i = 1; i <= fieldCount; i++) {
+ if (columnName.equalsIgnoreAsciiCaseAscii(meta->getColumnName(i).c_str())) {
+ /* SDBC knows them indexed from 1 */
+ return i;
+ }
+ }
+ } catch (sql::SQLException &e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding);
+ }
+ return 0;
+}
+/* }}} */
+
+
+/* {{{ OResultSet::getBinaryStream() -U- */
+Reference< XInputStream > SAL_CALL OResultSet::getBinaryStream(sal_Int32 column)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSet::getBinaryStream");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+ checkColumnIndex(column);
+
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OResultSet::getBinaryStream", *this);
+ return NULL;
+}
+/* }}} */
+
+
+/* {{{ OResultSet::getCharacterStream() -U- */
+Reference< XInputStream > SAL_CALL OResultSet::getCharacterStream(sal_Int32 column)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSet::getCharacterStream");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+ checkColumnIndex(column);
+
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OResultSet::getCharacterStream", *this);
+ return NULL;
+}
+/* }}} */
+
+
+/* {{{ OResultSet::getBoolean() -I- */
+sal_Bool SAL_CALL OResultSet::getBoolean(sal_Int32 column)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSet::getBoolean");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+ checkColumnIndex(column);
+ try {
+ return m_result->getBoolean(column)? sal_True:sal_False;
+ } catch (sql::SQLException &e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding);
+ }
+ return sal_False;
+#if 0
+ OUString str = getString(column);
+ switch (str[0]) {
+ case '1':
+ case 't':
+ case 'T':
+ case 'y':
+ case 'Y':
+ return sal_True;
+ }
+ return sal_False;
+#endif
+}
+/* }}} */
+
+
+/* {{{ OResultSet::getByte() -I- */
+sal_Int8 SAL_CALL OResultSet::getByte(sal_Int32 column)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSet::getByte");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+ checkColumnIndex(column);
+ try {
+ return m_result->getInt(column);
+ } catch (sql::SQLException &e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding);
+ }
+ return 0; // fool compiler
+}
+/* }}} */
+
+
+/* {{{ OResultSet::getBytes() -I- */
+Sequence< sal_Int8 > SAL_CALL OResultSet::getBytes(sal_Int32 column)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSet::getBytes");
+
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+ MutexGuard aGuard(m_aMutex);
+
+
+ sql::SQLString val = m_result->getString(column);
+ if (!val.length()) {
+ return Sequence< sal_Int8>();
+ } else {
+ return Sequence< sal_Int8 > ((sal_Int8*)val.c_str(), val.length());
+ }
+}
+/* }}} */
+
+
+/* {{{ OResultSet::getDate() -I- */
+Date SAL_CALL OResultSet::getDate(sal_Int32 column)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSet::getDate");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+ checkColumnIndex(column);
+
+ Date d;
+ try {
+ OUString dateString = getString(column);
+ OUString token;
+ sal_Int32 nIndex = 0, i=0;
+
+ do {
+ token = dateString.getToken (0, '-', nIndex);
+ switch (i) {
+ case 0:
+ d.Year = static_cast<sal_uInt16>(token.toInt32(10));
+ break;
+ case 1:
+ d.Month = static_cast<sal_uInt16>(token.toInt32(10));
+ break;
+ case 2:
+ d.Day = static_cast<sal_uInt16>(token.toInt32(10));
+ break;
+ default:;
+ }
+ i++;
+ } while (nIndex >= 0);
+ } catch (sql::SQLException &e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding);
+ }
+ return d;
+}
+/* }}} */
+
+
+/* {{{ OResultSet::getDouble() -I- */
+double SAL_CALL OResultSet::getDouble(sal_Int32 column)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSet::getDouble");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+ checkColumnIndex(column);
+ try {
+ return m_result->getDouble(column);
+ } catch (sql::SQLException &e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding);
+ }
+ return 0.0; // fool compiler
+}
+/* }}} */
+
+
+/* {{{ OResultSet::getFloat() -I- */
+float SAL_CALL OResultSet::getFloat(sal_Int32 column)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSet::getFloat");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+ checkColumnIndex(column);
+ try {
+ return m_result->getDouble(column);
+ } catch (sql::SQLException &e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding);
+ }
+ return 0.0; // fool compiler
+}
+/* }}} */
+
+
+/* {{{ OResultSet::getInt() -I- */
+sal_Int32 SAL_CALL OResultSet::getInt(sal_Int32 column)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSet::getInt");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+ checkColumnIndex(column);
+ try {
+ return m_result->getInt(column);
+ } catch (sql::SQLException &e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding);
+ }
+ return 0; // fool compiler
+}
+/* }}} */
+
+
+/* {{{ OResultSet::getRow() -I- */
+sal_Int32 SAL_CALL OResultSet::getRow()
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSet::getRow");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+ try {
+ return m_result->getRow();
+ } catch (sql::SQLException &e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding);
+ }
+ return 0; // fool compiler
+}
+/* }}} */
+
+
+/* {{{ OResultSet::getLong() -I- */
+sal_Int64 SAL_CALL OResultSet::getLong(sal_Int32 column)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSet::getLong");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+ checkColumnIndex(column);
+ try {
+ return m_result->getInt64(column);
+ } catch (sql::SQLException &e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding);
+ }
+ return 0; // fool compiler
+}
+/* }}} */
+
+
+/* {{{ OResultSet::getMetaData() -I- */
+Reference< XResultSetMetaData > SAL_CALL OResultSet::getMetaData()
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSet::getMetaData");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+ try {
+ if (!m_xMetaData.is()) {
+ m_xMetaData = new OResultSetMetaData(m_result->getMetaData(), m_encoding);
+ }
+ } catch (sql::MethodNotImplementedException) {
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OResultSet::getMetaData", *this);
+ } catch (sql::SQLException &e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding);
+ }
+ return m_xMetaData;
+}
+/* }}} */
+
+
+/* {{{ OResultSet::getArray() -U- */
+Reference< XArray > SAL_CALL OResultSet::getArray(sal_Int32 column)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSet::getArray");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+ checkColumnIndex(column);
+
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OResultSet::getArray", *this);
+ return NULL;
+}
+/* }}} */
+
+
+/* {{{ OResultSet::getClob() -U- */
+Reference< XClob > SAL_CALL OResultSet::getClob(sal_Int32 column)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSet::getClob");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+ checkColumnIndex(column);
+
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OResultSet::getClob", *this);
+ return NULL;
+}
+/* }}} */
+
+
+/* {{{ OResultSet::getBlob() -U- */
+Reference< XBlob > SAL_CALL OResultSet::getBlob(sal_Int32 column)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSet::getBlob");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+ checkColumnIndex(column);
+
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OResultSet::getBlob", *this);
+ return NULL;
+}
+/* }}} */
+
+
+/* {{{ OResultSet::getRef() -U- */
+Reference< XRef > SAL_CALL OResultSet::getRef(sal_Int32 column)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSet::getRef");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+ checkColumnIndex(column);
+
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OResultSet::getRef", *this);
+ return NULL;
+}
+/* }}} */
+
+
+/* {{{ OResultSet::getObject() -U- */
+Any SAL_CALL OResultSet::getObject(sal_Int32 column, const Reference< XNameAccess >& /* typeMap */)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSet::getObject");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+ checkColumnIndex(column);
+
+ Any aRet= Any();
+
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OResultSet::getObject", *this);
+ return aRet;
+}
+/* }}} */
+
+
+/* {{{ OResultSet::getShort() -I- */
+sal_Int16 SAL_CALL OResultSet::getShort(sal_Int32 column)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSet::getShort");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+ try {
+ return (sal_Int16) m_result->getInt(column);
+ } catch (sql::SQLException &e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding);
+ }
+ return 0; // fool compiler
+}
+/* }}} */
+
+
+/* {{{ OResultSet::getString() -I- */
+OUString SAL_CALL OResultSet::getString(sal_Int32 column)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSet::getString");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+ checkColumnIndex(column);
+
+ try {
+ sql::SQLString val = m_result->getString(column);
+ if (!m_result->wasNull()) {
+ return OUString( val.c_str(), val.length(), m_encoding );
+ } else {
+ return OUString();
+ }
+ } catch (sql::SQLException &e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding);
+ }
+ return OUString(); // fool compiler
+}
+/* }}} */
+
+
+/* {{{ OResultSet::getTime() -I- */
+Time SAL_CALL OResultSet::getTime(sal_Int32 column)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSet::getTime");
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+ MutexGuard aGuard(m_aMutex);
+
+ checkColumnIndex(column);
+ Time t;
+ OUString timeString = getString(column);
+ OUString token;
+ sal_Int32 nIndex, i=0;
+
+ nIndex = timeString.indexOf(' ') + 1;
+
+ do {
+ token = timeString.getToken (0, ':', nIndex);
+ switch (i) {
+ case 0:
+ t.Hours = static_cast<sal_uInt16>(token.toInt32(10));
+ break;
+ case 1:
+ t.Minutes = static_cast<sal_uInt16>(token.toInt32(10));
+ break;
+ case 2:
+ t.Seconds = static_cast<sal_uInt16>(token.toInt32(10));
+ break;
+ }
+ i++;
+ } while (nIndex >= 0);
+
+ return t;
+}
+/* }}} */
+
+
+/* {{{ OResultSet::getTimestamp() -I- */
+DateTime SAL_CALL OResultSet::getTimestamp(sal_Int32 column)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSet::getTimestamp");
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+ MutexGuard aGuard(m_aMutex);
+
+ checkColumnIndex(column);
+ DateTime dt;
+ Date d = getDate(column);
+ Time t = getTime(column);
+
+ dt.Year = d.Year;
+ dt.Month = d.Month;
+ dt.Day = d.Day;
+ dt.Hours = t.Hours;
+ dt.Minutes = t.Minutes;
+ dt.Seconds = t.Seconds;
+ return dt;
+}
+/* }}} */
+
+
+/* {{{ OResultSet::isBeforeFirst() -I- */
+sal_Bool SAL_CALL OResultSet::isBeforeFirst()
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSet::isBeforeFirst");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+ try {
+ return m_result->isBeforeFirst()? sal_True:sal_False;
+ } catch (sql::SQLException &e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding);
+ }
+ return sal_False; //fool
+}
+/* }}} */
+
+
+/* {{{ OResultSet::isAfterLast() -I- */
+sal_Bool SAL_CALL OResultSet::isAfterLast()
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSet::isAfterLast");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+ try {
+ return m_result->isAfterLast()? sal_True:sal_False;
+ } catch (sql::SQLException &e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding);
+ }
+ return sal_False; //fool
+}
+/* }}} */
+
+
+/* {{{ OResultSet::isFirst() -I- */
+sal_Bool SAL_CALL OResultSet::isFirst()
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSet::isFirst");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+ try {
+ return m_result->isFirst();
+ } catch (sql::SQLException &e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding);
+ }
+ return sal_False; //fool
+}
+/* }}} */
+
+
+/* {{{ OResultSet::isLast() -I- */
+sal_Bool SAL_CALL OResultSet::isLast()
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSet::isLast");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+ try {
+ return m_result->isLast()? sal_True:sal_False;
+ } catch (sql::SQLException &e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding);
+ }
+ return sal_False; //fool
+}
+/* }}} */
+
+
+/* {{{ OResultSet::beforeFirst() -I- */
+void SAL_CALL OResultSet::beforeFirst()
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSet::beforeFirst");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+ try {
+ m_result->beforeFirst();
+ } catch (sql::SQLException &e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding);
+ }
+}
+/* }}} */
+
+
+/* {{{ OResultSet::afterLast() -I- */
+void SAL_CALL OResultSet::afterLast()
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSet::afterLast");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+ try {
+ m_result->afterLast();
+ } catch (sql::SQLException &e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding);
+ }
+}
+/* }}} */
+
+
+/* {{{ OResultSet::close() -I- */
+void SAL_CALL OResultSet::close() throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSet::close");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+ try {
+ m_result->close();
+ } catch (sql::SQLException &e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding);
+ }
+
+ dispose();
+}
+/* }}} */
+
+
+/* {{{ OResultSet::first() -I- */
+sal_Bool SAL_CALL OResultSet::first() throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSet::first");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+ try {
+ return m_result->first()? sal_True:sal_False;
+ } catch (sql::SQLException &e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding);
+ }
+ return sal_False; //fool
+}
+/* }}} */
+
+
+/* {{{ OResultSet::last() -I- */
+sal_Bool SAL_CALL OResultSet::last()
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSet::last");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+ try {
+ return m_result->last()? sal_True:sal_False;
+ } catch (sql::SQLException &e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding);
+ }
+ return sal_False; //fool
+}
+/* }}} */
+
+
+/* {{{ OResultSet::absolute() -I- */
+sal_Bool SAL_CALL OResultSet::absolute(sal_Int32 row)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSet::absolute");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+ try {
+ return m_result->absolute(row)? sal_True:sal_False;
+ } catch (sql::SQLException &e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding);
+ }
+ return sal_False; //fool
+}
+/* }}} */
+
+
+/* {{{ OResultSet::relative() -I- */
+sal_Bool SAL_CALL OResultSet::relative(sal_Int32 row)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSet::relative");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+ try {
+ return m_result->relative(row)? sal_True:sal_False;
+ } catch (sql::SQLException &e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding);
+ }
+ return sal_False; //fool
+}
+/* }}} */
+
+
+/* {{{ OResultSet::previous() -I- */
+sal_Bool SAL_CALL OResultSet::previous()
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSet::previous");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+ try {
+ return m_result->previous()? sal_True:sal_False;
+ } catch (sql::SQLException &e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding);
+ }
+ return sal_False; //fool
+}
+/* }}} */
+
+
+/* {{{ OResultSet::getStatement() -I- */
+Reference< XInterface > SAL_CALL OResultSet::getStatement()
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSet::getStatement");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+ return m_aStatement.get();
+}
+/* }}} */
+
+
+/* {{{ OResultSet::rowDeleted() -I- */
+sal_Bool SAL_CALL OResultSet::rowDeleted()
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSet::rowDeleted");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+ return sal_False;
+}
+/* }}} */
+
+
+/* {{{ OResultSet::rowInserted() -I- */
+sal_Bool SAL_CALL OResultSet::rowInserted()
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSet::rowInserted");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+ return sal_False;
+}
+/* }}} */
+
+
+/* {{{ OResultSet::rowUpdated() -I- */
+sal_Bool SAL_CALL OResultSet::rowUpdated()
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSet::rowUpdated");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+ return sal_False;
+}
+/* }}} */
+
+
+/* {{{ OResultSet::next() -I- */
+sal_Bool SAL_CALL OResultSet::next()
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSet::next");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+ try {
+ return m_result->next()? sal_True:sal_False;
+ } catch (sql::SQLException &e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding);
+ }
+ return sal_False; //fool
+}
+/* }}} */
+
+
+/* {{{ OResultSet::wasNull() -I- */
+sal_Bool SAL_CALL OResultSet::wasNull()
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSet::wasNull");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+ try {
+ return m_result->wasNull()? sal_True:sal_False;
+ } catch (sql::SQLException &e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding);
+ }
+ return sal_False; //fool
+}
+/* }}} */
+
+
+/* {{{ OResultSet::cancel() -I- */
+void SAL_CALL OResultSet::cancel()
+ throw(RuntimeException)
+{
+ OSL_TRACE("OResultSet::cancel");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+}
+/* }}} */
+
+
+/* {{{ OResultSet::clearWarnings() -I- */
+void SAL_CALL OResultSet::clearWarnings()
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSet::clearWarnings");
+}
+/* }}} */
+
+
+/* {{{ OResultSet::getWarnings() -I- */
+Any SAL_CALL OResultSet::getWarnings()
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSet::getWarnings");
+ Any aRet= Any();
+ return aRet;
+}
+/* }}} */
+
+
+/* {{{ OResultSet::insertRow() -I- */
+void SAL_CALL OResultSet::insertRow()
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSet::insertRow");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+ // you only have to implement this if you want to insert new rows
+}
+/* }}} */
+
+
+/* {{{ OResultSet::updateRow() -I- */
+void SAL_CALL OResultSet::updateRow()
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSet::updateRow");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+ // only when you allow updates
+}
+/* }}} */
+
+
+/* {{{ OResultSet::deleteRow() -I- */
+void SAL_CALL OResultSet::deleteRow()
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSet::deleteRow");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+}
+/* }}} */
+
+
+/* {{{ OResultSet::cancelRowUpdates() -I- */
+void SAL_CALL OResultSet::cancelRowUpdates()
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSet::cancelRowUpdates");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+}
+/* }}} */
+
+
+/* {{{ OResultSet::moveToInsertRow() -I- */
+void SAL_CALL OResultSet::moveToInsertRow()
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSet::moveToInsertRow");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+ // only when you allow insert's
+}
+/* }}} */
+
+
+/* {{{ OResultSet::moveToCurrentRow() -I- */
+void SAL_CALL OResultSet::moveToCurrentRow()
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSet::moveToCurrentRow");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+}
+/* }}} */
+
+
+/* {{{ OResultSet::updateNull() -U- */
+void SAL_CALL OResultSet::updateNull(sal_Int32 column)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSet::updateNull");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+ checkColumnIndex(column);
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OResultSet::updateNull", *this);
+}
+/* }}} */
+
+
+/* {{{ OResultSet::updateBoolean() -U- */
+void SAL_CALL OResultSet::updateBoolean(sal_Int32 column, sal_Bool /* x */)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSet::updateBoolean");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+ checkColumnIndex(column);
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OResultSet::updateBoolean", *this);
+}
+/* }}} */
+
+
+/* {{{ OResultSet::updateByte() -U- */
+void SAL_CALL OResultSet::updateByte(sal_Int32 column, sal_Int8 /* x */)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSet::updateByte");
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+ MutexGuard aGuard(m_aMutex);
+ checkColumnIndex(column);
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OResultSet::updateByte", *this);
+}
+/* }}} */
+
+
+/* {{{ OResultSet::updateShort() -U- */
+void SAL_CALL OResultSet::updateShort(sal_Int32 column, sal_Int16 /* x */)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSet::updateShort");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+ checkColumnIndex(column);
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OResultSet::updateShort", *this);
+}
+/* }}} */
+
+
+/* {{{ OResultSet::updateInt() -U- */
+void SAL_CALL OResultSet::updateInt(sal_Int32 column, sal_Int32 /* x */)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSet::updateInt");
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+ MutexGuard aGuard(m_aMutex);
+ checkColumnIndex(column);
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OResultSet::updateInt", *this);
+}
+/* }}} */
+
+
+/* {{{ OResultSet::updateLong() -U- */
+void SAL_CALL OResultSet::updateLong(sal_Int32 column, sal_Int64 /* x */)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSet::updateLong");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+ checkColumnIndex(column);
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OResultSet::updateLong", *this);
+}
+/* }}} */
+
+
+/* {{{ OResultSet::updateFloat() -U- */
+void SAL_CALL OResultSet::updateFloat(sal_Int32 column, float /* x */)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSet::updateFloat");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+ checkColumnIndex(column);
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OResultSet::updateFloat", *this);
+}
+/* }}} */
+
+
+/* {{{ OResultSet::updateDouble() -U- */
+void SAL_CALL OResultSet::updateDouble(sal_Int32 column, double /* x */)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSet::updateDouble");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+ checkColumnIndex(column);
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OResultSet::updateDouble", *this);
+}
+/* }}} */
+
+
+/* {{{ OResultSet::updateString() -U- */
+void SAL_CALL OResultSet::updateString(sal_Int32 column, const OUString& /* x */)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSet::updateString");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+ checkColumnIndex(column);
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OResultSet::updateString", *this);
+}
+/* }}} */
+
+
+/* {{{ OResultSet::updateBytes() -U- */
+void SAL_CALL OResultSet::updateBytes(sal_Int32 column, const Sequence< sal_Int8 >& /* x */)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSet::updateBytes");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+ checkColumnIndex(column);
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OResultSet::updateBytes", *this);
+}
+/* }}} */
+
+
+/* {{{ OResultSet::updateDate() -U- */
+void SAL_CALL OResultSet::updateDate(sal_Int32 column, const Date& /* x */)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSet::updateDate");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+ checkColumnIndex(column);
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OResultSet::updateDate", *this);
+}
+/* }}} */
+
+
+/* {{{ OResultSet::updateTime() -U- */
+void SAL_CALL OResultSet::updateTime(sal_Int32 column, const Time& /* x */)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSet::updateTime");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+ checkColumnIndex(column);
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OResultSet::updateTime", *this);
+}
+/* }}} */
+
+
+/* {{{ OResultSet::updateTimestamp() -U- */
+void SAL_CALL OResultSet::updateTimestamp(sal_Int32 column, const DateTime& /* x */)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSet::updateTimestamp");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+ checkColumnIndex(column);
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OResultSet::updateTimestamp", *this);
+}
+/* }}} */
+
+
+/* {{{ OResultSet::updateBinaryStream() -U- */
+void SAL_CALL OResultSet::updateBinaryStream(sal_Int32 column, const Reference< XInputStream >& /* x */,
+ sal_Int32 /* length */)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSet::updateBinaryStream");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+ checkColumnIndex(column);
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OResultSet::updateBinaryStream", *this);
+}
+/* }}} */
+
+
+/* {{{ OResultSet::updateCharacterStream() -U- */
+void SAL_CALL OResultSet::updateCharacterStream(sal_Int32 column, const Reference< XInputStream >& /* x */,
+ sal_Int32 /* length */)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSet::updateCharacterStream");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+ checkColumnIndex(column);
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OResultSet::updateCharacterStream", *this);
+}
+/* }}} */
+
+
+/* {{{ OResultSet::refreshRow() -U- */
+void SAL_CALL OResultSet::refreshRow()
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSet::refreshRow");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OResultSet::refreshRow", *this);
+}
+/* }}} */
+
+
+/* {{{ OResultSet::updateObject() -U- */
+void SAL_CALL OResultSet::updateObject(sal_Int32 column, const Any& /* x */)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSet::updateObject");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+ checkColumnIndex(column);
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OResultSet::updateObject", *this);
+}
+/* }}} */
+
+
+/* {{{ OResultSet::updateNumericObject() -U- */
+void SAL_CALL OResultSet::updateNumericObject(sal_Int32 column, const Any& /* x */, sal_Int32 /* scale */)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSet::updateNumericObject");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+ checkColumnIndex(column);
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OResultSet::updateNumericObject", *this);
+}
+/* }}} */
+
+
+// XRowLocate
+/* {{{ OResultSet::getBookmark() -U- */
+Any SAL_CALL OResultSet::getBookmark()
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSet::getBookmark");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+ Any aRet = Any();
+
+ // if you don't want to support bookmark you must remove the XRowLocate interface
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OResultSet::getBookmark", *this);
+
+ return aRet;
+}
+/* }}} */
+
+
+/* {{{ OResultSet::moveToBookmark() -U- */
+sal_Bool SAL_CALL OResultSet::moveToBookmark(const Any& /* bookmark */)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSet::moveToBookmark");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+ return sal_False;
+}
+/* }}} */
+
+
+/* {{{ OResultSet::moveRelativeToBookmark() -U- */
+sal_Bool SAL_CALL OResultSet::moveRelativeToBookmark(const Any& /* bookmark */, sal_Int32 /* rows */)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSet::moveRelativeToBookmark");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OResultSet::moveRelativeToBookmark", *this);
+ return sal_False;
+}
+/* }}} */
+
+
+/* {{{ OResultSet::compareBookmarks() -I- */
+sal_Int32 SAL_CALL OResultSet::compareBookmarks(const Any& /* n1 */, const Any& /* n2 */)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSet::compareBookmarks");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OResultSet::compareBookmarks", *this);
+
+ return CompareBookmark::NOT_EQUAL;
+}
+/* }}} */
+
+
+/* {{{ OResultSet::hasOrderedBookmarks() -I- */
+sal_Bool SAL_CALL OResultSet::hasOrderedBookmarks()
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSet::hasOrderedBookmarks");
+ return sal_False;
+}
+/* }}} */
+
+
+/* {{{ OResultSet::hashBookmark() -U- */
+sal_Int32 SAL_CALL OResultSet::hashBookmark(const Any& /* bookmark */)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSet::hashBookmark");
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OResultSet::hashBookmark", *this);
+ return 0;
+}
+/* }}} */
+
+
+// XDeleteRows
+/* {{{ OResultSet::deleteRows() -U- */
+Sequence< sal_Int32 > SAL_CALL OResultSet::deleteRows(const Sequence< Any >& /* rows */)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSet::deleteRows");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+ Sequence< sal_Int32 > aRet = Sequence< sal_Int32 >();
+
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OResultSet::deleteRows", *this);
+ return aRet;
+}
+/* }}} */
+
+
+/* {{{ OResultSet::createArrayHelper() -I- */
+IPropertyArrayHelper * OResultSet::createArrayHelper() const
+{
+ OSL_TRACE("OResultSet::createArrayHelper");
+ Sequence< Property > aProps(5);
+ Property* pProperties = aProps.getArray();
+ sal_Int32 nPos = 0;
+ DECL_PROP0(FETCHDIRECTION, sal_Int32);
+ DECL_PROP0(FETCHSIZE, sal_Int32);
+ DECL_BOOL_PROP1IMPL(ISBOOKMARKABLE) PropertyAttribute::READONLY);
+ DECL_PROP1IMPL(RESULTSETCONCURRENCY,sal_Int32) PropertyAttribute::READONLY);
+ DECL_PROP1IMPL(RESULTSETTYPE, sal_Int32) PropertyAttribute::READONLY);
+
+ return new OPropertyArrayHelper(aProps);
+}
+/* }}} */
+
+
+/* {{{ OResultSet::getInfoHelper() -I- */
+IPropertyArrayHelper & OResultSet::getInfoHelper()
+{
+ OSL_TRACE("OResultSet::getInfoHelper");
+ return (*const_cast<OResultSet*>(this)->getArrayHelper());
+}
+/* }}} */
+
+
+/* {{{ OResultSet::convertFastPropertyValue() -I- */
+sal_Bool OResultSet::convertFastPropertyValue(Any & /* rConvertedValue */,
+ Any & /* rOldValue */,
+ sal_Int32 nHandle,
+ const Any& /* rValue */)
+ throw (::com::sun::star::lang::IllegalArgumentException)
+{
+ OSL_TRACE("OResultSet::convertFastPropertyValue");
+ switch (nHandle) {
+ case PROPERTY_ID_ISBOOKMARKABLE:
+ case PROPERTY_ID_CURSORNAME:
+ case PROPERTY_ID_RESULTSETCONCURRENCY:
+ case PROPERTY_ID_RESULTSETTYPE:
+ throw ::com::sun::star::lang::IllegalArgumentException();
+ case PROPERTY_ID_FETCHDIRECTION:
+ case PROPERTY_ID_FETCHSIZE:
+ default:
+ ;
+ }
+ return sal_False;
+}
+/* }}} */
+
+
+/* {{{ OResultSet::setFastPropertyValue_NoBroadcast() -I- */
+void OResultSet::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const Any& /* rValue */)
+ throw (Exception)
+{
+ OSL_TRACE("OResultSet::setFastPropertyValue_NoBroadcast");
+ switch (nHandle) {
+ case PROPERTY_ID_ISBOOKMARKABLE:
+ case PROPERTY_ID_CURSORNAME:
+ case PROPERTY_ID_RESULTSETCONCURRENCY:
+ case PROPERTY_ID_RESULTSETTYPE:
+ throw Exception();
+ case PROPERTY_ID_FETCHDIRECTION:
+ break;
+ case PROPERTY_ID_FETCHSIZE:
+ break;
+ default:
+ ;
+ }
+}
+/* }}} */
+
+
+/* {{{ OResultSet::getFastPropertyValue() -I- */
+void OResultSet::getFastPropertyValue(Any& _rValue, sal_Int32 nHandle) const
+{
+ OSL_TRACE("OResultSet::getFastPropertyValue");
+ switch (nHandle) {
+ case PROPERTY_ID_ISBOOKMARKABLE:
+ _rValue <<= sal_False;
+ break;
+ case PROPERTY_ID_CURSORNAME:
+ case PROPERTY_ID_RESULTSETCONCURRENCY:
+ case PROPERTY_ID_RESULTSETTYPE:
+ case PROPERTY_ID_FETCHDIRECTION:
+ case PROPERTY_ID_FETCHSIZE:
+ ;
+ default:
+ ;
+ }
+}
+/* }}} */
+
+
+/* {{{ OResultSet::acquire() -I- */
+void SAL_CALL OResultSet::acquire()
+ throw()
+{
+ OSL_TRACE("OResultSet::acquire");
+ OResultSet_BASE::acquire();
+}
+/* }}} */
+
+
+/* {{{ OResultSet::release() -I- */
+void SAL_CALL OResultSet::release()
+ throw()
+{
+ OSL_TRACE("OResultSet::release");
+ OResultSet_BASE::release();
+}
+/* }}} */
+
+
+/* {{{ OResultSet::getPropertySetInfo() -I- */
+::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL OResultSet::getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException)
+{
+ OSL_TRACE("OResultSet::getPropertySetInfo");
+ return (::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper()));
+}
+/* }}} */
+
+
+/* {{{ OResultSet::checkColumnIndex() -I- */
+void OResultSet::checkColumnIndex(sal_Int32 index)
+ throw (SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSet::checkColumnIndex");
+ if ((index < 1 || index > (int) fieldCount)) {
+ /* static object for efficiency or thread safety is a problem ? */
+ OUString buf( RTL_CONSTASCII_USTRINGPARAM( "index out of range" ) );
+ throw SQLException(buf, *this, OUString(), 1, Any());
+ }
+}
+/* }}} */
+
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
diff --git a/mysqlc/source/mysqlc_resultset.hxx b/mysqlc/source/mysqlc_resultset.hxx
new file mode 100644
index 000000000000..9a03ebe0cc68
--- /dev/null
+++ b/mysqlc/source/mysqlc_resultset.hxx
@@ -0,0 +1,337 @@
+/*************************************************************************
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2008 by Sun Microsystems, Inc.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* $RCSfile: mysqlc_resultset.hxx,v $
+*
+* $Revision: 1.1.2.4 $
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+************************************************************************/
+
+#ifndef MYSQLC_SRESULTSET_HXX
+#define MYSQLC_SRESULTSET_HXX
+
+#include "mysqlc_preparedstatement.hxx"
+#include "mysqlc_statement.hxx"
+#include "mysqlc_subcomponent.hxx"
+
+#include <com/sun/star/sdbc/XCloseable.hpp>
+#include <com/sun/star/sdbc/XColumnLocate.hpp>
+#include <com/sun/star/sdbc/XResultSet.hpp>
+#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
+#include <com/sun/star/sdbc/XResultSetUpdate.hpp>
+#include <com/sun/star/sdbc/XRow.hpp>
+#include <com/sun/star/sdbc/XRowUpdate.hpp>
+#include <com/sun/star/sdbc/XWarningsSupplier.hpp>
+#include <com/sun/star/sdbcx/XDeleteRows.hpp>
+#include <com/sun/star/sdbcx/XRowLocate.hpp>
+#include <com/sun/star/util/XCancellable.hpp>
+
+#include <cppuhelper/compbase12.hxx>
+
+
+namespace connectivity
+{
+ namespace mysqlc
+ {
+ using ::rtl::OUString;
+ using ::com::sun::star::sdbc::SQLException;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::uno::Any;
+ typedef ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > my_XInputStreamRef;
+ typedef my_XNameAccessRef my_XNameAccessRef;
+
+ /*
+ ** OResultSet
+ */
+ typedef ::cppu::WeakComponentImplHelper12< ::com::sun::star::sdbc::XResultSet,
+ ::com::sun::star::sdbc::XRow,
+ ::com::sun::star::sdbc::XResultSetMetaDataSupplier,
+ ::com::sun::star::util::XCancellable,
+ ::com::sun::star::sdbc::XWarningsSupplier,
+ ::com::sun::star::sdbc::XResultSetUpdate,
+ ::com::sun::star::sdbc::XRowUpdate,
+ ::com::sun::star::sdbcx::XRowLocate,
+ ::com::sun::star::sdbcx::XDeleteRows,
+ ::com::sun::star::sdbc::XCloseable,
+ ::com::sun::star::sdbc::XColumnLocate,
+ ::com::sun::star::lang::XServiceInfo> OResultSet_BASE;
+
+ class OResultSet : public OBase_Mutex,
+ public OResultSet_BASE,
+ public ::cppu::OPropertySetHelper,
+ public OPropertyArrayUsageHelper<OResultSet>
+ {
+ protected:
+ ::com::sun::star::uno::WeakReferenceHelper m_aStatement;
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData> m_xMetaData;
+ sql::ResultSet *m_result;
+ unsigned int fieldCount;
+ rtl_TextEncoding m_encoding;
+ // OPropertyArrayUsageHelper
+ ::cppu::IPropertyArrayHelper* createArrayHelper() const;
+ // OPropertySetHelper
+ ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
+
+ sal_Bool SAL_CALL convertFastPropertyValue(Any & rConvertedValue, Any & rOldValue, sal_Int32 nHandle, const Any& rValue)
+ throw (::com::sun::star::lang::IllegalArgumentException);
+
+ void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const Any& rValue)
+ throw (::com::sun::star::uno::Exception);
+
+ void SAL_CALL getFastPropertyValue(Any& rValue, sal_Int32 nHandle) const;
+
+ // you can't delete objects of this type
+ virtual ~OResultSet();
+
+ public:
+ DECLARE_SERVICE_INFO();
+
+ OResultSet( OCommonStatement* pStmt, sql::ResultSet *result, rtl_TextEncoding _encoding );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > operator *()
+ {
+ return ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >(*(OResultSet_BASE*)this);
+ }
+
+ // ::cppu::OComponentHelper
+ void SAL_CALL disposing();
+
+ // XInterface
+ Any SAL_CALL queryInterface(const ::com::sun::star::uno::Type & rType)
+ throw(RuntimeException);
+
+ void SAL_CALL acquire() throw();
+
+ void SAL_CALL release() throw();
+
+ //XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes()
+ throw(RuntimeException);
+
+ // XPropertySet
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo()
+ throw(RuntimeException);
+
+ // XResultSet
+ sal_Bool SAL_CALL next() throw(SQLException, RuntimeException);
+
+ sal_Bool SAL_CALL isBeforeFirst() throw(SQLException, RuntimeException);
+
+ sal_Bool SAL_CALL isAfterLast() throw(SQLException, RuntimeException);
+
+ sal_Bool SAL_CALL isFirst() throw(SQLException, RuntimeException);
+
+ sal_Bool SAL_CALL isLast() throw(SQLException, RuntimeException);
+
+ void SAL_CALL beforeFirst() throw(SQLException, RuntimeException);
+
+ void SAL_CALL afterLast() throw(SQLException, RuntimeException);
+
+ sal_Bool SAL_CALL first() throw(SQLException, RuntimeException);
+
+ sal_Bool SAL_CALL last() throw(SQLException, RuntimeException);
+
+ sal_Int32 SAL_CALL getRow() throw(SQLException, RuntimeException);
+
+ sal_Bool SAL_CALL absolute(sal_Int32 row) throw(SQLException, RuntimeException);
+
+ sal_Bool SAL_CALL relative(sal_Int32 rows) throw(SQLException, RuntimeException);
+
+ sal_Bool SAL_CALL previous() throw(SQLException, RuntimeException);
+
+ void SAL_CALL refreshRow() throw(SQLException, RuntimeException);
+
+ sal_Bool SAL_CALL rowUpdated() throw(SQLException, RuntimeException);
+
+ sal_Bool SAL_CALL rowInserted() throw(SQLException, RuntimeException);
+
+ sal_Bool SAL_CALL rowDeleted() throw(SQLException, RuntimeException);
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getStatement()
+ throw(SQLException, RuntimeException);
+ // XRow
+ sal_Bool SAL_CALL wasNull() throw(SQLException, RuntimeException);
+
+ OUString SAL_CALL getString(sal_Int32 column) throw(SQLException, RuntimeException);
+
+ sal_Bool SAL_CALL getBoolean(sal_Int32 column) throw(SQLException, RuntimeException);
+
+ sal_Int8 SAL_CALL getByte(sal_Int32 column) throw(SQLException, RuntimeException);
+
+ sal_Int16 SAL_CALL getShort(sal_Int32 column) throw(SQLException, RuntimeException);
+
+ sal_Int32 SAL_CALL getInt(sal_Int32 column) throw(SQLException, RuntimeException);
+
+ sal_Int64 SAL_CALL getLong(sal_Int32 column) throw(SQLException, RuntimeException);
+
+ float SAL_CALL getFloat(sal_Int32 column) throw(SQLException, RuntimeException);
+
+ double SAL_CALL getDouble(sal_Int32 column) throw(SQLException, RuntimeException);
+
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getBytes(sal_Int32 column)
+ throw(SQLException, RuntimeException);
+
+ ::com::sun::star::util::Date SAL_CALL getDate(sal_Int32 column)
+ throw(SQLException, RuntimeException);
+
+ ::com::sun::star::util::Time SAL_CALL getTime(sal_Int32 column)
+ throw(SQLException, RuntimeException);
+
+ ::com::sun::star::util::DateTime SAL_CALL getTimestamp(sal_Int32 column)
+ throw(SQLException, RuntimeException);
+
+ my_XInputStreamRef SAL_CALL getBinaryStream(sal_Int32 column)
+ throw(SQLException, RuntimeException);
+
+ my_XInputStreamRef SAL_CALL getCharacterStream(sal_Int32 column)
+ throw(SQLException, RuntimeException);
+
+ Any SAL_CALL getObject(sal_Int32 column, const my_XNameAccessRef& typeMap)
+ throw(SQLException, RuntimeException);
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef > SAL_CALL getRef(sal_Int32 column)
+ throw(SQLException, RuntimeException);
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob > SAL_CALL getBlob(sal_Int32 column)
+ throw(SQLException, RuntimeException);
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob > SAL_CALL getClob(sal_Int32 column)
+ throw(SQLException, RuntimeException);
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray > SAL_CALL getArray(sal_Int32 column)
+ throw(SQLException, RuntimeException);
+
+ // XResultSetMetaDataSupplier
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > SAL_CALL getMetaData()
+ throw(SQLException, RuntimeException);
+
+ // XCancellable
+ void SAL_CALL cancel() throw(RuntimeException);
+
+ // XCloseable
+ void SAL_CALL close() throw(SQLException, RuntimeException);
+
+ // XWarningsSupplier
+ Any SAL_CALL getWarnings() throw(SQLException, RuntimeException);
+
+ void SAL_CALL clearWarnings() throw(SQLException, RuntimeException);
+
+ // XResultSetUpdate
+ void SAL_CALL insertRow() throw(SQLException, RuntimeException);
+
+ void SAL_CALL updateRow() throw(SQLException, RuntimeException);
+
+ void SAL_CALL deleteRow() throw(SQLException, RuntimeException);
+
+ void SAL_CALL cancelRowUpdates() throw(SQLException, RuntimeException);
+
+ void SAL_CALL moveToInsertRow() throw(SQLException, RuntimeException);
+
+ void SAL_CALL moveToCurrentRow() throw(SQLException, RuntimeException);
+
+ // XRowUpdate
+ void SAL_CALL updateNull(sal_Int32 column) throw(SQLException, RuntimeException);
+
+ void SAL_CALL updateBoolean(sal_Int32 column, sal_Bool x) throw(SQLException, RuntimeException);
+
+ void SAL_CALL updateByte(sal_Int32 column, sal_Int8 x) throw(SQLException, RuntimeException);
+
+ void SAL_CALL updateShort(sal_Int32 column, sal_Int16 x) throw(SQLException, RuntimeException);
+
+ void SAL_CALL updateInt(sal_Int32 column, sal_Int32 x) throw(SQLException, RuntimeException);
+
+ void SAL_CALL updateLong(sal_Int32 column, sal_Int64 x) throw(SQLException, RuntimeException);
+
+ void SAL_CALL updateFloat(sal_Int32 column, float x) throw(SQLException, RuntimeException);
+
+ void SAL_CALL updateDouble(sal_Int32 column, double x) throw(SQLException, RuntimeException);
+
+ void SAL_CALL updateString(sal_Int32 column, const OUString& x)
+ throw(SQLException, RuntimeException);
+
+ void SAL_CALL updateBytes(sal_Int32 column, const ::com::sun::star::uno::Sequence< sal_Int8 >& x)
+ throw(SQLException, RuntimeException);
+
+ void SAL_CALL updateDate(sal_Int32 column, const ::com::sun::star::util::Date& x)
+ throw(SQLException, RuntimeException);
+
+ void SAL_CALL updateTime(sal_Int32 column, const ::com::sun::star::util::Time& x)
+ throw(SQLException, RuntimeException);
+
+ void SAL_CALL updateTimestamp(sal_Int32 column, const ::com::sun::star::util::DateTime& x)
+ throw(SQLException, RuntimeException);
+
+ void SAL_CALL updateBinaryStream(sal_Int32 column, const my_XInputStreamRef& x, sal_Int32 length)
+ throw(SQLException, RuntimeException);
+
+ void SAL_CALL updateCharacterStream(sal_Int32 column, const my_XInputStreamRef& x, sal_Int32 length)
+ throw(SQLException, RuntimeException);
+
+ void SAL_CALL updateObject(sal_Int32 column, const Any& x)
+ throw(SQLException, RuntimeException);
+
+ void SAL_CALL updateNumericObject(sal_Int32 column, const Any& x, sal_Int32 scale)
+ throw(SQLException, RuntimeException);
+
+ // XColumnLocate
+ sal_Int32 SAL_CALL findColumn(const OUString& columnName)
+ throw(SQLException, RuntimeException);
+
+ // XRowLocate
+ Any SAL_CALL getBookmark() throw(SQLException, RuntimeException);
+
+ sal_Bool SAL_CALL moveToBookmark(const Any& bookmark)
+ throw(SQLException, RuntimeException);
+
+ sal_Bool SAL_CALL moveRelativeToBookmark(const Any& bookmark, sal_Int32 rows)
+ throw(SQLException, RuntimeException);
+
+ sal_Int32 SAL_CALL compareBookmarks(const Any& first, const Any& second)
+ throw(SQLException, RuntimeException);
+
+ sal_Bool SAL_CALL hasOrderedBookmarks() throw(SQLException, RuntimeException);
+
+ sal_Int32 SAL_CALL hashBookmark(const Any& bookmark)
+ throw(SQLException, RuntimeException);
+
+ // XDeleteRows
+ ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL deleteRows(const ::com::sun::star::uno::Sequence< Any >& rows)
+ throw(SQLException, RuntimeException);
+
+ void checkColumnIndex(sal_Int32 index) throw(SQLException, RuntimeException);
+
+ private:
+ using ::cppu::OPropertySetHelper::getFastPropertyValue;
+ };
+ } /* mysqlc */
+} /* connectivity */
+#endif // CONNECTIVITY_SRESULTSET_HXX
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
diff --git a/mysqlc/source/mysqlc_resultsetmetadata.cxx b/mysqlc/source/mysqlc_resultsetmetadata.cxx
new file mode 100644
index 000000000000..aaf9cc506c32
--- /dev/null
+++ b/mysqlc/source/mysqlc_resultsetmetadata.cxx
@@ -0,0 +1,468 @@
+/*************************************************************************
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2008 by Sun Microsystems, Inc.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* $RCSfile: mysqlc_resultsetmetadata.cxx,v $
+*
+* $Revision: 1.1.2.4 $
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+************************************************************************/
+
+#include "mysqlc_resultsetmetadata.hxx"
+#include "mysqlc_general.hxx"
+#include "cppconn/exception.h"
+
+#include <rtl/ustrbuf.hxx>
+
+using namespace connectivity::mysqlc;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::sdbc;
+using ::rtl::OUString;
+
+// -------------------------------------------------------------------------
+OResultSetMetaData::~OResultSetMetaData()
+{
+}
+/* }}} */
+
+
+/* {{{ OResultSetMetaData::getColumnDisplaySize() -I- */
+sal_Int32 SAL_CALL OResultSetMetaData::getColumnDisplaySize(sal_Int32 column)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSetMetaData::getColumnDisplaySize");
+
+ try {
+ meta->getColumnDisplaySize(column);
+ } catch (sql::MethodNotImplementedException) {
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OResultSetMetaData::getColumnDisplaySize", *this);
+ } catch (sql::SQLException &e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding);
+ }
+ return 0; // fool compiler
+}
+/* }}} */
+
+
+/* {{{ OResultSetMetaData::getColumnType() -I- */
+sal_Int32 SAL_CALL OResultSetMetaData::getColumnType(sal_Int32 column)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSetMetaData::getColumnType");
+ checkColumnIndex(column);
+
+ try {
+ return mysqlc_sdbc_driver::mysqlToOOOType(meta->getColumnType(column));
+ } catch (sql::MethodNotImplementedException) {
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OResultSetMetaData::getMetaData", *this);
+ } catch (sql::SQLException &e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding);
+ }
+ return 0; // fool compiler
+}
+/* }}} */
+
+/*
+ XXX: This method doesn't throw exceptions at all.
+ Should it declare that it throws ?? What if throw() is removed?
+ Does it change the API, the open-close principle?
+*/
+/* {{{ OResultSetMetaData::getColumnCount() -I- */
+sal_Int32 SAL_CALL OResultSetMetaData::getColumnCount()
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSetMetaData::getColumnCount");
+ try {
+ return meta->getColumnCount();
+ } catch (sql::MethodNotImplementedException) {
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OResultSetMetaData::getMetaData", *this);
+ } catch (sql::SQLException &e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding);
+ }
+ return 0; // fool compiler
+}
+/* }}} */
+
+
+/* {{{ OResultSetMetaData::isCaseSensitive() -I- */
+sal_Bool SAL_CALL OResultSetMetaData::isCaseSensitive(sal_Int32 column)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSetMetaData::isCaseSensitive");
+ checkColumnIndex(column);
+
+ try {
+ return meta->isCaseSensitive(column);
+ } catch (sql::MethodNotImplementedException) {
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OResultSetMetaData::getMetaData", *this);
+ } catch (sql::SQLException &e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding);
+ }
+ return sal_False; // fool compiler
+}
+/* }}} */
+
+
+/* {{{ OResultSetMetaData::getSchemaName() -I- */
+OUString SAL_CALL OResultSetMetaData::getSchemaName(sal_Int32 column)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSetMetaData::getSchemaName");
+ checkColumnIndex(column);
+
+ try {
+ return convert(meta->getSchemaName(column));
+ } catch (sql::MethodNotImplementedException) {
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OResultSetMetaData::getMetaData", *this);
+ } catch (sql::SQLException &e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding);
+ }
+ return OUString(); // fool compiler
+}
+/* }}} */
+
+
+/* {{{ OResultSetMetaData::getColumnName() -I- */
+OUString SAL_CALL OResultSetMetaData::getColumnName(sal_Int32 column)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSetMetaData::getColumnName");
+ checkColumnIndex(column);
+
+ try {
+ return convert( meta->getColumnName( column ) );
+ } catch (sql::MethodNotImplementedException) {
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OResultSetMetaData::getMetaData", *this);
+ } catch (sql::SQLException &e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding);
+ }
+ return OUString(); // fool compiler
+}
+/* }}} */
+
+
+/* {{{ OResultSetMetaData::getTableName() -I- */
+OUString SAL_CALL OResultSetMetaData::getTableName(sal_Int32 column)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSetMetaData::getTableName");
+ checkColumnIndex(column);
+
+ try {
+ return convert(meta->getTableName(column));
+ } catch (sql::MethodNotImplementedException) {
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OResultSetMetaData::getMetaData", *this);
+ } catch (sql::SQLException &e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding);
+ }
+ return OUString(); // fool compiler
+}
+/* }}} */
+
+
+/* {{{ OResultSetMetaData::getCatalogName() -I- */
+OUString SAL_CALL OResultSetMetaData::getCatalogName(sal_Int32 column)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSetMetaData::getCatalogName");
+ checkColumnIndex(column);
+
+ try {
+ return convert(meta->getCatalogName(column));
+ } catch (sql::MethodNotImplementedException) {
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OResultSetMetaData::getMetaData", *this);
+ } catch (sql::SQLException &e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding);
+ }
+ return OUString(); // fool compiler
+}
+/* }}} */
+
+
+/* {{{ OResultSetMetaData::getColumnTypeName() -I- */
+OUString SAL_CALL OResultSetMetaData::getColumnTypeName(sal_Int32 column)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSetMetaData::getColumnTypeName");
+ checkColumnIndex(column);
+
+ try {
+ return convert(meta->getColumnTypeName(column));
+ } catch (sql::MethodNotImplementedException) {
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OResultSetMetaData::getMetaData", *this);
+ } catch (sql::SQLException &e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding);
+ }
+ return OUString(); // fool compiler
+}
+/* }}} */
+
+
+/* {{{ OResultSetMetaData::getColumnLabel() -I- */
+OUString SAL_CALL OResultSetMetaData::getColumnLabel(sal_Int32 column)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSetMetaData::getColumnLabel");
+ checkColumnIndex(column);
+
+ try {
+ return convert(meta->getColumnLabel(column));
+ } catch (sql::MethodNotImplementedException) {
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OResultSetMetaData::getMetaData", *this);
+ } catch (sql::SQLException &e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding);
+ }
+ return OUString(); // fool compiler
+}
+/* }}} */
+
+
+/* {{{ OResultSetMetaData::getColumnServiceName() -I- */
+OUString SAL_CALL OResultSetMetaData::getColumnServiceName(sal_Int32 column)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSetMetaData::getColumnServiceName");
+ checkColumnIndex(column);
+
+ OUString aRet = OUString();
+ return aRet;
+}
+/* }}} */
+
+
+/* {{{ OResultSetMetaData::isCurrency() -I- */
+sal_Bool SAL_CALL OResultSetMetaData::isCurrency(sal_Int32 column)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSetMetaData::isCurrency");
+ checkColumnIndex(column);
+
+ try {
+ return meta->isCurrency(column)? sal_True:sal_False;
+ } catch (sql::MethodNotImplementedException) {
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OResultSetMetaData::getMetaData", *this);
+ } catch (sql::SQLException &e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding);
+ }
+ return sal_False; // fool compiler
+}
+/* }}} */
+
+
+/* {{{ OResultSetMetaData::isAutoIncrement() -I- */
+sal_Bool SAL_CALL OResultSetMetaData::isAutoIncrement(sal_Int32 column)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSetMetaData::isAutoIncrement");
+ checkColumnIndex(column);
+
+ try {
+ return meta->isAutoIncrement(column)? sal_True:sal_False;
+ } catch (sql::MethodNotImplementedException) {
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OResultSetMetaData::getMetaData", *this);
+ } catch (sql::SQLException &e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding);
+ }
+ return sal_False; // fool compiler
+}
+/* }}} */
+
+
+/* {{{ OResultSetMetaData::isSigned() -I- */
+sal_Bool SAL_CALL OResultSetMetaData::isSigned(sal_Int32 column)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSetMetaData::isSigned");
+ checkColumnIndex(column);
+
+ try {
+ return meta->isSigned(column)? sal_True:sal_False;
+ } catch (sql::MethodNotImplementedException) {
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OResultSetMetaData::getMetaData", *this);
+ } catch (sql::SQLException &e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding);
+ }
+ return sal_False; // fool compiler
+}
+/* }}} */
+
+
+/* {{{ OResultSetMetaData::getPrecision() -I- */
+sal_Int32 SAL_CALL OResultSetMetaData::getPrecision(sal_Int32 column)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSetMetaData::getPrecision");
+ checkColumnIndex(column);
+
+ try {
+ return meta->getPrecision(column);
+ } catch (sql::MethodNotImplementedException) {
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OResultSetMetaData::getPrecision", *this);
+ } catch (sql::SQLException &e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding);
+ }
+ return 0; // fool compiler
+}
+/* }}} */
+
+
+/* {{{ OResultSetMetaData::getScale() -I- */
+sal_Int32 SAL_CALL OResultSetMetaData::getScale(sal_Int32 column)
+ throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
+{
+ OSL_TRACE("OResultSetMetaData::getScale");
+ checkColumnIndex(column);
+ try {
+ return meta->getScale(column);
+ } catch (sql::MethodNotImplementedException) {
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OResultSetMetaData::getScale", *this);
+ } catch (sql::SQLException &e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding);
+ }
+ return 0; // fool compiler
+}
+/* }}} */
+
+
+/* {{{ OResultSetMetaData::isNullable() -I- */
+sal_Int32 SAL_CALL OResultSetMetaData::isNullable(sal_Int32 column)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSetMetaData::isNullable");
+ checkColumnIndex(column);
+
+ try {
+ return meta->isNullable(column)? sal_True:sal_False;
+ } catch (sql::MethodNotImplementedException) {
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OResultSetMetaData::getMetaData", *this);
+ } catch (sql::SQLException &e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding);
+ }
+ return sal_False; // fool compiler
+}
+/* }}} */
+
+
+/* {{{ OResultSetMetaData::isSearchable() -I- */
+sal_Bool SAL_CALL OResultSetMetaData::isSearchable(sal_Int32 column)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSetMetaData::isSearchable");
+ checkColumnIndex(column);
+
+ try {
+ return meta->isSearchable(column)? sal_True:sal_False;
+ } catch (sql::MethodNotImplementedException) {
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OResultSetMetaData::getMetaData", *this);
+ } catch (sql::SQLException &e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding);
+ }
+ return sal_False; // fool compiler
+}
+/* }}} */
+
+
+/* {{{ OResultSetMetaData::isReadOnly() -I- */
+sal_Bool SAL_CALL OResultSetMetaData::isReadOnly(sal_Int32 column)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSetMetaData::isReadOnly");
+ checkColumnIndex(column);
+
+ try {
+ return meta->isReadOnly(column)? sal_True:sal_False;
+ } catch (sql::MethodNotImplementedException) {
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OResultSetMetaData::getMetaData", *this);
+ } catch (sql::SQLException &e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding);
+ }
+ return sal_False; // fool compiler
+}
+/* }}} */
+
+
+/* {{{ OResultSetMetaData::isDefinitelyWritable() -I- */
+sal_Bool SAL_CALL OResultSetMetaData::isDefinitelyWritable(sal_Int32 column)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSetMetaData::isDefinitelyWritable");
+ checkColumnIndex(column);
+
+ try {
+ return meta->isDefinitelyWritable(column)? sal_True:sal_False;
+ } catch (sql::MethodNotImplementedException) {
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OResultSetMetaData::getMetaData", *this);
+ } catch (sql::SQLException &e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding);
+ }
+ return sal_False; // fool compiler
+}
+/* }}} */
+
+
+/* {{{ OResultSetMetaData::isWritable() -I- */
+sal_Bool SAL_CALL OResultSetMetaData::isWritable(sal_Int32 column)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSetMetaData::isWritable");
+ checkColumnIndex(column);
+
+ try {
+ return meta->isWritable(column)? sal_True:sal_False;
+ } catch (sql::MethodNotImplementedException) {
+ mysqlc_sdbc_driver::throwFeatureNotImplementedException("OResultSetMetaData::getMetaData", *this);
+ } catch (sql::SQLException &e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding);
+ }
+ return sal_False; // fool compiler
+}
+/* }}} */
+
+
+/* {{{ OResultSetMetaData::checkColumnIndex() -I- */
+void OResultSetMetaData::checkColumnIndex(sal_Int32 columnIndex)
+ throw (SQLException, RuntimeException)
+{
+ OSL_TRACE("OResultSetMetaData::checkColumnIndex");
+ if (columnIndex < 1 || columnIndex > (sal_Int32) meta->getColumnCount()) {
+
+ ::rtl::OUStringBuffer buf;
+ buf.appendAscii( "Column index out of range (expected 1 to " );
+ buf.append( sal_Int32( meta->getColumnCount() ) );
+ buf.appendAscii( ", got " );
+ buf.append( sal_Int32( columnIndex ) );
+ buf.append( sal_Unicode( '.' ) );
+ throw SQLException( buf.makeStringAndClear(), *this, OUString(), 1, Any() );
+ }
+}
+/* }}} */
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
+
diff --git a/mysqlc/source/mysqlc_resultsetmetadata.hxx b/mysqlc/source/mysqlc_resultsetmetadata.hxx
new file mode 100644
index 000000000000..7793179a0844
--- /dev/null
+++ b/mysqlc/source/mysqlc_resultsetmetadata.hxx
@@ -0,0 +1,121 @@
+/*************************************************************************
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2008 by Sun Microsystems, Inc.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* $RCSfile: mysqlc_resultsetmetadata.hxx,v $
+*
+* $Revision: 1.1.2.4 $
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+************************************************************************/
+
+#ifndef CONNECTIVITY_SRESULSETMETADATA_HXX
+#define CONNECTIVITY_SRESULSETMETADATA_HXX
+
+#include "mysqlc_connection.hxx"
+
+#include <com/sun/star/sdbc/XResultSetMetaData.hpp>
+
+#include <cppuhelper/implbase1.hxx>
+#include <cppconn/resultset_metadata.h>
+
+namespace connectivity
+{
+ namespace mysqlc
+ {
+ using ::com::sun::star::sdbc::SQLException;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::rtl::OUString;
+ //**************************************************************
+ //************ Class: ResultSetMetaData
+ //**************************************************************
+ typedef ::cppu::WeakImplHelper1< ::com::sun::star::sdbc::XResultSetMetaData> OResultSetMetaData_BASE;
+
+ class OResultSetMetaData : public OResultSetMetaData_BASE
+ {
+ sql::ResultSetMetaData * meta;
+ rtl_TextEncoding m_encoding;
+ protected:
+ virtual ~OResultSetMetaData();
+ public:
+ OResultSetMetaData( sql::ResultSetMetaData * _meta, rtl_TextEncoding _encoding )
+ :meta(_meta)
+ ,m_encoding( _encoding )
+ {
+ }
+
+ inline ::rtl::OUString convert( const ::std::string& _string ) const
+ {
+ return ::rtl::OUString( _string.c_str(), _string.size(), m_encoding );
+ }
+
+ /// Avoid ambigous cast error from the compiler.
+ inline operator ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > () throw()
+ { return this; }
+
+ sal_Int32 SAL_CALL getColumnCount() throw(SQLException, RuntimeException);
+
+ sal_Bool SAL_CALL isAutoIncrement(sal_Int32 column) throw(SQLException, RuntimeException);
+
+ sal_Bool SAL_CALL isCaseSensitive(sal_Int32 column) throw(SQLException, RuntimeException);
+
+ sal_Bool SAL_CALL isSearchable(sal_Int32 column) throw(SQLException, RuntimeException);
+
+ sal_Bool SAL_CALL isCurrency(sal_Int32 column) throw(SQLException, RuntimeException);
+
+ sal_Int32 SAL_CALL isNullable(sal_Int32 column) throw(SQLException, RuntimeException);
+
+ sal_Bool SAL_CALL isSigned(sal_Int32 column) throw(SQLException, RuntimeException);
+
+ sal_Int32 SAL_CALL getColumnDisplaySize(sal_Int32 column)throw(SQLException, RuntimeException);
+
+ OUString SAL_CALL getColumnLabel(sal_Int32 column) throw(SQLException, RuntimeException);
+
+ OUString SAL_CALL getColumnName(sal_Int32 column) throw(SQLException, RuntimeException);
+
+ OUString SAL_CALL getSchemaName(sal_Int32 column) throw(SQLException, RuntimeException);
+
+ sal_Int32 SAL_CALL getPrecision(sal_Int32 column) throw(SQLException, RuntimeException);
+
+ sal_Int32 SAL_CALL getScale(sal_Int32 column) throw(SQLException, RuntimeException);
+
+ OUString SAL_CALL getTableName(sal_Int32 column) throw(SQLException, RuntimeException);
+
+ OUString SAL_CALL getCatalogName(sal_Int32 column) throw(SQLException, RuntimeException);
+
+ sal_Int32 SAL_CALL getColumnType(sal_Int32 column) throw(SQLException, RuntimeException);
+
+ OUString SAL_CALL getColumnTypeName(sal_Int32 column) throw(SQLException, RuntimeException);
+
+ sal_Bool SAL_CALL isReadOnly(sal_Int32 column) throw(SQLException, RuntimeException);
+
+ sal_Bool SAL_CALL isWritable(sal_Int32 column) throw(SQLException, RuntimeException);
+
+ sal_Bool SAL_CALL isDefinitelyWritable(sal_Int32 column)throw(SQLException, RuntimeException);
+
+ OUString SAL_CALL getColumnServiceName(sal_Int32 column)throw(SQLException, RuntimeException);
+
+ void checkColumnIndex(sal_Int32 columnIndex) throw (SQLException, RuntimeException);
+ };
+ }
+}
+
+#endif // CONNECTIVITY_SRESULSETMETADATA_HXX
diff --git a/mysqlc/source/mysqlc_services.cxx b/mysqlc/source/mysqlc_services.cxx
new file mode 100644
index 000000000000..41ffd6b673cc
--- /dev/null
+++ b/mysqlc/source/mysqlc_services.cxx
@@ -0,0 +1,183 @@
+/*************************************************************************
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2008 by Sun Microsystems, Inc.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* $RCSfile: mysqlc_services.cxx,v $
+*
+* $Revision: 1.1.2.5 $
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+************************************************************************/
+
+#include "mysqlc_driver.hxx"
+
+#include <cppuhelper/factory.hxx>
+#include <osl/diagnose.h>
+#include <rtl/ustrbuf.hxx>
+
+using namespace connectivity::mysqlc;
+using ::rtl::OUString;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::registry::XRegistryKey;
+using ::com::sun::star::lang::XSingleServiceFactory;
+using ::com::sun::star::lang::XMultiServiceFactory;
+
+typedef Reference< XSingleServiceFactory > (SAL_CALL *createFactoryFunc)
+ (
+ const Reference< XMultiServiceFactory > & rServiceManager,
+ const OUString & rComponentName,
+ ::cppu::ComponentInstantiation pCreateFunction,
+ const Sequence< OUString > & rServiceNames,
+ rtl_ModuleCount* _pTemp
+ );
+
+//***************************************************************************************
+//
+// Die vorgeschriebene C-API muss erfuellt werden!
+// Sie besteht aus drei Funktionen, die von dem Modul exportiert werden muessen.
+//
+
+//---------------------------------------------------------------------------------------
+void REGISTER_PROVIDER(
+ const OUString& aServiceImplName,
+ const Sequence< OUString>& Services,
+ const Reference< XRegistryKey > & xKey)
+{
+ ::rtl::OUStringBuffer aMainKeyName;
+ aMainKeyName.append( sal_Unicode( '/' ) );
+ aMainKeyName.append( aServiceImplName );
+ aMainKeyName.appendAscii( "/UNO/SERVICES" );
+
+ Reference< XRegistryKey > xNewKey( xKey->createKey( aMainKeyName.makeStringAndClear() ) );
+ OSL_ENSURE(xNewKey.is(), "SKELETON::component_writeInfo : could not create a registry key !");
+
+ for (sal_Int32 i = 0; i < Services.getLength(); ++i) {
+ xNewKey->createKey(Services[i]);
+ }
+}
+
+
+//---------------------------------------------------------------------------------------
+struct ProviderRequest
+{
+ Reference< XSingleServiceFactory > xRet;
+ Reference< XMultiServiceFactory > const xServiceManager;
+ OUString const sImplementationName;
+
+ ProviderRequest(
+ void* pServiceManager,
+ sal_Char const* pImplementationName
+ ) : xServiceManager(reinterpret_cast<XMultiServiceFactory*>(pServiceManager))
+ , sImplementationName(OUString::createFromAscii(pImplementationName))
+ {
+ }
+
+ /* {{{ CREATE_PROVIDER -I- */
+ inline sal_Bool CREATE_PROVIDER(
+ const OUString& Implname,
+ const Sequence< OUString > & Services,
+ ::cppu::ComponentInstantiation Factory,
+ createFactoryFunc creator
+ )
+ {
+ if (!xRet.is() && (Implname == sImplementationName)) {
+ try {
+ xRet = creator( xServiceManager, sImplementationName,Factory, Services,0);
+ } catch (...) {
+ }
+ }
+ return xRet.is();
+ }
+
+ void* getProvider() const { return xRet.get(); }
+};
+/* }}} */
+
+
+/* {{{ component_getImplementationEnvironment -I- */
+extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(
+ const sal_Char **ppEnvTypeName,
+ uno_Environment ** /* ppEnv */
+ )
+{
+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+/* }}} */
+
+
+/* {{{ component_writeInfo -I- */
+extern "C" SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo(void * /* pServiceManager */, void * pRegistryKey)
+{
+ if (pRegistryKey) {
+ try {
+ Reference< XRegistryKey > xKey(reinterpret_cast< XRegistryKey*>(pRegistryKey));
+
+ REGISTER_PROVIDER(
+ MysqlCDriver::getImplementationName_Static(),
+ MysqlCDriver::getSupportedServiceNames_Static(), xKey);
+
+ return sal_True;
+ } catch (::com::sun::star::registry::InvalidRegistryException& ) {
+ OSL_ENSURE(sal_False, "SKELETON::component_writeInfo : could not create a registry key ! ## InvalidRegistryException !");
+ }
+ }
+ return sal_False;
+}
+/* }}} */
+
+
+/* {{{ component_getFactory -I- */
+extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory(
+ const sal_Char * pImplementationName,
+ void * pServiceManager,
+ void * /* pRegistryKey */)
+{
+ void* pRet = 0;
+ if (pServiceManager) {
+ ProviderRequest aReq(pServiceManager,pImplementationName);
+
+ aReq.CREATE_PROVIDER(
+ MysqlCDriver::getImplementationName_Static(),
+ MysqlCDriver::getSupportedServiceNames_Static(),
+ MysqlCDriver_CreateInstance, ::cppu::createSingleFactory)
+ ;
+
+ if(aReq.xRet.is()) {
+ aReq.xRet->acquire();
+ }
+
+ pRet = aReq.getProvider();
+ }
+
+ return pRet;
+};
+/* }}} */
+
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
diff --git a/mysqlc/source/mysqlc_statement.cxx b/mysqlc/source/mysqlc_statement.cxx
new file mode 100644
index 000000000000..073970b4d058
--- /dev/null
+++ b/mysqlc/source/mysqlc_statement.cxx
@@ -0,0 +1,531 @@
+/*************************************************************************
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2008 by Sun Microsystems, Inc.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* $RCSfile: mysqlc_statement.cxx,v $
+*
+* $Revision: 1.1.2.4 $
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+************************************************************************/
+#include <stdio.h>
+#include "mysqlc_connection.hxx"
+#include "mysqlc_propertyids.hxx"
+#include "mysqlc_resultset.hxx"
+#include "mysqlc_statement.hxx"
+#include "mysqlc_general.hxx"
+
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/sdbc/FetchDirection.hpp>
+#include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
+#include <com/sun/star/sdbc/ResultSetType.hpp>
+
+#include <cppconn/connection.h>
+#include <cppconn/exception.h>
+#include <cppconn/statement.h>
+#include <cppuhelper/typeprovider.hxx>
+#include <osl/diagnose.h>
+#include <osl/thread.h>
+
+#define USE_CPP_CONN 1
+
+using namespace connectivity::mysqlc;
+//------------------------------------------------------------------------------
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::beans;
+using namespace com::sun::star::sdbc;
+using namespace com::sun::star::sdbcx;
+using namespace com::sun::star::container;
+using namespace com::sun::star::io;
+using namespace com::sun::star::util;
+using ::osl::MutexGuard;
+using ::rtl::OUString;
+
+#include <stdio.h>
+
+/* {{{ OConnection::OCommonStatement() -I- */
+OCommonStatement::OCommonStatement(OConnection* _pConnection, sql::Statement *_cppStatement)
+ :OCommonStatement_IBase(m_aMutex)
+ ,OPropertySetHelper(OCommonStatement_IBase::rBHelper)
+ ,OStatement_CBase( (::cppu::OWeakObject*)_pConnection, this )
+ ,m_pConnection(_pConnection)
+ ,cppStatement(_cppStatement)
+ ,rBHelper(OCommonStatement_IBase::rBHelper)
+{
+ OSL_TRACE("OCommonStatement::OCommonStatement");
+ m_pConnection->acquire();
+}
+/* }}} */
+
+
+/* {{{ OConnection::~OCommonStatement() -I- */
+OCommonStatement::~OCommonStatement()
+{
+ OSL_TRACE("OCommonStatement::~OCommonStatement");
+}
+/* }}} */
+
+
+/* {{{ OConnection::disposeResultSet() -I- */
+void OCommonStatement::disposeResultSet()
+{
+ OSL_TRACE("OCommonStatement::disposeResultSet");
+ // free the cursor if alive
+ delete cppStatement;
+ cppStatement = NULL;
+}
+/* }}} */
+
+
+/* {{{ OConnection::disposing() -I- */
+void OCommonStatement::disposing()
+{
+ OSL_TRACE("OCommonStatement::disposing");
+ MutexGuard aGuard(m_aMutex);
+
+ disposeResultSet();
+
+ if (m_pConnection) {
+ m_pConnection->release();
+ m_pConnection = NULL;
+ }
+ delete cppStatement;
+
+ dispose_ChildImpl();
+ OCommonStatement_IBase::disposing();
+}
+/* }}} */
+
+
+/* {{{ OCommonStatement::queryInterface() -I- */
+Any SAL_CALL OCommonStatement::queryInterface(const Type & rType)
+ throw(RuntimeException)
+{
+ OSL_TRACE("OCommonStatement::queryInterface");
+ Any aRet = OCommonStatement_IBase::queryInterface(rType);
+ if (!aRet.hasValue()) {
+ aRet = OPropertySetHelper::queryInterface(rType);
+ }
+ return aRet;
+}
+/* }}} */
+
+
+/* {{{ OCommonStatement::getTypes() -I- */
+Sequence< Type > SAL_CALL OCommonStatement::getTypes()
+ throw(RuntimeException)
+{
+ OSL_TRACE("OCommonStatement::getTypes");
+ ::cppu::OTypeCollection aTypes( ::getCppuType( (const Reference< XMultiPropertySet > *)0 ),
+ ::getCppuType( (const Reference< XFastPropertySet > *)0 ),
+ ::getCppuType( (const Reference< XPropertySet > *)0 ));
+
+ return concatSequences(aTypes.getTypes(), OCommonStatement_IBase::getTypes());
+}
+/* }}} */
+
+
+/* {{{ OCommonStatement::cancel() -I- */
+void SAL_CALL OCommonStatement::cancel()
+ throw(RuntimeException)
+{
+ OSL_TRACE("OCommonStatement::cancel");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(rBHelper.bDisposed);
+ // cancel the current sql statement
+}
+/* }}} */
+
+
+/* {{{ OCommonStatement::close() -I- */
+void SAL_CALL OCommonStatement::close()
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OCommonStatement::close");
+ /*
+ We need a block for the checkDisposed call.
+ After the check we can call dispose() as we are not under lock ??
+ */
+ {
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(rBHelper.bDisposed);
+ }
+ dispose();
+}
+/* }}} */
+
+
+/* {{{ OStatement::clearBatch() -I- */
+void SAL_CALL OStatement::clearBatch()
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OStatement::clearBatch");
+ // if you support batches clear it here
+}
+/* }}} */
+
+
+/* {{{ OStatement::execute() -I- */
+sal_Bool SAL_CALL OCommonStatement::execute(const OUString& sql)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OCommonStatement::execute");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(rBHelper.bDisposed);
+ const ::rtl::OUString sSqlStatement = m_pConnection->transFormPreparedStatement( sql );
+
+ sal_Bool success = false;
+ try {
+ success = cppStatement->execute(OUStringToOString(sSqlStatement, m_pConnection->getConnectionSettings().encoding).getStr())? sal_True:sal_False;
+ } catch (sql::SQLException &e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_pConnection->getConnectionEncoding());
+ }
+ return success;
+}
+/* }}} */
+
+
+/* {{{ OStatement::executeQuery() -I- */
+Reference< XResultSet > SAL_CALL OCommonStatement::executeQuery(const OUString& sql)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OCommonStatement::executeQuery");
+
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(rBHelper.bDisposed);
+ const ::rtl::OUString sSqlStatement = m_pConnection->transFormPreparedStatement(sql);
+
+ Reference< XResultSet > xResultSet;
+ try {
+ std::auto_ptr< sql::ResultSet > rset(cppStatement->executeQuery(OUStringToOString(sSqlStatement, m_pConnection->getConnectionEncoding()).getStr()));
+ xResultSet = new OResultSet(this, rset.get(), m_pConnection->getConnectionEncoding());
+ rset.release();
+ } catch (sql::SQLException &e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_pConnection->getConnectionEncoding());
+ }
+ return xResultSet;
+}
+/* }}} */
+
+
+/* {{{ OStatement::getConnection() -I- */
+Reference< XConnection > SAL_CALL OCommonStatement::getConnection()
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OCommonStatement::getConnection");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(rBHelper.bDisposed);
+
+ // just return(our connection here
+ return ((Reference< XConnection >)m_pConnection);
+}
+/* }}} */
+
+
+/* {{{ OStatement::getUpdateCount() -I- */
+sal_Int32 SAL_CALL OCommonStatement::getUpdateCount()
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OCommonStatement::getUpdateCount");
+ return 0;
+}
+/* }}} */
+
+
+/* {{{ OStatement::queryInterface() -I- */
+Any SAL_CALL OStatement::queryInterface(const Type & rType)
+ throw(RuntimeException)
+{
+ OSL_TRACE("OStatement::queryInterface");
+ Any aRet = ::cppu::queryInterface(rType,static_cast< XBatchExecution*> (this));
+ if (!aRet.hasValue()) {
+ aRet = OCommonStatement::queryInterface(rType);
+ }
+ return (aRet);
+}
+/* }}} */
+
+
+/* {{{ OStatement::addBatch() -I- */
+void SAL_CALL OStatement::addBatch(const OUString& sql)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OStatement::addBatch");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(rBHelper.bDisposed);
+
+ m_aBatchList.push_back(sql);
+}
+/* }}} */
+
+
+/* {{{ OStatement::executeBatch() -I- */
+Sequence< sal_Int32 > SAL_CALL OStatement::executeBatch()
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OStatement::executeBatch");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(rBHelper.bDisposed);
+
+ Sequence< sal_Int32 > aRet = Sequence< sal_Int32 >();
+ return aRet;
+}
+/* }}} */
+
+
+/* {{{ OCommonStatement::executeUpdate() -I- */
+sal_Int32 SAL_CALL OCommonStatement::executeUpdate(const OUString& sql)
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OCommonStatement::executeUpdate");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(rBHelper.bDisposed);
+ const ::rtl::OUString sSqlStatement = m_pConnection->transFormPreparedStatement(sql);
+
+ sal_Int32 affectedRows = 0;
+ try {
+ affectedRows = cppStatement->executeUpdate(OUStringToOString(sSqlStatement, m_pConnection->getConnectionEncoding()).getStr());
+ } catch (sql::SQLException &e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_pConnection->getConnectionEncoding());
+ }
+ return affectedRows;
+}
+/* }}} */
+
+
+/* {{{ OCommonStatement::getResultSet() -I- */
+Reference< XResultSet > SAL_CALL OCommonStatement::getResultSet()
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OCommonStatement::getResultSet");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(rBHelper.bDisposed);
+
+ Reference< XResultSet > xResultSet;
+ try {
+ std::auto_ptr< sql::ResultSet > rset(cppStatement->getResultSet());
+ xResultSet = new OResultSet(this, rset.get(), m_pConnection->getConnectionEncoding());
+ rset.release();
+ } catch (sql::SQLException &e) {
+ mysqlc_sdbc_driver::translateAndThrow(e, *this, m_pConnection->getConnectionEncoding());
+ }
+ return xResultSet;
+}
+/* }}} */
+
+
+/* {{{ OCommonStatement::getMoreResults() -I- */
+sal_Bool SAL_CALL OCommonStatement::getMoreResults()
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OCommonStatement::getMoreResults");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(rBHelper.bDisposed);
+
+ // if your driver supports more than only one resultset
+ // and has one more at this moment return(true
+ return (sal_False);
+}
+/* }}} */
+
+
+/* {{{ OCommonStatement::getWarnings() -I- */
+Any SAL_CALL OCommonStatement::getWarnings()
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OCommonStatement::getWarnings");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(rBHelper.bDisposed);
+
+ return makeAny(m_aLastWarning);
+}
+/* }}} */
+
+
+/* {{{ OCommonStatement::clearWarnings() -I- */
+void SAL_CALL OCommonStatement::clearWarnings()
+ throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("OCommonStatement::clearWarnings");
+ MutexGuard aGuard(m_aMutex);
+ checkDisposed(rBHelper.bDisposed);
+
+ m_aLastWarning = SQLWarning();
+}
+/* }}} */
+
+
+/* {{{ OCommonStatement::createArrayHelper() -I- */
+::cppu::IPropertyArrayHelper* OCommonStatement::createArrayHelper( ) const
+{
+ OSL_TRACE("OCommonStatement::createArrayHelper");
+ // this properties are define by the service statement
+ // they must in alphabetic order
+ Sequence< Property > aProps(10);
+ Property* pProperties = aProps.getArray();
+ sal_Int32 nPos = 0;
+ DECL_PROP0(CURSORNAME, OUString);
+ DECL_BOOL_PROP0(ESCAPEPROCESSING);
+ DECL_PROP0(FETCHDIRECTION,sal_Int32);
+ DECL_PROP0(FETCHSIZE, sal_Int32);
+ DECL_PROP0(MAXFIELDSIZE,sal_Int32);
+ DECL_PROP0(MAXROWS, sal_Int32);
+ DECL_PROP0(QUERYTIMEOUT,sal_Int32);
+ DECL_PROP0(RESULTSETCONCURRENCY,sal_Int32);
+ DECL_PROP0(RESULTSETTYPE,sal_Int32);
+ DECL_BOOL_PROP0(USEBOOKMARKS);
+
+ return new ::cppu::OPropertyArrayHelper(aProps);
+}
+/* }}} */
+
+
+/* {{{ OCommonStatement::getInfoHelper() -I- */
+::cppu::IPropertyArrayHelper & OCommonStatement::getInfoHelper()
+{
+ OSL_TRACE("OCommonStatement::getInfoHelper");
+ return(*const_cast<OCommonStatement*>(this)->getArrayHelper());
+}
+/* }}} */
+
+
+/* {{{ OCommonStatement::convertFastPropertyValue() -I- */
+sal_Bool OCommonStatement::convertFastPropertyValue(
+ Any & /* rConvertedValue */, Any & /* rOldValue */,
+ sal_Int32 /* nHandle */, const Any& /* rValue */)
+ throw (IllegalArgumentException)
+{
+ OSL_TRACE("OCommonStatement::convertFastPropertyValue");
+ sal_Bool bConverted = sal_False;
+ // here we have to try to convert
+ return bConverted;
+}
+/* }}} */
+
+
+/* {{{ OCommonStatement::setFastPropertyValue_NoBroadcast() -I- */
+void OCommonStatement::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const Any& /* rValue */)
+ throw (Exception)
+{
+ OSL_TRACE("OCommonStatement::setFastPropertyValue_NoBroadcast");
+ // set the value to what ever is nescessary
+ switch (nHandle) {
+ case PROPERTY_ID_QUERYTIMEOUT:
+ case PROPERTY_ID_MAXFIELDSIZE:
+ case PROPERTY_ID_MAXROWS:
+ case PROPERTY_ID_CURSORNAME:
+ case PROPERTY_ID_RESULTSETCONCURRENCY:
+ case PROPERTY_ID_RESULTSETTYPE:
+ case PROPERTY_ID_FETCHDIRECTION:
+ case PROPERTY_ID_FETCHSIZE:
+ case PROPERTY_ID_ESCAPEPROCESSING:
+ case PROPERTY_ID_USEBOOKMARKS:
+ default:
+ ;
+ }
+}
+/* }}} */
+
+
+/* {{{ OCommonStatement::getFastPropertyValue() -I- */
+void OCommonStatement::getFastPropertyValue(Any& _rValue, sal_Int32 nHandle) const
+{
+ OSL_TRACE("OCommonStatement::getFastPropertyValue");
+ switch (nHandle) {
+ case PROPERTY_ID_QUERYTIMEOUT:
+ case PROPERTY_ID_MAXFIELDSIZE:
+ case PROPERTY_ID_MAXROWS:
+ case PROPERTY_ID_CURSORNAME:
+ case PROPERTY_ID_RESULTSETCONCURRENCY:
+ case PROPERTY_ID_RESULTSETTYPE:
+ case PROPERTY_ID_FETCHDIRECTION:
+ case PROPERTY_ID_FETCHSIZE:
+ case PROPERTY_ID_ESCAPEPROCESSING:
+ break;
+ case PROPERTY_ID_USEBOOKMARKS:
+ _rValue <<= sal_False;
+ break;
+ default:
+ ;
+ }
+}
+/* }}} */
+
+IMPLEMENT_SERVICE_INFO(OStatement,"com.sun.star.sdbcx.OStatement","com.sun.star.sdbc.Statement");
+
+/* {{{ OCommonStatement::acquire() -I- */
+void SAL_CALL OCommonStatement::acquire()
+ throw()
+{
+ OSL_TRACE("OCommonStatement::acquire");
+ OCommonStatement_IBase::acquire();
+}
+/* }}} */
+
+
+/* {{{ OCommonStatement::release() -I- */
+void SAL_CALL OCommonStatement::release()
+ throw()
+{
+ OSL_TRACE("OCommonStatement::release");
+ relase_ChildImpl();
+}
+/* }}} */
+
+
+/* {{{ OStatement::acquire() -I- */
+void SAL_CALL OStatement::acquire()
+ throw()
+{
+ OSL_TRACE("OStatement::acquire");
+ OCommonStatement::acquire();
+}
+/* }}} */
+
+
+/* {{{ OStatement::release() -I- */
+void SAL_CALL OStatement::release()
+ throw()
+{
+ OSL_TRACE("OStatement::release");
+ OCommonStatement::release();
+}
+/* }}} */
+
+
+/* {{{ OCommonStatement::getPropertySetInfo() -I- */
+Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL OCommonStatement::getPropertySetInfo()
+ throw(RuntimeException)
+{
+ OSL_TRACE("OCommonStatement::getPropertySetInfo");
+ return(::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper()));
+}
+/* }}} */
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
diff --git a/mysqlc/source/mysqlc_statement.hxx b/mysqlc/source/mysqlc_statement.hxx
new file mode 100644
index 000000000000..e33244e987fd
--- /dev/null
+++ b/mysqlc/source/mysqlc_statement.hxx
@@ -0,0 +1,187 @@
+#ifndef MYSQLC_STATEMENT_HXX
+#define MYSQLC_STATEMENT_HXX
+
+#include "mysqlc_connection.hxx"
+#include "mysqlc_subcomponent.hxx"
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/sdbc/SQLWarning.hpp>
+#include <com/sun/star/sdbc/XBatchExecution.hpp>
+#include <com/sun/star/sdbc/XCloseable.hpp>
+#include <com/sun/star/sdbc/XMultipleResults.hpp>
+#include <com/sun/star/sdbc/XStatement.hpp>
+#include <com/sun/star/sdbc/XWarningsSupplier.hpp>
+#include <com/sun/star/util/XCancellable.hpp>
+
+#include <cppconn/statement.h>
+#include <cppuhelper/compbase5.hxx>
+#include <list>
+
+namespace connectivity
+{
+ namespace mysqlc
+ {
+ using ::com::sun::star::sdbc::SQLWarning;
+ using ::com::sun::star::sdbc::SQLException;
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::rtl::OUString;
+
+ typedef ::cppu::WeakComponentImplHelper5< ::com::sun::star::sdbc::XStatement,
+ ::com::sun::star::sdbc::XWarningsSupplier,
+ ::com::sun::star::util::XCancellable,
+ ::com::sun::star::sdbc::XCloseable,
+ ::com::sun::star::sdbc::XMultipleResults> OCommonStatement_IBase;
+
+ class OCommonStatement;
+ typedef OSubComponent< OCommonStatement, OCommonStatement_IBase > OStatement_CBase;
+
+ //**************************************************************
+ //************ Class: OCommonStatement
+ // is a base class for the normal statement and for the prepared statement
+ //**************************************************************
+ class OCommonStatement :public OBase_Mutex
+ ,public OCommonStatement_IBase
+ ,public ::cppu::OPropertySetHelper
+ ,public OPropertyArrayUsageHelper<OCommonStatement>
+ ,public OStatement_CBase
+
+ {
+ friend class OSubComponent< OCommonStatement, OCommonStatement_IBase >;
+
+ private:
+ SQLWarning m_aLastWarning;
+
+ protected:
+ ::std::list< OUString> m_aBatchList;
+
+ OConnection* m_pConnection; // The owning Connection object
+
+ sql::Statement *cppStatement;
+
+ protected:
+ void disposeResultSet();
+
+ // OPropertyArrayUsageHelper
+ ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
+
+ // OPropertySetHelper
+ ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
+ sal_Bool SAL_CALL convertFastPropertyValue(Any & rConvertedValue, Any & rOldValue,
+ sal_Int32 nHandle, const Any& rValue)
+ throw (::com::sun::star::lang::IllegalArgumentException);
+
+ void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const Any& rValue)
+ throw(::com::sun::star::uno::Exception);
+
+ void SAL_CALL getFastPropertyValue(Any& rValue, sal_Int32 nHandle) const;
+ virtual ~OCommonStatement();
+
+ protected:
+ OCommonStatement(OConnection* _pConnection, sql::Statement *_cppStatement);
+
+ public:
+ ::cppu::OBroadcastHelper& rBHelper;
+ using OCommonStatement_IBase::operator ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >;
+
+ // OComponentHelper
+ void SAL_CALL disposing(void);
+
+ // XInterface
+ void SAL_CALL release() throw();
+
+ void SAL_CALL acquire() throw();
+
+ // XInterface
+ Any SAL_CALL queryInterface(const ::com::sun::star::uno::Type & rType)
+ throw(RuntimeException);
+
+ //XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes()
+ throw(RuntimeException);
+
+ // XPropertySet
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo()
+ throw(RuntimeException);
+
+ // XStatement
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL executeQuery(const OUString& sql)
+ throw(SQLException, RuntimeException);
+
+ sal_Int32 SAL_CALL executeUpdate(const OUString& sql)
+ throw(SQLException, RuntimeException);
+
+ sal_Bool SAL_CALL execute( const OUString& sql )
+ throw(SQLException, RuntimeException);
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL getConnection()
+ throw(SQLException, RuntimeException);
+
+ // XWarningsSupplier
+ Any SAL_CALL getWarnings() throw(SQLException, RuntimeException);
+
+ void SAL_CALL clearWarnings() throw(SQLException, RuntimeException);
+
+ // XCancellable
+ void SAL_CALL cancel() throw(RuntimeException);
+
+ // XCloseable
+ void SAL_CALL close() throw(SQLException, RuntimeException);
+
+ // XMultipleResults
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getResultSet()
+ throw(SQLException, RuntimeException);
+
+ sal_Int32 SAL_CALL getUpdateCount() throw(SQLException, RuntimeException);
+
+ sal_Bool SAL_CALL getMoreResults() throw(SQLException, RuntimeException);
+
+ // other methods
+ OConnection* getOwnConnection() const { return m_pConnection;}
+
+ private:
+ using ::cppu::OPropertySetHelper::getFastPropertyValue;
+ };
+
+
+ class OStatement : public OCommonStatement,
+ public ::com::sun::star::sdbc::XBatchExecution,
+ public ::com::sun::star::lang::XServiceInfo
+
+ {
+ protected:
+ virtual ~OStatement(){}
+
+ public:
+ // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird:
+ OStatement(OConnection* _pConnection, sql::Statement *_cppStatement) : OCommonStatement(_pConnection, _cppStatement) {}
+ DECLARE_SERVICE_INFO();
+
+ Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType )
+ throw(RuntimeException);
+
+ void SAL_CALL acquire() throw();
+ void SAL_CALL release() throw();
+
+ // XBatchExecution
+ void SAL_CALL addBatch(const OUString& sql)
+ throw(SQLException, RuntimeException);
+
+ void SAL_CALL clearBatch() throw(SQLException, RuntimeException);
+
+ ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL executeBatch()
+ throw(SQLException, RuntimeException);
+
+ };
+ }
+}
+#endif // MYSQLC_STATEMENT_HXX
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
diff --git a/mysqlc/source/mysqlc_subcomponent.hxx b/mysqlc/source/mysqlc_subcomponent.hxx
new file mode 100644
index 000000000000..5d3bd2c9b4f3
--- /dev/null
+++ b/mysqlc/source/mysqlc_subcomponent.hxx
@@ -0,0 +1,255 @@
+/*************************************************************************
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2008 by Sun Microsystems, Inc.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* $RCSfile: mysqlc_subcomponent.hxx,v $
+*
+* $Revision: 1.1.2.2 $
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+************************************************************************/
+
+#ifndef _CONNECTIVITY_OSUBCOMPONENT_HXX_
+#define _CONNECTIVITY_OSUBCOMPONENT_HXX_
+
+#ifndef _CPPUHELPER_WEAK_HXX_
+#include <cppuhelper/weak.hxx>
+#endif
+#ifndef _CPPUHELPER_INTERFACECONTAINER_H_
+#include <cppuhelper/interfacecontainer.h>
+#endif
+#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_
+#include <com/sun/star/lang/DisposedException.hpp>
+#endif
+#ifndef _CPPUHELPER_PROPSHLP_HXX
+#include <cppuhelper/propshlp.hxx>
+#endif
+#ifndef _OSL_MUTEX_HXX_
+#include <osl/mutex.hxx>
+#endif
+#ifndef _OSL_DIAGNOSE_H_
+#include <osl/diagnose.h>
+#endif
+
+namespace cppu {
+ class IPropertyArrayHelper;
+}
+
+namespace com
+{
+ namespace sun
+ {
+ namespace star
+ {
+ namespace lang
+ {
+ class XComponent;
+ }
+ }
+ }
+}
+namespace connectivity
+{
+
+ namespace mysqlc
+ {
+ void release(oslInterlockedCount& _refCount,
+ ::cppu::OBroadcastHelper& rBHelper,
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface,
+ ::com::sun::star::lang::XComponent* _pObject);
+
+ void checkDisposed(sal_Bool _bThrow) throw (::com::sun::star::lang::DisposedException);
+ //************************************************************
+ // OSubComponent
+ //************************************************************
+ template <class SELF, class WEAK> class OSubComponent
+ {
+ protected:
+ // the parent must support the tunnel implementation
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xParent;
+ SELF* m_pDerivedImplementation;
+
+ public:
+ OSubComponent(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xParent,
+ SELF* _pDerivedImplementation)
+ :m_xParent(_xParent)
+ ,m_pDerivedImplementation(_pDerivedImplementation)
+ {
+ }
+
+ protected:
+ void dispose_ChildImpl()
+ {
+ ::osl::MutexGuard aGuard(m_pDerivedImplementation->rBHelper.rMutex);
+ m_xParent = NULL;
+ }
+ void relase_ChildImpl()
+ {
+ release(m_pDerivedImplementation->m_refCount,
+ m_pDerivedImplementation->rBHelper,
+ m_xParent,
+ m_pDerivedImplementation);
+
+ m_pDerivedImplementation->WEAK::release();
+ }
+ };
+
+
+ template <class TYPE>
+ class OPropertyArrayUsageHelper
+ {
+ protected:
+ static sal_Int32 s_nRefCount;
+ static ::cppu::IPropertyArrayHelper* s_pProps;
+ static ::osl::Mutex s_aMutex;
+
+ public:
+ OPropertyArrayUsageHelper();
+ virtual ~OPropertyArrayUsageHelper()
+ { // ARGHHHHHHH ..... would like to implement this in proparrhlp_impl.hxx (as we do with all other methods)
+ // but SUNPRO 5 compiler (linker) doesn't like this
+ ::osl::MutexGuard aGuard(s_aMutex);
+ OSL_ENSURE(s_nRefCount > 0, "OPropertyArrayUsageHelper::~OPropertyArrayUsageHelper : suspicious call : have a refcount of 0 !");
+ if (!--s_nRefCount)
+ {
+ delete s_pProps;
+ s_pProps = NULL;
+ }
+ }
+
+ /** call this in the getInfoHelper method of your derived class. The method returns the array helper of the
+ class, which is created if neccessary.
+ */
+ ::cppu::IPropertyArrayHelper* getArrayHelper();
+
+ protected:
+ /** used to implement the creation of the array helper which is shared amongst all instances of the class.
+ This method needs to be implemented in derived classes.
+ <BR>
+ The method gets called with s_aMutex acquired.
+ <BR>
+ as long as IPropertyArrayHelper has no virtual destructor, the implementation of ~OPropertyArrayUsageHelper
+ assumes that you created an ::cppu::OPropertyArrayHelper when deleting s_pProps.
+ @return an pointer to the newly created array helper. Must not be NULL.
+ */
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const = 0;
+ };
+
+ template<class TYPE>
+ sal_Int32 OPropertyArrayUsageHelper< TYPE >::s_nRefCount = 0;
+
+ template<class TYPE>
+ ::cppu::IPropertyArrayHelper* OPropertyArrayUsageHelper< TYPE >::s_pProps = NULL;
+
+ template<class TYPE>
+ ::osl::Mutex OPropertyArrayUsageHelper< TYPE >::s_aMutex;
+
+ //------------------------------------------------------------------
+ template <class TYPE>
+ OPropertyArrayUsageHelper<TYPE>::OPropertyArrayUsageHelper()
+ {
+ ::osl::MutexGuard aGuard(s_aMutex);
+ ++s_nRefCount;
+ }
+
+ //------------------------------------------------------------------
+ template <class TYPE>
+ ::cppu::IPropertyArrayHelper* OPropertyArrayUsageHelper<TYPE>::getArrayHelper()
+ {
+ OSL_ENSURE(s_nRefCount, "OPropertyArrayUsageHelper::getArrayHelper : suspicious call : have a refcount of 0 !");
+ if (!s_pProps) {
+ ::osl::MutexGuard aGuard(s_aMutex);
+ if (!s_pProps) {
+ s_pProps = createArrayHelper();
+ OSL_ENSURE(s_pProps, "OPropertyArrayUsageHelper::getArrayHelper : createArrayHelper returned nonsense !");
+ }
+ }
+ return s_pProps;
+ }
+
+
+ class OBase_Mutex
+ {
+ public:
+ ::osl::Mutex m_aMutex;
+ };
+
+ namespace internal
+ {
+ template <class T>
+ void implCopySequence(const T* _pSource, T*& _pDest, sal_Int32 _nSourceLen)
+ {
+ for (sal_Int32 i=0; i<_nSourceLen; ++i, ++_pSource, ++_pDest)
+ *_pDest = *_pSource;
+ }
+ }
+ //-------------------------------------------------------------------------
+ /// concat two sequences
+ template <class T>
+ ::com::sun::star::uno::Sequence<T> concatSequences(const ::com::sun::star::uno::Sequence<T>& _rLeft, const ::com::sun::star::uno::Sequence<T>& _rRight)
+ {
+ sal_Int32 nLeft(_rLeft.getLength()), nRight(_rRight.getLength());
+ const T* pLeft = _rLeft.getConstArray();
+ const T* pRight = _rRight.getConstArray();
+
+ sal_Int32 nReturnLen(nLeft + nRight);
+ ::com::sun::star::uno::Sequence<T> aReturn(nReturnLen);
+ T* pReturn = aReturn.getArray();
+
+ internal::implCopySequence(pLeft, pReturn, nLeft);
+ internal::implCopySequence(pRight, pReturn, nRight);
+
+ return aReturn;
+ }
+
+
+#define DECLARE_SERVICE_INFO() \
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException); \
+ virtual sal_Bool SAL_CALL supportsService(const ::rtl::OUString& ServiceName) throw(::com::sun::star::uno::RuntimeException); \
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException) \
+
+#define IMPLEMENT_SERVICE_INFO(classname, implasciiname, serviceasciiname) \
+ ::rtl::OUString SAL_CALL classname::getImplementationName() throw (::com::sun::star::uno::RuntimeException) \
+ { \
+ return ::rtl::OUString::createFromAscii(implasciiname); \
+ } \
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL classname::getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException) \
+ { \
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > aSupported(1); \
+ aSupported[0] = ::rtl::OUString::createFromAscii(serviceasciiname); \
+ return aSupported; \
+ } \
+ sal_Bool SAL_CALL classname::supportsService(const ::rtl::OUString& _rServiceName) throw(::com::sun::star::uno::RuntimeException) \
+ { \
+ Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames()); \
+ const ::rtl::OUString* pSupported = aSupported.getConstArray(); \
+ const ::rtl::OUString* pEnd = pSupported + aSupported.getLength(); \
+ for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported) \
+ ; \
+ return pSupported != pEnd; \
+ } \
+
+
+ }
+}
+#endif // _CONNECTIVITY_OSUBCOMPONENT_HXX_
+
diff --git a/mysqlc/source/mysqlc_types.cxx b/mysqlc/source/mysqlc_types.cxx
new file mode 100644
index 000000000000..5176452336e5
--- /dev/null
+++ b/mysqlc/source/mysqlc_types.cxx
@@ -0,0 +1,792 @@
+/*************************************************************************
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2008 by Sun Microsystems, Inc.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* $RCSfile: mysqlc_types.cxx,v $
+*
+* $Revision: 1.1.2.2 $
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+************************************************************************/
+
+#include <stdio.h>
+#include <com/sun/star/sdbc/DataType.hpp>
+#include <com/sun/star/sdbc/ColumnValue.hpp>
+#include <com/sun/star/sdbc/ColumnSearch.hpp>
+#include "mysqlc_types.hxx"
+
+using namespace com::sun::star::sdbc;
+
+TypeInfoDef mysqlc_types[] = {
+
+ // ------------- MySQL-Type: BIT. SDBC-Type: Bit -------------
+ {
+ "BIT", // Typename
+ com::sun::star::sdbc::DataType::BIT, // sdbc-type
+ 1, // Precision
+ "", // Literal prefix
+ "", // Literal suffix
+ "", // Create params
+ com::sun::star::sdbc::ColumnValue::NULLABLE, // nullable
+ sal_True, // case sensitive
+ com::sun::star::sdbc::ColumnSearch::FULL, // searchable
+ sal_False, // unsignable
+ sal_False, // fixed_prec_scale
+ sal_False, // auto_increment
+ "BIT", // local type name
+ 0, // minimum scale
+ 0, // maximum scale
+ 0, // sql data type (unsued)
+ 0, // sql datetime sub (unsued)
+ 10 // num prec radix
+ },
+
+ // ------------ MySQL-Type: BOOL. SDBC-Type: Bit -------------
+ {
+ "BOOL", // Typename
+ com::sun::star::sdbc::DataType::BIT, // sdbc-type
+ 1, // Precision
+ "", // Literal prefix
+ "", // Literal suffix
+ "", // Create params
+ com::sun::star::sdbc::ColumnValue::NULLABLE, // nullable
+ sal_True, // case sensitive
+ com::sun::star::sdbc::ColumnSearch::FULL, // searchable
+ sal_False, // unsignable
+ sal_False, // fixed_prec_scale
+ sal_False, // auto_increment
+ "BOOL", // local type name
+ 0, // minimum scale
+ 0, // maximum scale
+ 0, // sql data type (unsued)
+ 0, // sql datetime sub (unsued)
+ 10 // num prec radix
+ },
+
+ // --------- MySQL-Type: TINYINT SDBC-Type: TINYINT ----------
+ {
+ "TINYINT", // Typename
+ com::sun::star::sdbc::DataType::TINYINT, // sdbc-type
+ 3, // Precision
+ "", // Literal prefix
+ "", // Literal suffix
+ "[(M)] [UNSIGNED] [ZEROFILL]", // Create params
+ com::sun::star::sdbc::ColumnValue::NULLABLE, // nullable
+ sal_False, // case sensitive
+ com::sun::star::sdbc::ColumnSearch::FULL, // searchable
+ sal_True, // unsignable
+ sal_False, // fixed_prec_scale
+ sal_True, // auto_increment
+ "TINYINT", // local type name
+ 0, // minimum scale
+ 0, // maximum scale
+ 0, // sql data type (unsued)
+ 0, // sql datetime sub (unsued)
+ 10 // num prec radix
+ },
+
+ // ----------- MySQL-Type: BIGINT SDBC-Type: BIGINT ----------
+ {
+ "BIGINT", // Typename
+ com::sun::star::sdbc::DataType::BIGINT, // sdbc-type
+ 19, // Precision
+ "", // Literal prefix
+ "", // Literal suffix
+ "[(M)] [UNSIGNED] [ZEROFILL]", // Create params
+ com::sun::star::sdbc::ColumnValue::NULLABLE, // nullable
+ sal_False, // case sensitive
+ com::sun::star::sdbc::ColumnSearch::FULL, // searchable
+ sal_True, // unsignable
+ sal_False, // fixed_prec_scale
+ sal_True, // auto_increment
+ "BIGINT", // local type name
+ 0, // minimum scale
+ 0, // maximum scale
+ 0, // sql data type (unsued)
+ 0, // sql datetime sub (unsued)
+ 10 // num prec radix
+ },
+
+ // ----------- MySQL-Type: LONG VARBINARY SDBC-Type: LONGVARBINARY ----------
+ {
+ "LONG VARBINARY", // Typename
+ com::sun::star::sdbc::DataType::LONGVARBINARY, // sdbc-type
+ 16777215, // Precision
+ "'", // Literal prefix
+ "'", // Literal suffix
+ "", // Create params
+ com::sun::star::sdbc::ColumnValue::NULLABLE, // nullable
+ sal_True, // case sensitive
+ com::sun::star::sdbc::ColumnSearch::FULL, // searchable
+ sal_False, // unsignable
+ sal_False, // fixed_prec_scale
+ sal_False, // auto_increment
+ "LONG VARBINARY", // local type name
+ 0, // minimum scale
+ 0, // maximum scale
+ 0, // sql data type (unsued)
+ 0, // sql datetime sub (unsued)
+ 10 // num prec radix
+ },
+
+ // ----------- MySQL-Type: MEDIUMBLOB SDBC-Type: LONGVARBINARY ----------
+ {
+ "MEDIUMBLOB", // Typename
+ com::sun::star::sdbc::DataType::LONGVARBINARY, // sdbc-type
+ 16777215, // Precision
+ "'", // Literal prefix
+ "'", // Literal suffix
+ "", // Create params
+ com::sun::star::sdbc::ColumnValue::NULLABLE, // nullable
+ sal_True, // case sensitive
+ com::sun::star::sdbc::ColumnSearch::FULL, // searchable
+ sal_False, // unsignable
+ sal_False, // fixed_prec_scale
+ sal_False, // auto_increment
+ "MEDIUMBLOB", // local type name
+ 0, // minimum scale
+ 0, // maximum scale
+ 0, // sql data type (unsued)
+ 0, // sql datetime sub (unsued)
+ 10 // num prec radix
+ },
+
+ // ----------- MySQL-Type: LONGBLOB SDBC-Type: LONGVARBINARY ----------
+ {
+ "LONGBLOB", // Typename
+ com::sun::star::sdbc::DataType::LONGVARBINARY, // sdbc-type
+ 0xFFFFFFFF, // Precision
+ "'", // Literal prefix
+ "'", // Literal suffix
+ "", // Create params
+ com::sun::star::sdbc::ColumnValue::NULLABLE, // nullable
+ sal_True, // case sensitive
+ com::sun::star::sdbc::ColumnSearch::FULL, // searchable
+ sal_False, // unsignable
+ sal_False, // fixed_prec_scale
+ sal_False, // auto_increment
+ "LONGBLOB", // local type name
+ 0, // minimum scale
+ 0, // maximum scale
+ 0, // sql data type (unsued)
+ 0, // sql datetime sub (unsued)
+ 10 // num prec radix
+ },
+
+ // ----------- MySQL-Type: BLOB SDBC-Type: LONGVARBINARY ----------
+ {
+ "BLOB", // Typename
+ com::sun::star::sdbc::DataType::LONGVARBINARY, // sdbc-type
+ 0xFFFF, // Precision
+ "'", // Literal prefix
+ "'", // Literal suffix
+ "", // Create params
+ com::sun::star::sdbc::ColumnValue::NULLABLE, // nullable
+ sal_True, // case sensitive
+ com::sun::star::sdbc::ColumnSearch::FULL, // searchable
+ sal_False, // unsignable
+ sal_False, // fixed_prec_scale
+ sal_False, // auto_increment
+ "BLOB", // local type name
+ 0, // minimum scale
+ 0, // maximum scale
+ 0, // sql data type (unsued)
+ 0, // sql datetime sub (unsued)
+ 10 // num prec radix
+ },
+
+ // ----------- MySQL-Type: TINYBLOB SDBC-Type: LONGVARBINARY ----------
+ {
+ "TINYBLOB", // Typename
+ com::sun::star::sdbc::DataType::LONGVARBINARY, // sdbc-type
+ 0xFF, // Precision
+ "'", // Literal prefix
+ "'", // Literal suffix
+ "", // Create params
+ com::sun::star::sdbc::ColumnValue::NULLABLE, // nullable
+ sal_True, // case sensitive
+ com::sun::star::sdbc::ColumnSearch::FULL, // searchable
+ sal_False, // unsignable
+ sal_False, // fixed_prec_scale
+ sal_False, // auto_increment
+ "TINYBLOB", // local type name
+ 0, // minimum scale
+ 0, // maximum scale
+ 0, // sql data type (unsued)
+ 0, // sql datetime sub (unsued)
+ 10 // num prec radix
+ },
+
+ // ----------- MySQL-Type: VARBINARY SDBC-Type: VARBINARY ----------
+ {
+ "VARBINARY", // Typename
+ com::sun::star::sdbc::DataType::VARBINARY, // sdbc-type
+ 0xFF, // Precision
+ "'", // Literal prefix
+ "'", // Literal suffix
+ "(M)", // Create params
+ com::sun::star::sdbc::ColumnValue::NULLABLE, // nullable
+ sal_True, // case sensitive
+ com::sun::star::sdbc::ColumnSearch::FULL, // searchable
+ sal_False, // unsignable
+ sal_False, // fixed_prec_scale
+ sal_False, // auto_increment
+ "VARBINARY", // local type name
+ 0, // minimum scale
+ 0, // maximum scale
+ 0, // sql data type (unsued)
+ 0, // sql datetime sub (unsued)
+ 10 // num prec radix
+ },
+
+ // ----------- MySQL-Type: BINARY SDBC-Type: BINARY ----------
+ {
+ "BINARY", // Typename
+ com::sun::star::sdbc::DataType::BINARY, // sdbc-type
+ 0xFF, // Precision
+ "'", // Literal prefix
+ "'", // Literal suffix
+ "(M)", // Create params
+ com::sun::star::sdbc::ColumnValue::NULLABLE, // nullable
+ sal_True, // case sensitive
+ com::sun::star::sdbc::ColumnSearch::FULL, // searchable
+ sal_False, // unsignable
+ sal_False, // fixed_prec_scale
+ sal_False, // auto_increment
+ "VARBINARY", // local type name
+ 0, // minimum scale
+ 0, // maximum scale
+ 0, // sql data type (unsued)
+ 0, // sql datetime sub (unsued)
+ 10 // num prec radix
+ },
+
+ // ----------- MySQL-Type: LONG VARCHAR SDBC-Type: LONG VARCHAR ----------
+ {
+ "LONG VARCHAR", // Typename
+ com::sun::star::sdbc::DataType::LONGVARCHAR, // sdbc-type
+ 0xFFFFFF, // Precision
+ "'", // Literal prefix
+ "'", // Literal suffix
+ "", // Create params
+ com::sun::star::sdbc::ColumnValue::NULLABLE, // nullable
+ sal_False, // case sensitive
+ com::sun::star::sdbc::ColumnSearch::FULL, // searchable
+ sal_False, // unsignable
+ sal_False, // fixed_prec_scale
+ sal_False, // auto_increment
+ "LONG VARCHAR", // local type name
+ 0, // minimum scale
+ 0, // maximum scale
+ 0, // sql data type (unsued)
+ 0, // sql datetime sub (unsued)
+ 10 // num prec radix
+ },
+
+ // ----------- MySQL-Type: MEDIUMTEXT SDBC-Type: LONG VARCHAR ----------
+ {
+ "MEDIUMTEXT", // Typename
+ com::sun::star::sdbc::DataType::LONGVARCHAR, // sdbc-type
+ 0xFFFFFF, // Precision
+ "'", // Literal prefix
+ "'", // Literal suffix
+ "", // Create params
+ com::sun::star::sdbc::ColumnValue::NULLABLE, // nullable
+ sal_False, // case sensitive
+ com::sun::star::sdbc::ColumnSearch::FULL, // searchable
+ sal_False, // unsignable
+ sal_False, // fixed_prec_scale
+ sal_False, // auto_increment
+ "MEDIUMTEXT", // local type name
+ 0, // minimum scale
+ 0, // maximum scale
+ 0, // sql data type (unsued)
+ 0, // sql datetime sub (unsued)
+ 10 // num prec radix
+ },
+
+ // ----------- MySQL-Type: LONGTEXT SDBC-Type: LONG VARCHAR ----------
+ {
+ "LONGTEXT", // Typename
+ com::sun::star::sdbc::DataType::LONGVARCHAR, // sdbc-type
+ 0xFFFFFF, // Precision
+ "'", // Literal prefix
+ "'", // Literal suffix
+ "", // Create params
+ com::sun::star::sdbc::ColumnValue::NULLABLE, // nullable
+ sal_False, // case sensitive
+ com::sun::star::sdbc::ColumnSearch::FULL, // searchable
+ sal_False, // unsignable
+ sal_False, // fixed_prec_scale
+ sal_False, // auto_increment
+ "LONGTEXT", // local type name
+ 0, // minimum scale
+ 0, // maximum scale
+ 0, // sql data type (unsued)
+ 0, // sql datetime sub (unsued)
+ 10 // num prec radix
+ },
+
+ // ----------- MySQL-Type: TEXT SDBC-Type: LONG VARCHAR ----------
+ {
+ "TEXT", // Typename
+ com::sun::star::sdbc::DataType::LONGVARCHAR, // sdbc-type
+ 0xFFFF, // Precision
+ "'", // Literal prefix
+ "'", // Literal suffix
+ "", // Create params
+ com::sun::star::sdbc::ColumnValue::NULLABLE, // nullable
+ sal_False, // case sensitive
+ com::sun::star::sdbc::ColumnSearch::FULL, // searchable
+ sal_False, // unsignable
+ sal_False, // fixed_prec_scale
+ sal_False, // auto_increment
+ "TEXT", // local type name
+ 0, // minimum scale
+ 0, // maximum scale
+ 0, // sql data type (unsued)
+ 0, // sql datetime sub (unsued)
+ 10 // num prec radix
+ },
+
+ // ----------- MySQL-Type: TINYTEXT SDBC-Type: LONG VARCHAR ----------
+ {
+ "TINYTEXT", // Typename
+ com::sun::star::sdbc::DataType::LONGVARCHAR, // sdbc-type
+ 0xFF, // Precision
+ "'", // Literal prefix
+ "'", // Literal suffix
+ "", // Create params
+ com::sun::star::sdbc::ColumnValue::NULLABLE, // nullable
+ sal_False, // case sensitive
+ com::sun::star::sdbc::ColumnSearch::FULL, // searchable
+ sal_False, // unsignable
+ sal_False, // fixed_prec_scale
+ sal_False, // auto_increment
+ "TINYTEXT", // local type name
+ 0, // minimum scale
+ 0, // maximum scale
+ 0, // sql data type (unsued)
+ 0, // sql datetime sub (unsued)
+ 10 // num prec radix
+ },
+
+ // ----------- MySQL-Type: CHAR SDBC-Type: CHAR ----------
+ {
+ "CHAR", // Typename
+ com::sun::star::sdbc::DataType::CHAR, // sdbc-type
+ 0xFF, // Precision
+ "'", // Literal prefix
+ "'", // Literal suffix
+ "(M)", // Create params
+ com::sun::star::sdbc::ColumnValue::NULLABLE, // nullable
+ sal_False, // case sensitive
+ com::sun::star::sdbc::ColumnSearch::FULL, // searchable
+ sal_False, // unsignable
+ sal_False, // fixed_prec_scale
+ sal_False, // auto_increment
+ "NUMERIC", // local type name
+ 0, // minimum scale
+ 0, // maximum scale
+ 0, // sql data type (unsued)
+ 0, // sql datetime sub (unsued)
+ 10 // num prec radix
+ },
+
+ // ----------- MySQL-Type: DECIMAL SDBC-Type: DECIMAL ----------
+ {
+ "DECIMAL", // Typename
+ com::sun::star::sdbc::DataType::DECIMAL, // sdbc-type
+ 17, // Precision
+ "", // Literal prefix
+ "", // Literal suffix
+ "[(M[,D])] [ZEROFILL]", // Create params
+ com::sun::star::sdbc::ColumnValue::NULLABLE, // nullable
+ sal_False, // case sensitive
+ com::sun::star::sdbc::ColumnSearch::FULL, // searchable
+ sal_False, // unsignable
+ sal_False, // fixed_prec_scale
+ sal_True, // auto_increment
+ "DECIMAL", // local type name
+ -308, // minimum scale
+ 308, // maximum scale
+ 0, // sql data type (unsued)
+ 0, // sql datetime sub (unsued)
+ 10 // num prec radix
+ },
+
+ // ----------- MySQL-Type: NUMERIC SDBC-Type: NUMERIC ----------
+ {
+ "NUMERIC", // Typename
+ com::sun::star::sdbc::DataType::NUMERIC, // sdbc-type
+ 17, // Precision
+ "", // Literal prefix
+ "", // Literal suffix
+ "[(M[,D])] [ZEROFILL]", // Create params
+ com::sun::star::sdbc::ColumnValue::NULLABLE, // nullable
+ sal_False, // case sensitive
+ com::sun::star::sdbc::ColumnSearch::FULL, // searchable
+ sal_False, // unsignable
+ sal_False, // fixed_prec_scale
+ sal_True, // auto_increment
+ "NUMERIC", // local type name
+ -308, // minimum scale
+ 308, // maximum scale
+ 0, // sql data type (unsued)
+ 0, // sql datetime sub (unsued)
+ 10 // num prec radix
+ },
+
+ // ----------- MySQL-Type: INTEGER SDBC-Type: INTEGER ----------
+ {
+ "INTEGER", // Typename
+ com::sun::star::sdbc::DataType::INTEGER, // sdbc-type
+ 10, // Precision
+ "", // Literal prefix
+ "", // Literal suffix
+ "[(M)] [UNSIGNED] [ZEROFILL]", // Create params
+ com::sun::star::sdbc::ColumnValue::NULLABLE, // nullable
+ sal_False, // case sensitive
+ com::sun::star::sdbc::ColumnSearch::FULL, // searchable
+ sal_True, // unsignable
+ sal_False, // fixed_prec_scale
+ sal_True, // auto_increment
+ "INTEGER", // local type name
+ 0, // minimum scale
+ 0, // maximum scale
+ 0, // sql data type (unsued)
+ 0, // sql datetime sub (unsued)
+ 10 // num prec radix
+ },
+
+ // ----------- MySQL-Type: INT SDBC-Type: INTEGER ----------
+ {
+ "INT", // Typename
+ com::sun::star::sdbc::DataType::INTEGER, // sdbc-type
+ 10, // Precision
+ "", // Literal prefix
+ "", // Literal suffix
+ "[(M)] [UNSIGNED] [ZEROFILL]", // Create params
+ com::sun::star::sdbc::ColumnValue::NULLABLE, // nullable
+ sal_False, // case sensitive
+ com::sun::star::sdbc::ColumnSearch::FULL, // searchable
+ sal_True, // unsignable
+ sal_False, // fixed_prec_scale
+ sal_True, // auto_increment
+ "INT", // local type name
+ 0, // minimum scale
+ 0, // maximum scale
+ 0, // sql data type (unsued)
+ 0, // sql datetime sub (unsued)
+ 10 // num prec radix
+ },
+
+ // ----------- MySQL-Type: MEDIUMINT SDBC-Type: INTEGER ----------
+ {
+ "MEDIUMINT", // Typename
+ com::sun::star::sdbc::DataType::INTEGER, // sdbc-type
+ 7, // Precision
+ "", // Literal prefix
+ "", // Literal suffix
+ "[(M)] [UNSIGNED] [ZEROFILL]", // Create params
+ com::sun::star::sdbc::ColumnValue::NULLABLE, // nullable
+ sal_False, // case sensitive
+ com::sun::star::sdbc::ColumnSearch::FULL, // searchable
+ sal_True, // unsignable
+ sal_False, // fixed_prec_scale
+ sal_True, // auto_increment
+ "MEDIUMINT", // local type name
+ 0, // minimum scale
+ 0, // maximum scale
+ 0, // sql data type (unsued)
+ 0, // sql datetime sub (unsued)
+ 10 // num prec radix
+ },
+
+ // ----------- MySQL-Type: SMALLINT SDBC-Type: INTEGER ----------
+ {
+ "SMALLINT", // Typename
+ com::sun::star::sdbc::DataType::SMALLINT, // sdbc-type
+ 5, // Precision
+ "", // Literal prefix
+ "", // Literal suffix
+ "[(M)] [UNSIGNED] [ZEROFILL]", // Create params
+ com::sun::star::sdbc::ColumnValue::NULLABLE, // nullable
+ sal_False, // case sensitive
+ com::sun::star::sdbc::ColumnSearch::FULL, // searchable
+ sal_True, // unsignable
+ sal_False, // fixed_prec_scale
+ sal_True, // auto_increment
+ "SMALLINT", // local type name
+ 0, // minimum scale
+ 0, // maximum scale
+ 0, // sql data type (unsued)
+ 0, // sql datetime sub (unsued)
+ 10 // num prec radix
+ },
+
+ // ----------- MySQL-Type: FLOAT SDBC-Type: REAL ----------
+ {
+ "FLOAT", // Typename
+ com::sun::star::sdbc::DataType::REAL, // sdbc-type
+ 10, // Precision
+ "", // Literal prefix
+ "", // Literal suffix
+ "[(M,D)] [ZEROFILL]", // Create params
+ com::sun::star::sdbc::ColumnValue::NULLABLE, // nullable
+ sal_False, // case sensitive
+ com::sun::star::sdbc::ColumnSearch::FULL, // searchable
+ sal_False, // unsignable
+ sal_False, // fixed_prec_scale
+ sal_True, // auto_increment
+ "FLOAT", // local type name
+ -38, // minimum scale
+ 38, // maximum scale
+ 0, // sql data type (unsued)
+ 0, // sql datetime sub (unsued)
+ 10 // num prec radix
+ },
+
+ // ----------- MySQL-Type: DOUBLE SDBC-Type: DOUBLE ----------
+ {
+ "DOUBLE", // Typename
+ com::sun::star::sdbc::DataType::DOUBLE, // sdbc-type
+ 17, // Precision
+ "", // Literal prefix
+ "", // Literal suffix
+ "[(M,D)] [ZEROFILL]", // Create params
+ com::sun::star::sdbc::ColumnValue::NULLABLE, // nullable
+ sal_False, // case sensitive
+ com::sun::star::sdbc::ColumnSearch::FULL, // searchable
+ sal_False, // unsignable
+ sal_False, // fixed_prec_scale
+ sal_True, // auto_increment
+ "DOUBLE", // local type name
+ -308, // minimum scale
+ 308, // maximum scale
+ 0, // sql data type (unsued)
+ 0, // sql datetime sub (unsued)
+ 10 // num prec radix
+ },
+
+ // ----------- MySQL-Type: DOUBLE PRECISION SDBC-Type: DOUBLE ----------
+ {
+ "DOUBLE PRECISION", // Typename
+ com::sun::star::sdbc::DataType::DOUBLE, // sdbc-type
+ 17, // Precision
+ "", // Literal prefix
+ "", // Literal suffix
+ "[(M,D)] [ZEROFILL]", // Create params
+ com::sun::star::sdbc::ColumnValue::NULLABLE, // nullable
+ sal_False, // case sensitive
+ com::sun::star::sdbc::ColumnSearch::FULL, // searchable
+ sal_False, // unsignable
+ sal_False, // fixed_prec_scale
+ sal_True, // auto_increment
+ "DOUBLE PRECISION", // local type name
+ -308, // minimum scale
+ 308, // maximum scale
+ 0, // sql data type (unsued)
+ 0, // sql datetime sub (unsued)
+ 10 // num prec radix
+ },
+
+ // ----------- MySQL-Type: REAL SDBC-Type: DOUBLE ----------
+ {
+ "REAL", // Typename
+ com::sun::star::sdbc::DataType::DOUBLE, // sdbc-type
+ 17, // Precision
+ "", // Literal prefix
+ "", // Literal suffix
+ "[(M,D)] [ZEROFILL]", // Create params
+ com::sun::star::sdbc::ColumnValue::NULLABLE, // nullable
+ sal_False, // case sensitive
+ com::sun::star::sdbc::ColumnSearch::FULL, // searchable
+ sal_False, // unsignable
+ sal_False, // fixed_prec_scale
+ sal_True, // auto_increment
+ "REAL", // local type name
+ -308, // minimum scale
+ 308, // maximum scale
+ 0, // sql data type (unsued)
+ 0, // sql datetime sub (unsued)
+ 10 // num prec radix
+ },
+
+ // ----------- MySQL-Type: VARCHAR SDBC-Type: VARCHAR ----------
+ {
+ "VARCHAR", // Typename
+ com::sun::star::sdbc::DataType::VARCHAR, // sdbc-type
+ 255, // Precision
+ "'", // Literal prefix
+ "'", // Literal suffix
+ "(M)", // Create params
+ com::sun::star::sdbc::ColumnValue::NULLABLE, // nullable
+ sal_False, // case sensitive
+ com::sun::star::sdbc::ColumnSearch::FULL, // searchable
+ sal_False, // unsignable
+ sal_False, // fixed_prec_scale
+ sal_False, // auto_increment
+ "VARCHAR", // local type name
+ 0, // minimum scale
+ 0, // maximum scale
+ 0, // sql data type (unsued)
+ 0, // sql datetime sub (unsued)
+ 10 // num prec radix
+ },
+
+ // ----------- MySQL-Type: ENUM SDBC-Type: VARCHAR ----------
+ {
+ "ENUM", // Typename
+ com::sun::star::sdbc::DataType::VARCHAR, // sdbc-type
+ 0xFFFF, // Precision
+ "'", // Literal prefix
+ "'", // Literal suffix
+ "", // Create params
+ com::sun::star::sdbc::ColumnValue::NULLABLE, // nullable
+ sal_False, // case sensitive
+ com::sun::star::sdbc::ColumnSearch::FULL, // searchable
+ sal_False, // unsignable
+ sal_False, // fixed_prec_scale
+ sal_False, // auto_increment
+ "ENUM", // local type name
+ 0, // minimum scale
+ 0, // maximum scale
+ 0, // sql data type (unsued)
+ 0, // sql datetime sub (unsued)
+ 10 // num prec radix
+ },
+
+ // ----------- MySQL-Type: SET SDBC-Type: VARCHAR ----------
+ {
+ "SET", // Typename
+ com::sun::star::sdbc::DataType::VARCHAR, // sdbc-type
+ 64, // Precision
+ "'", // Literal prefix
+ "'", // Literal suffix
+ "", // Create params
+ com::sun::star::sdbc::ColumnValue::NULLABLE, // nullable
+ sal_False, // case sensitive
+ com::sun::star::sdbc::ColumnSearch::FULL, // searchable
+ sal_False, // unsignable
+ sal_False, // fixed_prec_scale
+ sal_False, // auto_increment
+ "SET", // local type name
+ 0, // minimum scale
+ 0, // maximum scale
+ 0, // sql data type (unsued)
+ 0, // sql datetime sub (unsued)
+ 10 // num prec radix
+ },
+
+ // ----------- MySQL-Type: DATE SDBC-Type: DATE ----------
+ {
+ "DATE", // Typename
+ com::sun::star::sdbc::DataType::DATE, // sdbc-type
+ 0, // Precision
+ "'", // Literal prefix
+ "'", // Literal suffix
+ "", // Create params
+ com::sun::star::sdbc::ColumnValue::NULLABLE, // nullable
+ sal_False, // case sensitive
+ com::sun::star::sdbc::ColumnSearch::FULL, // searchable
+ sal_False, // unsignable
+ sal_False, // fixed_prec_scale
+ sal_False, // auto_increment
+ "DATE", // local type name
+ 0, // minimum scale
+ 0, // maximum scale
+ 0, // sql data type (unsued)
+ 0, // sql datetime sub (unsued)
+ 10 // num prec radix
+ },
+
+ // ----------- MySQL-Type: TIME SDBC-Type: TIME ----------
+ {
+ "TIME", // Typename
+ com::sun::star::sdbc::DataType::TIME, // sdbc-type
+ 0, // Precision
+ "'", // Literal prefix
+ "'", // Literal suffix
+ "", // Create params
+ com::sun::star::sdbc::ColumnValue::NULLABLE, // nullable
+ sal_False, // case sensitive
+ com::sun::star::sdbc::ColumnSearch::FULL, // searchable
+ sal_False, // unsignable
+ sal_False, // fixed_prec_scale
+ sal_False, // auto_increment
+ "TIME", // local type name
+ 0, // minimum scale
+ 0, // maximum scale
+ 0, // sql data type (unsued)
+ 0, // sql datetime sub (unsued)
+ 10 // num prec radix
+ },
+
+ // ----------- MySQL-Type: DATETIME SDBC-Type: TIMESTAMP ----------
+ {
+ "DATETIME", // Typename
+ com::sun::star::sdbc::DataType::TIMESTAMP, // sdbc-type
+ 0, // Precision
+ "'", // Literal prefix
+ "'", // Literal suffix
+ "", // Create params
+ com::sun::star::sdbc::ColumnValue::NULLABLE, // nullable
+ sal_False, // case sensitive
+ com::sun::star::sdbc::ColumnSearch::FULL, // searchable
+ sal_False, // unsignable
+ sal_False, // fixed_prec_scale
+ sal_False, // auto_increment
+ "DATETIME", // local type name
+ 0, // minimum scale
+ 0, // maximum scale
+ 0, // sql data type (unsued)
+ 0, // sql datetime sub (unsued)
+ 10 // num prec radix
+ },
+
+ // ----------- MySQL-Type: TIMESTAMP SDBC-Type: TIMESTAMP ----------
+ {
+ "TIMESTAMP", // Typename
+ com::sun::star::sdbc::DataType::TIMESTAMP, // sdbc-type
+ 0, // Precision
+ "'", // Literal prefix
+ "'", // Literal suffix
+ "[(M)]", // Create params
+ com::sun::star::sdbc::ColumnValue::NULLABLE, // nullable
+ sal_False, // case sensitive
+ com::sun::star::sdbc::ColumnSearch::FULL, // searchable
+ sal_False, // unsignable
+ sal_False, // fixed_prec_scale
+ sal_False, // auto_increment
+ "TIMESTAMP", // local type name
+ 0, // minimum scale
+ 0, // maximum scale
+ 0, // sql data type (unsued)
+ 0, // sql datetime sub (unsued)
+ 10 // num prec radix
+ },
+
+ // ----------- MySQL-Type: TIMESTAMP SDBC-Type: TIMESTAMP ----------
+ {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ }
+};
diff --git a/mysqlc/source/mysqlc_types.hxx b/mysqlc/source/mysqlc_types.hxx
new file mode 100644
index 000000000000..22c4135fbd8d
--- /dev/null
+++ b/mysqlc/source/mysqlc_types.hxx
@@ -0,0 +1,56 @@
+/*************************************************************************
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2008 by Sun Microsystems, Inc.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* $RCSfile: mysqlc_types.hxx,v $
+*
+* $Revision: 1.1.2.2 $
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+************************************************************************/
+
+#ifndef MYSQLC_TYPES_HXX
+#define MYSQLC_TYPES_HXX
+
+struct TypeInfoDef {
+ const char *typeName;
+ sal_Int32 dataType;
+ sal_Int32 precision;
+ const char *literalPrefix;
+ const char *literalSuffix;
+ const char *createParams;
+ sal_Int16 nullable;
+ sal_Bool caseSensitive;
+ sal_Int16 searchable;
+ sal_Bool isUnsigned;
+ sal_Bool fixedPrecScale;
+ sal_Bool autoIncrement;
+ const char *localTypeName;
+ sal_Int32 minScale;
+ sal_Int32 maxScale;
+ sal_Int32 sqlDataType;
+ sal_Int32 sqlDateTimeSub;
+ sal_Int32 numPrecRadix;
+};
+
+extern TypeInfoDef mysqlc_types[];
+
+#endif /* MYSQLC_TYPES_HXX */
diff --git a/mysqlc/source/registry/data/org/openoffice/Office/DataAccess/Drivers.xcu b/mysqlc/source/registry/data/org/openoffice/Office/DataAccess/Drivers.xcu
new file mode 100644
index 000000000000..3c076a4a3a7a
--- /dev/null
+++ b/mysqlc/source/registry/data/org/openoffice/Office/DataAccess/Drivers.xcu
@@ -0,0 +1,103 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--***********************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: DataAccess.xcu,v $
+ * $Revision: 1.27 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************ -->
+<oor:component-data oor:name="Drivers" oor:package="org.openoffice.Office.DataAccess" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <node oor:name="Installed">
+ <node oor:name="sdbc:mysqlc:*" oor:op="replace">
+ <prop oor:name="Driver">
+ <value>com.sun.star.comp.sdbc.mysqlc.MysqlCDriver</value>
+ </prop>
+ <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
+ <value xml:lang="en-US">MySQL (Connector/OOo)</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>
+ <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>
+ </node>
+ </node>
+</oor:component-data>
diff --git a/mysqlc/version.mk b/mysqlc/version.mk
new file mode 100644
index 000000000000..81a2cfd23da8
--- /dev/null
+++ b/mysqlc/version.mk
@@ -0,0 +1,38 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2008 by Sun Microsystems, Inc.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+MYSQLC_VERSION_MAJOR=1
+MYSQLC_VERSION_MINOR=0
+MYSQLC_VERSION_MICRO=1
+
+# the title, as displayed in the Extension Manager
+MYSQLC_TITLE=MySQL Connector for OpenOffice.org
+
+# the status of the extension
+# if this is different from "final", it will be appended to the title displayed in the Extension Manager
+# and also added to the file name of the resulting .oxt file
+MYSQLC_STATUS=Alpha