summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2015-03-25 12:46:55 +0100
committerStephan Bergmann <sbergman@redhat.com>2015-03-25 12:46:55 +0100
commitd081dda43f393ad8a47bdc4b831bcf59b1d670d0 (patch)
tree4853371b493f08f627515a1b88d7d2b448e2022c
parent3dad00879295c04d03f8a5eaeff6794d36ea6d07 (diff)
loplugin:constantfunction
Change-Id: I368de78b99369982cd17a8e7ac8c36b4e7e60b41
-rw-r--r--mysqlc/Library_mysqlc.mk1
-rw-r--r--mysqlc/source/mysqlc_connection.cxx2
-rw-r--r--mysqlc/source/mysqlc_driver.hxx2
-rw-r--r--mysqlc/source/mysqlc_propertyids.cxx191
-rw-r--r--mysqlc/source/mysqlc_propertyids.hxx35
-rw-r--r--mysqlc/source/mysqlc_resultset.cxx10
-rw-r--r--mysqlc/source/mysqlc_statement.cxx20
7 files changed, 17 insertions, 244 deletions
diff --git a/mysqlc/Library_mysqlc.mk b/mysqlc/Library_mysqlc.mk
index bc26eaf2ccd5..adb2111d690a 100644
--- a/mysqlc/Library_mysqlc.mk
+++ b/mysqlc/Library_mysqlc.mk
@@ -52,7 +52,6 @@ $(eval $(call gb_Library_add_exception_objects,mysqlc,\
mysqlc/source/mysqlc_databasemetadata \
mysqlc/source/mysqlc_types \
mysqlc/source/mysqlc_general \
- mysqlc/source/mysqlc_propertyids \
))
$(eval $(call gb_Library_set_componentfile,mysqlc,mysqlc/source/mysqlc))
diff --git a/mysqlc/source/mysqlc_connection.cxx b/mysqlc/source/mysqlc_connection.cxx
index a47ad727ede0..42df27df3017 100644
--- a/mysqlc/source/mysqlc_connection.cxx
+++ b/mysqlc/source/mysqlc_connection.cxx
@@ -103,7 +103,7 @@ void OConnection::construct(const rtl::OUString& url, const Sequence< PropertyVa
sal_Int32 nPort = 3306;
rtl::OUString aDbName;
- m_settings.encoding = m_rDriver.getDefaultEncoding();
+ m_settings.encoding = MysqlCDriver::getDefaultEncoding();
m_settings.quoteIdentifier.clear();
// parse url. Url has the following format:
diff --git a/mysqlc/source/mysqlc_driver.hxx b/mysqlc/source/mysqlc_driver.hxx
index 60bafc2387b4..21b299812dcb 100644
--- a/mysqlc/source/mysqlc_driver.hxx
+++ b/mysqlc/source/mysqlc_driver.hxx
@@ -102,7 +102,7 @@ namespace connectivity
inline Reference< ::com::sun::star::lang::XMultiServiceFactory > getFactory() const { return m_xFactory; }
- rtl_TextEncoding getDefaultEncoding() { return RTL_TEXTENCODING_UTF8; }
+ static rtl_TextEncoding getDefaultEncoding() { return RTL_TEXTENCODING_UTF8; }
private:
void impl_initCppConn_lck_throw();
diff --git a/mysqlc/source/mysqlc_propertyids.cxx b/mysqlc/source/mysqlc_propertyids.cxx
deleted file mode 100644
index 0e88419649a1..000000000000
--- a/mysqlc/source/mysqlc_propertyids.cxx
+++ /dev/null
@@ -1,191 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <osl/diagnose.h>
-#include "mysqlc_propertyids.hxx"
-
-
-namespace connectivity
-{
-namespace mysqlc
-{
-const sal_Char* getPROPERTY_QUERYTIMEOUT() { return "QueryTimeOut"; }
-const sal_Char* getPROPERTY_MAXFIELDSIZE() { return "MaxFieldSize"; }
-const sal_Char* getPROPERTY_MAXROWS() { return "MaxRows"; }
-const sal_Char* getPROPERTY_CURSORNAME() { return "CursorName"; }
-const sal_Char* getPROPERTY_RESULTSETCONCURRENCY() { return "ResultSetConcurrency"; }
-const sal_Char* getPROPERTY_RESULTSETTYPE() { return "ResultSetType"; }
-const sal_Char* getPROPERTY_FETCHDIRECTION() { return "FetchDirection"; }
-const sal_Char* getPROPERTY_FETCHSIZE() { return "FetchSize"; }
-const sal_Char* getPROPERTY_ESCAPEPROCESSING() { return "EscapeProcessing"; }
-const sal_Char* getPROPERTY_USEBOOKMARKS() { return "UseBookmarks"; }
-
-const sal_Char* getPROPERTY_NAME() { return "Name"; }
-const sal_Char* getPROPERTY_TYPE() { return "Type"; }
-const sal_Char* getPROPERTY_TYPENAME() { return "TypeName"; }
-const sal_Char* getPROPERTY_PRECISION() { return "Precision"; }
-const sal_Char* getPROPERTY_SCALE() { return "Scale"; }
-const sal_Char* getPROPERTY_ISNULLABLE() { return "IsNullable"; }
-const sal_Char* getPROPERTY_ISAUTOINCREMENT() { return "IsAutoIncrement"; }
-const sal_Char* getPROPERTY_ISROWVERSION() { return "IsRowVersion"; }
-const sal_Char* getPROPERTY_DESCRIPTION() { 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()
-{
- ::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);
- }
- }
-}
-
-rtl::OUString OPropertyMap::getNameByIndex(sal_Int32 idx) const
-{
- rtl::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,
-};
-
-rtl::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
- */
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/mysqlc/source/mysqlc_propertyids.hxx b/mysqlc/source/mysqlc_propertyids.hxx
index a2295a642abe..6c37b4da25a9 100644
--- a/mysqlc/source/mysqlc_propertyids.hxx
+++ b/mysqlc/source/mysqlc_propertyids.hxx
@@ -29,41 +29,6 @@ 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,
diff --git a/mysqlc/source/mysqlc_resultset.cxx b/mysqlc/source/mysqlc_resultset.cxx
index bc76f7d55990..a71221ee283a 100644
--- a/mysqlc/source/mysqlc_resultset.cxx
+++ b/mysqlc/source/mysqlc_resultset.cxx
@@ -1105,13 +1105,13 @@ IPropertyArrayHelper * OResultSet::createArrayHelper() const
Sequence< Property > aProps(5);
Property* pProperties = aProps.getArray();
sal_Int32 nPos = 0;
- pProperties[nPos++] = Property(OPropertyMap::getPropMap().getNameByIndex(PROPERTY_ID_FETCHDIRECTION), PROPERTY_ID_FETCHDIRECTION, cppu::UnoType<sal_Int32>::get(), 0);
- pProperties[nPos++] = Property(OPropertyMap::getPropMap().getNameByIndex(PROPERTY_ID_FETCHSIZE), PROPERTY_ID_FETCHSIZE, cppu::UnoType<sal_Int32>::get(), 0);
- pProperties[nPos++] = Property(OPropertyMap::getPropMap().getNameByIndex(PROPERTY_ID_ISBOOKMARKABLE),
+ pProperties[nPos++] = Property("FetchDirection", PROPERTY_ID_FETCHDIRECTION, cppu::UnoType<sal_Int32>::get(), 0);
+ pProperties[nPos++] = Property("FetchSize", PROPERTY_ID_FETCHSIZE, cppu::UnoType<sal_Int32>::get(), 0);
+ pProperties[nPos++] = Property("IsBookmarkable",
PROPERTY_ID_ISBOOKMARKABLE, ::getBooleanCppuType(), PropertyAttribute::READONLY);
- pProperties[nPos++] = Property(OPropertyMap::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETCONCURRENCY),
+ pProperties[nPos++] = Property("ResultSetConcurrency",
PROPERTY_ID_RESULTSETCONCURRENCY, cppu::UnoType<sal_Int32>::get(), PropertyAttribute::READONLY);
- pProperties[nPos++] = Property(OPropertyMap::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETTYPE),
+ pProperties[nPos++] = Property("ResultSetType",
PROPERTY_ID_RESULTSETTYPE, cppu::UnoType<sal_Int32>::get(), PropertyAttribute::READONLY);
return new OPropertyArrayHelper(aProps);
diff --git a/mysqlc/source/mysqlc_statement.cxx b/mysqlc/source/mysqlc_statement.cxx
index ebb84d401eb0..934f56f4f030 100644
--- a/mysqlc/source/mysqlc_statement.cxx
+++ b/mysqlc/source/mysqlc_statement.cxx
@@ -310,16 +310,16 @@ void SAL_CALL OCommonStatement::clearWarnings()
Sequence< Property > aProps(10);
Property* pProperties = aProps.getArray();
sal_Int32 nPos = 0;
- pProperties[nPos++] = Property(OPropertyMap::getPropMap().getNameByIndex(PROPERTY_ID_CURSORNAME), PROPERTY_ID_CURSORNAME, cppu::UnoType<rtl::OUString>::get(), 0);
- pProperties[nPos++] = Property(OPropertyMap::getPropMap().getNameByIndex(PROPERTY_ID_ESCAPEPROCESSING), PROPERTY_ID_ESCAPEPROCESSING, ::getBooleanCppuType(), 0);
- pProperties[nPos++] = Property(OPropertyMap::getPropMap().getNameByIndex(PROPERTY_ID_FETCHDIRECTION), PROPERTY_ID_FETCHDIRECTION, cppu::UnoType<sal_Int32>::get(), 0);
- pProperties[nPos++] = Property(OPropertyMap::getPropMap().getNameByIndex(PROPERTY_ID_FETCHSIZE), PROPERTY_ID_FETCHSIZE, cppu::UnoType<sal_Int32>::get(), 0);
- pProperties[nPos++] = Property(OPropertyMap::getPropMap().getNameByIndex(PROPERTY_ID_MAXFIELDSIZE), PROPERTY_ID_MAXFIELDSIZE, cppu::UnoType<sal_Int32>::get(), 0);
- pProperties[nPos++] = Property(OPropertyMap::getPropMap().getNameByIndex(PROPERTY_ID_MAXROWS), PROPERTY_ID_MAXROWS, cppu::UnoType<sal_Int32>::get(), 0);
- pProperties[nPos++] = Property(OPropertyMap::getPropMap().getNameByIndex(PROPERTY_ID_QUERYTIMEOUT), PROPERTY_ID_QUERYTIMEOUT, cppu::UnoType<sal_Int32>::get(), 0);
- pProperties[nPos++] = Property(OPropertyMap::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETCONCURRENCY), PROPERTY_ID_RESULTSETCONCURRENCY, cppu::UnoType<sal_Int32>::get(), 0);
- pProperties[nPos++] = Property(OPropertyMap::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETTYPE), PROPERTY_ID_RESULTSETTYPE, cppu::UnoType<sal_Int32>::get(), 0);
- pProperties[nPos++] = Property(OPropertyMap::getPropMap().getNameByIndex(PROPERTY_ID_USEBOOKMARKS), PROPERTY_ID_USEBOOKMARKS, ::getBooleanCppuType(), 0);
+ pProperties[nPos++] = Property("CursorName", PROPERTY_ID_CURSORNAME, cppu::UnoType<rtl::OUString>::get(), 0);
+ pProperties[nPos++] = Property("EscapeProcessing", PROPERTY_ID_ESCAPEPROCESSING, ::getBooleanCppuType(), 0);
+ pProperties[nPos++] = Property("FetchDirection", PROPERTY_ID_FETCHDIRECTION, cppu::UnoType<sal_Int32>::get(), 0);
+ pProperties[nPos++] = Property("FetchSize", PROPERTY_ID_FETCHSIZE, cppu::UnoType<sal_Int32>::get(), 0);
+ pProperties[nPos++] = Property("MaxFieldSize", PROPERTY_ID_MAXFIELDSIZE, cppu::UnoType<sal_Int32>::get(), 0);
+ pProperties[nPos++] = Property("MaxRows", PROPERTY_ID_MAXROWS, cppu::UnoType<sal_Int32>::get(), 0);
+ pProperties[nPos++] = Property("QueryTimeOut", PROPERTY_ID_QUERYTIMEOUT, cppu::UnoType<sal_Int32>::get(), 0);
+ pProperties[nPos++] = Property("ResultSetConcurrency", PROPERTY_ID_RESULTSETCONCURRENCY, cppu::UnoType<sal_Int32>::get(), 0);
+ pProperties[nPos++] = Property("ResultSetType", PROPERTY_ID_RESULTSETTYPE, cppu::UnoType<sal_Int32>::get(), 0);
+ pProperties[nPos++] = Property("UseBookmarks", PROPERTY_ID_USEBOOKMARKS, ::getBooleanCppuType(), 0);
return new ::cppu::OPropertyArrayHelper(aProps);
}