new constantfunction loplugin
Change-Id: Ie9b7a0c41fc4dbd2560ceff6bae9ab85357f518b
This commit is contained in:
parent
3f6bfb4c0d
commit
c7a50d072f
@ -23,6 +23,7 @@
|
||||
#include "clang/Basic/Linkage.h"
|
||||
#include "clang/Basic/SourceManager.h"
|
||||
#include "clang/Basic/Visibility.h"
|
||||
#include "clang/Frontend/CompilerInstance.h"
|
||||
#include "clang/Lex/PPCallbacks.h"
|
||||
#include "clang/Lex/Preprocessor.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
@ -210,6 +211,17 @@ inline void addPPCallbacks(
|
||||
#endif
|
||||
}
|
||||
|
||||
inline bool isMacroBodyExpansion(clang::CompilerInstance& compiler, clang::SourceLocation location)
|
||||
{
|
||||
#if (__clang_major__ == 3 && __clang_minor__ >= 3) || __clang_major__ > 3
|
||||
return compiler.getSourceManager().isMacroBodyExpansion(location);
|
||||
#else
|
||||
return location.isMacroID()
|
||||
&& !compiler.getSourceManager().isMacroArgExpansion(location);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
485
compilerplugins/clang/constantfunction.cxx
Normal file
485
compilerplugins/clang/constantfunction.cxx
Normal file
@ -0,0 +1,485 @@
|
||||
/* -*- 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/.
|
||||
*/
|
||||
|
||||
#include "plugin.hxx"
|
||||
#include "compat.hxx"
|
||||
#include <iostream>
|
||||
|
||||
/*
|
||||
Look for member functions that merely return a compile-time constant, or they are empty, and can thus
|
||||
be either removed, or converted into a constant.
|
||||
|
||||
This mostly tends to happen as a side-effect of other cleanups.
|
||||
*/
|
||||
namespace {
|
||||
|
||||
class ConstantFunction:
|
||||
public RecursiveASTVisitor<ConstantFunction>, public loplugin::Plugin
|
||||
{
|
||||
StringRef getFilename(SourceLocation loc);
|
||||
public:
|
||||
explicit ConstantFunction(InstantiationData const & data): Plugin(data) {}
|
||||
|
||||
void run() override
|
||||
{
|
||||
// these files crash clang-3.5 somewhere in the isEvaluatable/EvaluateAsXXX stuff
|
||||
FileID mainFileID = compiler.getSourceManager().getMainFileID();
|
||||
if (strstr(compiler.getSourceManager().getFileEntryForID(mainFileID)->getDir()->getName(), "sc/source/core/data") != 0) {
|
||||
return;
|
||||
}
|
||||
if (strstr(compiler.getSourceManager().getFileEntryForID(mainFileID)->getDir()->getName(), "sc/source/ui/app") != 0) {
|
||||
return;
|
||||
}
|
||||
if (strstr(compiler.getSourceManager().getFileEntryForID(mainFileID)->getDir()->getName(), "sc/qa/unit") != 0) {
|
||||
return;
|
||||
}
|
||||
if (strstr(compiler.getSourceManager().getFileEntryForID(mainFileID)->getName(), "docuno.cxx") != 0) {
|
||||
return;
|
||||
}
|
||||
if (strstr(compiler.getSourceManager().getFileEntryForID(mainFileID)->getName(), "viewdata.cxx") != 0) {
|
||||
return;
|
||||
}
|
||||
if (strstr(compiler.getSourceManager().getFileEntryForID(mainFileID)->getName(), "calcoptionsdlg.cxx") != 0) {
|
||||
return;
|
||||
}
|
||||
if (strstr(compiler.getSourceManager().getFileEntryForID(mainFileID)->getDir()->getName(), "sc/source/core/opencl") != 0) {
|
||||
return;
|
||||
}
|
||||
if (strstr(compiler.getSourceManager().getFileEntryForID(mainFileID)->getDir()->getName(), "sc/source/core/tool") != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
|
||||
}
|
||||
|
||||
bool VisitFunctionDecl(const FunctionDecl *);
|
||||
};
|
||||
|
||||
StringRef ConstantFunction::getFilename(SourceLocation loc)
|
||||
{
|
||||
SourceLocation spellingLocation = compiler.getSourceManager().getSpellingLoc(loc);
|
||||
StringRef name { compiler.getSourceManager().getFilename(spellingLocation) };
|
||||
return name;
|
||||
}
|
||||
|
||||
static bool startsWith(const std::string& rStr, const char* pSubStr) {
|
||||
return rStr.compare(0, strlen(pSubStr), pSubStr) == 0;
|
||||
}
|
||||
|
||||
bool ConstantFunction::VisitFunctionDecl(const FunctionDecl * pFunctionDecl) {
|
||||
if (ignoreLocation(pFunctionDecl)) {
|
||||
return true;
|
||||
}
|
||||
if (!pFunctionDecl->hasBody()) {
|
||||
return true;
|
||||
}
|
||||
// stuff declared extern-C is almost always used as a some kind of callback
|
||||
if (pFunctionDecl->isExternC()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
StringRef aFileName = getFilename(pFunctionDecl->getLocStart());
|
||||
|
||||
// various tests in here are empty stubs under Linux
|
||||
if (aFileName.startswith(SRCDIR "/sal/qa/")) {
|
||||
return true;
|
||||
}
|
||||
// lots of empty stuff here where it looks like someone is still going to "fill in the blanks"
|
||||
if (aFileName.startswith(SRCDIR "/basegfx/test/")) {
|
||||
return true;
|
||||
}
|
||||
// some stuff is just stubs under Linux, although this appears to be a SOLARIS-specific hack, so it
|
||||
// should probably not even be compiling under Linux.
|
||||
if (aFileName == SRCDIR "/setup_native/scripts/source/getuid.c") {
|
||||
return true;
|
||||
}
|
||||
// bridges has some weird stuff in it....
|
||||
if (aFileName.startswith(SRCDIR "/bridges/")) {
|
||||
return true;
|
||||
}
|
||||
// dummy implementation of DDE, since it is only active on Windows
|
||||
if (aFileName == SRCDIR "/svl/unx/source/svdde/ddedummy.cxx"
|
||||
|| aFileName == SRCDIR "/include/svl/svdde.hxx") {
|
||||
return true;
|
||||
}
|
||||
// fancy templates at work here
|
||||
if (aFileName == SRCDIR "/vcl/source/gdi/bmpfast.cxx") {
|
||||
return true;
|
||||
}
|
||||
// bunch of stuff used as callbacks here
|
||||
if (aFileName == SRCDIR "/vcl/generic/glyphs/gcach_layout.cxx") {
|
||||
return true;
|
||||
}
|
||||
// salplug runtime-loading mechanism at work
|
||||
if (getFilename(pFunctionDecl->getCanonicalDecl()->getLocStart()) == SRCDIR "/vcl/inc/salinst.hxx") {
|
||||
return true;
|
||||
}
|
||||
// lots of callbacks here
|
||||
if (aFileName == SRCDIR "/extensions/source/plugin/unx/npnapi.cxx") {
|
||||
return true;
|
||||
}
|
||||
// template magic
|
||||
if (aFileName == SRCDIR "/filter/source/svg/svgreader.cxx") {
|
||||
return true;
|
||||
}
|
||||
// used by code generated by python
|
||||
if (getFilename(pFunctionDecl->getCanonicalDecl()->getLocStart()) == SRCDIR "/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx") {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
const CXXMethodDecl *pCXXMethodDecl = dyn_cast<CXXMethodDecl>(pFunctionDecl);
|
||||
if (pCXXMethodDecl) {
|
||||
if (pCXXMethodDecl->isVirtual()) {
|
||||
return true;
|
||||
}
|
||||
// static with inline body will be optimised at compile-time to a constant anyway
|
||||
if (pCXXMethodDecl->isStatic() && pCXXMethodDecl->hasInlineBody()) {
|
||||
return true;
|
||||
}
|
||||
// this catches some stuff in templates
|
||||
if (pFunctionDecl->hasAttr<OverrideAttr>()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// a free function with an inline body will be optimised at compile-time to a constant anyway
|
||||
if (!pCXXMethodDecl && pFunctionDecl->isInlineSpecified()) {
|
||||
return true;
|
||||
}
|
||||
if (isa<CXXConstructorDecl>(pFunctionDecl) || isa<CXXDestructorDecl>(pFunctionDecl) || isa<CXXConversionDecl>(pFunctionDecl)) {
|
||||
return true;
|
||||
}
|
||||
SourceLocation canonicalLoc = pFunctionDecl->getCanonicalDecl()->getLocStart();
|
||||
if (isInUnoIncludeFile(compiler.getSourceManager().getSpellingLoc(canonicalLoc))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string aFunctionName = pFunctionDecl->getQualifiedNameAsString();
|
||||
|
||||
// various places override operator== and "return false;"
|
||||
if (aFunctionName.find("::operator==") != std::string::npos ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// something to do with dynamic loading in sal/textenc/textenc.cxx
|
||||
if (aFunctionName == "thisModule") {
|
||||
return true;
|
||||
}
|
||||
// an empty stub under certain conditions, sal/osl/unx/thread.cxx
|
||||
if (aFunctionName == "osl_thread_priority_init_Impl") {
|
||||
return true;
|
||||
}
|
||||
// a pointer to this function is taken and passed to an underlying API, shell/source/unix/sysshell/recently_used_file_handler.cxx
|
||||
if (aFunctionName == "(anonymous namespace)::recently_used_item::set_nothing") {
|
||||
return true;
|
||||
}
|
||||
// a pointer to this function is taken and passed to an underlying API, cppu/source/uno/lbenv.cxx
|
||||
if (aFunctionName == "defenv_dispose") {
|
||||
return true;
|
||||
}
|
||||
// a pointer to this function is taken and passed to an underlying API, cppuhelper/source/exc_thrower.cxx
|
||||
if (aFunctionName == "ExceptionThrower_acquire_release_nop") {
|
||||
return true;
|
||||
}
|
||||
// /store/
|
||||
if (aFunctionName == "store::PageData::operator delete"
|
||||
|| aFunctionName == "(anonymous namespace)::Entry::operator delete") {
|
||||
return true;
|
||||
}
|
||||
// differetnt hook function is called on different platforms, /vcl/source/app/svmainhook.cxx
|
||||
if (aFunctionName == "ImplSVMainHook") {
|
||||
return true;
|
||||
}
|
||||
// used as a callback, /vcl/source/filter/jpeg/JpegReader.cxx
|
||||
if (aFunctionName == "term_source") {
|
||||
return true;
|
||||
}
|
||||
// only valid for windows, extensions/source/update/check/updatecheck.cxx
|
||||
if (aFunctionName == "(anonymous namespace)::UpdateCheckThread::hasInternetConnection") {
|
||||
return true;
|
||||
}
|
||||
// used as callback, extensions/source/plugin/unx/npwrap.cxx
|
||||
if (aFunctionName == "plugin_x_error_handler" || aFunctionName == "noClosure") {
|
||||
return true;
|
||||
}
|
||||
// used as callback, sax/source/expatwrap/sax_expat.cxx
|
||||
if (aFunctionName == "(anonymous namespace)::SaxExpatParser_Impl::callbackUnknownEncoding") {
|
||||
return true;
|
||||
}
|
||||
// used as callback, i18npool/source/textconversion/textconversion.cxx
|
||||
if (aFunctionName == "com::sun::star::i18n::nullFunc") {
|
||||
return true;
|
||||
}
|
||||
// used as callback, xmloff/source/text/txtparae.cxx
|
||||
if (aFunctionName == "(anonymous namespace)::lcl_TextContentsUnfiltered") {
|
||||
return true;
|
||||
}
|
||||
// template magic, include/canvas/verifyinput.hxx
|
||||
if (aFunctionName == "canvas::tools::verifyInput") {
|
||||
return true;
|
||||
}
|
||||
// template magic, cppcanvas/source/mtfrenderer/implrenderer.cxx
|
||||
if (aFunctionName == "cppcanvas::internal::(anonymous namespace)::AreaQuery::result") {
|
||||
return true;
|
||||
}
|
||||
// callback, drawinglayer/source/dumper/XShapeDumper.
|
||||
if (aFunctionName == "(anonymous namespace)::closeCallback") {
|
||||
return true;
|
||||
}
|
||||
// callback, basic/source/runtime/runtime.cxx
|
||||
if (aFunctionName == "SbiRuntime::StepNOP") {
|
||||
return true;
|
||||
}
|
||||
// DLL stuff, only used on windows, basic/source/runtime/dllmgr.hxx
|
||||
if (aFunctionName == "SbiDllMgr::FreeDll") {
|
||||
return true;
|
||||
}
|
||||
// only used on Windows, basic/source/sbx/sbxdec.cxx
|
||||
if (aFunctionName == "SbxDecimal::neg" || aFunctionName == "SbxDecimal::isZero") {
|
||||
return true;
|
||||
}
|
||||
// template stuff, include/sfx2/thumbnailview.hxx
|
||||
if (aFunctionName == "ViewFilterAll::operator()") {
|
||||
return true;
|
||||
}
|
||||
// used as a callback, include/sfx2/shell.hxx
|
||||
if (aFunctionName == "SfxShell::EmptyExecStub" || aFunctionName == "SfxShell::EmptyStateStub"
|
||||
|| aFunctionName == "SfxShell::VerbState") {
|
||||
return true;
|
||||
}
|
||||
// SFX_IMPL_POS_CHILDWINDOW_WITHID macro
|
||||
if (aFunctionName.find("GetChildWindowId") != std::string::npos) {
|
||||
return true;
|
||||
}
|
||||
// SFX_IMPL_SUPERCLASS_INTERFACE macro
|
||||
if (aFunctionName.find("InitInterface_Impl") != std::string::npos) {
|
||||
return true;
|
||||
}
|
||||
// callback, vcl/unx/generic/app/sm.cxx
|
||||
if (aFunctionName == "IgnoreIceIOErrors" || aFunctionName == "IgnoreIceErrors") {
|
||||
return true;
|
||||
}
|
||||
// callback, vcl/unx/gtk/a11y/atkcomponent.cxx
|
||||
if (aFunctionName == "component_wrapper_get_mdi_zorder") {
|
||||
return true;
|
||||
}
|
||||
// callback, vcl/unx/gtk/a11y/atkaction.cxx
|
||||
if (aFunctionName == "action_wrapper_set_description") {
|
||||
return true;
|
||||
}
|
||||
// callback, vcl/unx/gtk/a11y/atkutil.cxx
|
||||
if (aFunctionName == "ooo_atk_util_get_toolkit_version" || aFunctionName == "ooo_atk_util_get_toolkit_name") {
|
||||
return true;
|
||||
}
|
||||
// callback, vcl/unx/gtk/a11y/atktextattributes.cxx
|
||||
if (aFunctionName == "InvalidValue") {
|
||||
return true;
|
||||
}
|
||||
// callback, vcl/unx/gtk/a11y/atktable.cxx
|
||||
if (aFunctionName == "table_wrapper_set_summary" || aFunctionName == "table_wrapper_set_row_header"
|
||||
|| aFunctionName == "table_wrapper_set_row_description"
|
||||
|| aFunctionName == "table_wrapper_set_column_header"
|
||||
|| aFunctionName == "table_wrapper_set_column_description"
|
||||
|| aFunctionName == "table_wrapper_set_caption") {
|
||||
return true;
|
||||
}
|
||||
// callbacks, vcl/unx/gtk/window/gtksalframe.cxx
|
||||
if (startsWith(aFunctionName, "GtkSalFrame::IMHandler::signal")) {
|
||||
return true;
|
||||
}
|
||||
// callbacks, vcl/unx/gtk/window/glomenu.cxx
|
||||
if (startsWith(aFunctionName, "g_lo_menu_is_mutable")) {
|
||||
return true;
|
||||
}
|
||||
// only contains code for certain versions of GTK, /vcl/unx/gtk/window/gtksalframe.cx
|
||||
if (aFunctionName == "GtkSalFrame::AllocateFrame") {
|
||||
return true;
|
||||
}
|
||||
// only valid for Windows, embeddedobj/source/msole/olemisc.cxx
|
||||
if (aFunctionName == "OleEmbeddedObject::GetRidOfComponent") {
|
||||
return true;
|
||||
}
|
||||
// callback, svx/source/accessibility/ShapeTypeHandler.cxx
|
||||
if (aFunctionName == "accessibility::CreateEmptyShapeReference") {
|
||||
return true;
|
||||
}
|
||||
// svx/source/inc/frmselimpl.hxx
|
||||
if (aFunctionName == "svx::FrameBorderDummy_Pred::operator()") {
|
||||
return true;
|
||||
}
|
||||
// desktop/source/lib/init.cxx
|
||||
if (aFunctionName == "NoDelete::operator()") {
|
||||
return true;
|
||||
}
|
||||
// chart2/source/view/main/AbstractShapeFactory.cxx
|
||||
if (aFunctionName == "chart::(anonymous namespace)::thisModule") {
|
||||
return true;
|
||||
}
|
||||
// chart2/source/tools/InternalData.cxx
|
||||
if (aFunctionName == "chart::InternalData::dump") {
|
||||
return true;
|
||||
}
|
||||
// chart2/source/view/main/DummyXShape.cxx
|
||||
if (aFunctionName == "chart::dummy::(anonymous namespace)::PrintProperties::operator()") {
|
||||
return true;
|
||||
}
|
||||
// hwpfilter/
|
||||
if (aFunctionName == "debug" || aFunctionName == "token_debug") {
|
||||
return true;
|
||||
}
|
||||
// callback, sdext/source/presenter/PresenterFrameworkObserver.cxx
|
||||
if (aFunctionName == "sdext::presenter::PresenterFrameworkObserver::True") {
|
||||
return true;
|
||||
}
|
||||
// hidden behind the ENABLE_PANE_RESIZING macro
|
||||
if (aFunctionName == "sdext::presenter::PresenterWindowManager::UpdateWindowList") {
|
||||
return true;
|
||||
}
|
||||
// callback, sw/source/core/doc/tblrwcl.cxx
|
||||
if (aFunctionName == "lcl_DelOtherBox") {
|
||||
return true;
|
||||
}
|
||||
// callback, sw/source/filter/ww8/ww8par.cxx
|
||||
if (aFunctionName == "SwWW8ImplReader::Read_Majority") {
|
||||
return true;
|
||||
}
|
||||
// callback, sw/source/filter/ww8/ww8par5.cxx
|
||||
if (aFunctionName == "SwWW8ImplReader::Read_F_Shape") {
|
||||
return true;
|
||||
}
|
||||
// callback, sd/source/ui/framework/tools/FrameworkHelper.cxx
|
||||
if (aFunctionName == "sd::framework::(anonymous namespace)::FrameworkHelperAllPassFilter::operator()") {
|
||||
return true;
|
||||
}
|
||||
// called from SDI file, I don't know what that stuff is about, sd/source/ui/slidesorter/shell/SlideSorterViewShell.cx
|
||||
if (aFunctionName == "sd::slidesorter::SlideSorterViewShell::ExecStatusBar"
|
||||
|| aFunctionName == "sd::OutlineViewShell::ExecStatusBar") {
|
||||
return true;
|
||||
}
|
||||
// only used in debug mode, sd/source/filter/ppt/pptinanimations.cxx
|
||||
if (startsWith(aFunctionName, "ppt::AnimationImporter::dump")) {
|
||||
return true;
|
||||
}
|
||||
// only used in ENABLE_SDREMOTE_BLUETOOTH mode, sd/source/ui/dlg/tpoption.cx
|
||||
if (aFunctionName == "SdTpOptionsMisc::SetImpressMode") {
|
||||
return true;
|
||||
}
|
||||
// template magic, sc/source/ui/docshell/datastream.cxx
|
||||
if (startsWith(aFunctionName, "sc::(anonymous namespace)::CSVHandler::")) {
|
||||
return true;
|
||||
}
|
||||
// called from SDI file, I don't know what that stuff is about, sc/source/ui/docshell/docsh7.cxx
|
||||
if (aFunctionName == "ScDocShell::GetDrawObjState") {
|
||||
return true;
|
||||
}
|
||||
// called from SDI file, I don't know what that stuff is about, sc/source/ui/view/cellsh4.cxx
|
||||
if (aFunctionName == "ScCellShell::GetStateCursor") {
|
||||
return true;
|
||||
}
|
||||
// called from SDI file, I don't know what that stuff is about, sc/source/ui/view/tabvwshh.cxx
|
||||
if (aFunctionName == "ScTabViewShell::ExecuteSbx" || aFunctionName == "ScTabViewShell::GetSbxState") {
|
||||
return true;
|
||||
}
|
||||
// template magic, sc/source/filter/excel/xepivot.cxx
|
||||
if (aFunctionName == "XclExpPivotCache::SaveXml") {
|
||||
return true;
|
||||
}
|
||||
// template magic, sc/source/filter/html/htmlpars.cxx
|
||||
if (startsWith(aFunctionName, "(anonymous namespace)::CSSHandler::")) {
|
||||
return true;
|
||||
}
|
||||
// callbacks, sc/source/filter/oox/formulaparser.cxx
|
||||
if (startsWith(aFunctionName, "oox::xls::BiffFormulaParserImpl::import")) {
|
||||
return true;
|
||||
}
|
||||
// template magic, sc/qa/unit/helper/csv_handler.hxx
|
||||
if (startsWith(aFunctionName, "csv_handler::") || startsWith(aFunctionName, "conditional_format_handler::")) {
|
||||
return true;
|
||||
}
|
||||
// template magic, slideshow/source/inc/listenercontainer.hxx
|
||||
if (startsWith(aFunctionName, "slideshow::internal::EmptyBase::EmptyClearableGuard::")) {
|
||||
return true;
|
||||
}
|
||||
// callback, scripting/source/vbaevents/eventhelper.cxx
|
||||
if (aFunctionName == "ApproveAll") {
|
||||
return true;
|
||||
}
|
||||
// only on WNT, basic/qa/cppunit/test_vba.cx
|
||||
if (aFunctionName == "(anonymous namespace)::VBATest::testMiscOLEStuff") {
|
||||
return true;
|
||||
}
|
||||
// GtkSalFrame::TriggerPaintEvent() is only compiled under certain versions of GTK
|
||||
if (aFunctionName == "GtkSalFrame::TriggerPaintEvent") {
|
||||
return true;
|
||||
}
|
||||
if (aFunctionName == "SwVectorModifyBase::dumpAsXml") {
|
||||
return true;
|
||||
}
|
||||
|
||||
// can't mess with the TYPEINIT macros in include/tools/rtti.hxx or the LINK macros in include/tools/link.hxx
|
||||
std::string aImmediateMacro = "";
|
||||
if (compat::isMacroBodyExpansion(compiler, pFunctionDecl->getLocStart()) ) {
|
||||
StringRef name { Lexer::getImmediateMacroName(
|
||||
pFunctionDecl->getLocStart(), compiler.getSourceManager(), compiler.getLangOpts()) };
|
||||
aImmediateMacro = name;
|
||||
if (name == "TYPEINIT_FACTORY" || name == "TYPEINFO" || name == "TYPEINFO_OVERRIDE"
|
||||
|| name.startswith("IMPL_LINK") || name == "DECL_LINK")
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
const CompoundStmt *pCompoundStmt = dyn_cast<CompoundStmt>(pFunctionDecl->getBody());
|
||||
bool aEmptyBody = false;
|
||||
if (pCompoundStmt) {
|
||||
if (pCompoundStmt->size() > 1) {
|
||||
return true;
|
||||
}
|
||||
if (pCompoundStmt->size() > 0) {
|
||||
const ReturnStmt *pReturnStmt = dyn_cast<ReturnStmt>(*pCompoundStmt->body_begin());
|
||||
if (!pReturnStmt) {
|
||||
return true;
|
||||
}
|
||||
if (pReturnStmt->getRetValue() != nullptr) {
|
||||
// && !pReturnStmt->getRetValue()->isEvaluatable(compiler.getASTContext())) {
|
||||
bool aBoolResult;
|
||||
llvm::APSInt aIntResult;
|
||||
if (!pReturnStmt->getRetValue()->EvaluateAsBooleanCondition(aBoolResult, compiler.getASTContext())
|
||||
&& !pReturnStmt->getRetValue()->EvaluateAsInt(aIntResult, compiler.getASTContext()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
aEmptyBody = true;
|
||||
}
|
||||
}
|
||||
|
||||
std::string aMessage = "this ";
|
||||
aMessage += pCXXMethodDecl ? "method" : "function";
|
||||
if (aEmptyBody) {
|
||||
aMessage += " is empty and should be removed, " + aFunctionName;
|
||||
} else {
|
||||
aMessage += " returns a constant value and should be converted to a constant "
|
||||
"or to static inline, " + aFunctionName + ", " + aImmediateMacro;
|
||||
}
|
||||
report(
|
||||
DiagnosticsEngine::Warning,
|
||||
aMessage,
|
||||
pFunctionDecl->getLocStart())
|
||||
<< pFunctionDecl->getSourceRange()
|
||||
<< pFunctionDecl->getCanonicalDecl()->getSourceRange();
|
||||
return true;
|
||||
}
|
||||
|
||||
loplugin::Plugin::Registration<ConstantFunction> X("constantfunction");
|
||||
|
||||
}
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
@ -115,11 +115,6 @@ namespace dbtools
|
||||
}
|
||||
|
||||
|
||||
void ParameterManager::disposing( const EventObject& /*_rDisposingEvent*/ )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void ParameterManager::setAllParametersNull()
|
||||
{
|
||||
OSL_PRECOND( isAlive(), "ParameterManager::setAllParametersNull: not initialized, or already disposed!" );
|
||||
|
@ -22,166 +22,87 @@
|
||||
|
||||
namespace dbtools
|
||||
{
|
||||
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* getPROPERTY_FUNCTION() { return "Function"; }
|
||||
const sal_Char* getPROPERTY_AGGREGATEFUNCTION() { return "AggregateFunction"; }
|
||||
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"; }
|
||||
const sal_Char* getPROPERTY_ID_HAVINGCLAUSE() { return "HavingClause"; }
|
||||
const sal_Char* getPROPERTY_ID_ISSIGNED() { return "IsSigned"; }
|
||||
const sal_Char* getPROPERTY_ID_ISSEARCHABLE() { return "IsSearchable"; }
|
||||
|
||||
const sal_Char* getPROPERTY_ID_APPLYFILTER() { return "ApplyFilter"; }
|
||||
const sal_Char* getPROPERTY_ID_FILTER() { return "Filter"; }
|
||||
const sal_Char* getPROPERTY_ID_MASTERFIELDS() { return "MasterFields"; }
|
||||
const sal_Char* getPROPERTY_ID_DETAILFIELDS() { return "DetailFields"; }
|
||||
const sal_Char* getPROPERTY_ID_FIELDTYPE() { return "FieldType"; }
|
||||
const sal_Char* getPROPERTY_ID_VALUE() { return "Value"; }
|
||||
const sal_Char* getPROPERTY_ID_ACTIVE_CONNECTION() { return "ActiveConnection"; }
|
||||
const sal_Char* getPROPERTY_ID_LABEL() { return "Label"; }
|
||||
|
||||
|
||||
//= error messages
|
||||
|
||||
const sal_Char* getSQLSTATE_SEQUENCE() { return "HY010"; }
|
||||
const sal_Char* getSTR_DELIMITER() { return "/"; }
|
||||
|
||||
|
||||
|
||||
OPropertyMap::~OPropertyMap()
|
||||
const OUString& OPropertyMap::getNameByIndex(sal_Int32 _nIndex) const
|
||||
{
|
||||
::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);
|
||||
}
|
||||
|
||||
OUString OPropertyMap::getNameByIndex(sal_Int32 _nIndex) const
|
||||
{
|
||||
OUString sRet;
|
||||
::std::map<sal_Int32 , rtl_uString*>::const_iterator aIter = m_aPropertyMap.find(_nIndex);
|
||||
::std::map<sal_Int32, OUString>::const_iterator aIter = m_aPropertyMap.find(_nIndex);
|
||||
if(aIter == m_aPropertyMap.end())
|
||||
sRet = const_cast<OPropertyMap*>(this)->fillValue(_nIndex);
|
||||
else
|
||||
sRet = aIter->second;
|
||||
return sRet;
|
||||
{
|
||||
const_cast<OPropertyMap*>(this)->fillValue(_nIndex);
|
||||
aIter = m_aPropertyMap.find(_nIndex);
|
||||
}
|
||||
return aIter->second;
|
||||
}
|
||||
|
||||
OUString OPropertyMap::fillValue(sal_Int32 _nIndex)
|
||||
void OPropertyMap::fillValue(sal_Int32 _nIndex)
|
||||
{
|
||||
rtl_uString* pStr = NULL;
|
||||
OUString pStr;
|
||||
switch(_nIndex)
|
||||
{
|
||||
case PROPERTY_ID_QUERYTIMEOUT: { rtl_uString_newFromAscii(&pStr,getPROPERTY_QUERYTIMEOUT() ); break; }
|
||||
case PROPERTY_ID_MAXFIELDSIZE: { rtl_uString_newFromAscii(&pStr,getPROPERTY_MAXFIELDSIZE() ); break; }
|
||||
case PROPERTY_ID_MAXROWS: { rtl_uString_newFromAscii(&pStr,getPROPERTY_MAXROWS() ); break; }
|
||||
case PROPERTY_ID_CURSORNAME: { rtl_uString_newFromAscii(&pStr,getPROPERTY_CURSORNAME() ); break; }
|
||||
case PROPERTY_ID_RESULTSETCONCURRENCY: { rtl_uString_newFromAscii(&pStr,getPROPERTY_RESULTSETCONCURRENCY() ); break; }
|
||||
case PROPERTY_ID_RESULTSETTYPE: { rtl_uString_newFromAscii(&pStr,getPROPERTY_RESULTSETTYPE() ); break; }
|
||||
case PROPERTY_ID_FETCHDIRECTION: { rtl_uString_newFromAscii(&pStr,getPROPERTY_FETCHDIRECTION() ); break; }
|
||||
case PROPERTY_ID_FETCHSIZE: { rtl_uString_newFromAscii(&pStr,getPROPERTY_FETCHSIZE() ); break; }
|
||||
case PROPERTY_ID_ESCAPEPROCESSING: { rtl_uString_newFromAscii(&pStr,getPROPERTY_ESCAPEPROCESSING() ); break; }
|
||||
case PROPERTY_ID_USEBOOKMARKS: { rtl_uString_newFromAscii(&pStr,getPROPERTY_USEBOOKMARKS() ); break; }
|
||||
case PROPERTY_ID_QUERYTIMEOUT: pStr = "QueryTimeOut"; break;
|
||||
case PROPERTY_ID_MAXFIELDSIZE: pStr = "MaxFieldSize"; break;
|
||||
case PROPERTY_ID_MAXROWS: pStr = "MaxRows"; break;
|
||||
case PROPERTY_ID_CURSORNAME: pStr = "CursorName"; break;
|
||||
case PROPERTY_ID_RESULTSETCONCURRENCY: pStr = "ResultSetConcurrency"; break;
|
||||
|
||||
case PROPERTY_ID_RESULTSETTYPE: pStr = "ResultSetType"; break;
|
||||
case PROPERTY_ID_FETCHDIRECTION: pStr = "FetchDirection"; break;
|
||||
case PROPERTY_ID_FETCHSIZE: pStr = "FetchSize"; break;
|
||||
case PROPERTY_ID_ESCAPEPROCESSING: pStr = "EscapeProcessing"; break;
|
||||
case PROPERTY_ID_USEBOOKMARKS: pStr = "UseBookmarks"; break;
|
||||
// Column
|
||||
case PROPERTY_ID_NAME: { rtl_uString_newFromAscii(&pStr,getPROPERTY_NAME() ); break; }
|
||||
case PROPERTY_ID_TYPE: { rtl_uString_newFromAscii(&pStr,getPROPERTY_TYPE() ); break; }
|
||||
case PROPERTY_ID_TYPENAME: { rtl_uString_newFromAscii(&pStr,getPROPERTY_TYPENAME() ); break; }
|
||||
case PROPERTY_ID_PRECISION: { rtl_uString_newFromAscii(&pStr,getPROPERTY_PRECISION() ); break; }
|
||||
case PROPERTY_ID_SCALE: { rtl_uString_newFromAscii(&pStr,getPROPERTY_SCALE() ); break; }
|
||||
case PROPERTY_ID_ISNULLABLE: { rtl_uString_newFromAscii(&pStr,getPROPERTY_ISNULLABLE() ); break; }
|
||||
case PROPERTY_ID_ISAUTOINCREMENT: { rtl_uString_newFromAscii(&pStr,getPROPERTY_ISAUTOINCREMENT() ); break; }
|
||||
case PROPERTY_ID_ISROWVERSION: { rtl_uString_newFromAscii(&pStr,getPROPERTY_ISROWVERSION() ); break; }
|
||||
case PROPERTY_ID_DESCRIPTION: { rtl_uString_newFromAscii(&pStr,getPROPERTY_DESCRIPTION() ); break; }
|
||||
case PROPERTY_ID_DEFAULTVALUE: { rtl_uString_newFromAscii(&pStr,getPROPERTY_DEFAULTVALUE() ); break; }
|
||||
case PROPERTY_ID_NAME: pStr = "Name"; break;
|
||||
case PROPERTY_ID_TYPE: pStr = "Type"; break;
|
||||
case PROPERTY_ID_TYPENAME: pStr = "TypeName"; break;
|
||||
case PROPERTY_ID_PRECISION: pStr = "Precision";
|
||||
case PROPERTY_ID_SCALE: pStr = "Scale"; break;
|
||||
case PROPERTY_ID_ISNULLABLE: pStr = "IsNullable"; break;
|
||||
case PROPERTY_ID_ISAUTOINCREMENT: pStr = "IsAutoIncrement"; break;
|
||||
case PROPERTY_ID_ISROWVERSION: pStr = "IsRowVersion"; break;
|
||||
case PROPERTY_ID_DESCRIPTION: pStr = "Description"; break;
|
||||
case PROPERTY_ID_DEFAULTVALUE: pStr = "DefaultValue"; break;
|
||||
|
||||
case PROPERTY_ID_REFERENCEDTABLE: { rtl_uString_newFromAscii(&pStr,getPROPERTY_REFERENCEDTABLE() ); break; }
|
||||
case PROPERTY_ID_UPDATERULE: { rtl_uString_newFromAscii(&pStr,getPROPERTY_UPDATERULE() ); break; }
|
||||
case PROPERTY_ID_DELETERULE: { rtl_uString_newFromAscii(&pStr,getPROPERTY_DELETERULE() ); break; }
|
||||
case PROPERTY_ID_CATALOG: { rtl_uString_newFromAscii(&pStr,getPROPERTY_CATALOG() ); break; }
|
||||
case PROPERTY_ID_ISUNIQUE: { rtl_uString_newFromAscii(&pStr,getPROPERTY_ISUNIQUE() ); break; }
|
||||
case PROPERTY_ID_ISPRIMARYKEYINDEX: { rtl_uString_newFromAscii(&pStr,getPROPERTY_ISPRIMARYKEYINDEX() ); break; }
|
||||
case PROPERTY_ID_ISCLUSTERED: { rtl_uString_newFromAscii(&pStr,getPROPERTY_ISCLUSTERED() ); break; }
|
||||
case PROPERTY_ID_ISASCENDING: { rtl_uString_newFromAscii(&pStr,getPROPERTY_ISASCENDING() ); break; }
|
||||
case PROPERTY_ID_SCHEMANAME: { rtl_uString_newFromAscii(&pStr,getPROPERTY_SCHEMANAME() ); break; }
|
||||
case PROPERTY_ID_CATALOGNAME: { rtl_uString_newFromAscii(&pStr,getPROPERTY_CATALOGNAME() ); break; }
|
||||
case PROPERTY_ID_REFERENCEDTABLE: pStr = "ReferencedTable"; break;
|
||||
case PROPERTY_ID_UPDATERULE: pStr = "UpdateRule"; break;
|
||||
case PROPERTY_ID_DELETERULE: pStr = "DeleteRule"; break;
|
||||
case PROPERTY_ID_CATALOG: pStr = "Catalog"; break;
|
||||
case PROPERTY_ID_ISUNIQUE: pStr = "IsUnique"; break;
|
||||
case PROPERTY_ID_ISPRIMARYKEYINDEX: pStr = "IsPrimaryKeyIndex"; break;
|
||||
case PROPERTY_ID_ISCLUSTERED: pStr = "IsClustered"; break;
|
||||
case PROPERTY_ID_ISASCENDING: pStr = "IsAscending"; break;
|
||||
case PROPERTY_ID_SCHEMANAME: pStr = "SchemaName"; break;
|
||||
case PROPERTY_ID_CATALOGNAME: pStr = "CatalogName"; break;
|
||||
|
||||
case PROPERTY_ID_COMMAND: { rtl_uString_newFromAscii(&pStr,getPROPERTY_COMMAND() ); break; }
|
||||
case PROPERTY_ID_CHECKOPTION: { rtl_uString_newFromAscii(&pStr,getPROPERTY_CHECKOPTION() ); break; }
|
||||
case PROPERTY_ID_PASSWORD: { rtl_uString_newFromAscii(&pStr,getPROPERTY_PASSWORD() ); break; }
|
||||
case PROPERTY_ID_RELATEDCOLUMN: { rtl_uString_newFromAscii(&pStr,getPROPERTY_RELATEDCOLUMN() ); break; }
|
||||
case PROPERTY_ID_COMMAND: pStr = "Command"; break;
|
||||
case PROPERTY_ID_CHECKOPTION: pStr = "CheckOption"; break;
|
||||
case PROPERTY_ID_PASSWORD: pStr = "Password"; break;
|
||||
case PROPERTY_ID_RELATEDCOLUMN: pStr = "RelatedColumn"; break;
|
||||
|
||||
case PROPERTY_ID_FUNCTION: { rtl_uString_newFromAscii(&pStr,getPROPERTY_FUNCTION() ); break; }
|
||||
case PROPERTY_ID_AGGREGATEFUNCTION: { rtl_uString_newFromAscii(&pStr,getPROPERTY_AGGREGATEFUNCTION() ); break; }
|
||||
case PROPERTY_ID_TABLENAME: { rtl_uString_newFromAscii(&pStr,getPROPERTY_TABLENAME() ); break; }
|
||||
case PROPERTY_ID_REALNAME: { rtl_uString_newFromAscii(&pStr,getPROPERTY_REALNAME() ); break; }
|
||||
case PROPERTY_ID_DBASEPRECISIONCHANGED: { rtl_uString_newFromAscii(&pStr,getPROPERTY_DBASEPRECISIONCHANGED()); break; }
|
||||
case PROPERTY_ID_ISCURRENCY: { rtl_uString_newFromAscii(&pStr,getPROPERTY_ISCURRENCY() ); break; }
|
||||
case PROPERTY_ID_ISBOOKMARKABLE: { rtl_uString_newFromAscii(&pStr,getPROPERTY_ISBOOKMARKABLE() ); break; }
|
||||
case PROPERTY_ID_HY010: { rtl_uString_newFromAscii(&pStr,getSQLSTATE_SEQUENCE() ); break; }
|
||||
case PROPERTY_ID_DELIMITER: { rtl_uString_newFromAscii(&pStr,getSTR_DELIMITER() ); break; }
|
||||
case PROPERTY_ID_FORMATKEY: { rtl_uString_newFromAscii(&pStr,getPROPERTY_FORMATKEY() ); break; }
|
||||
case PROPERTY_ID_LOCALE: { rtl_uString_newFromAscii(&pStr,getPROPERTY_LOCALE() ); break; }
|
||||
case PROPERTY_ID_AUTOINCREMENTCREATION: { rtl_uString_newFromAscii(&pStr,getPROPERTY_AUTOINCREMENTCREATION()); break; }
|
||||
case PROPERTY_ID_PRIVILEGES: { rtl_uString_newFromAscii(&pStr,getPROPERTY_PRIVILEGES() ); break; }
|
||||
case PROPERTY_ID_HAVINGCLAUSE: { rtl_uString_newFromAscii(&pStr,getPROPERTY_ID_HAVINGCLAUSE() ); break; }
|
||||
case PROPERTY_ID_ISSIGNED: { rtl_uString_newFromAscii(&pStr,getPROPERTY_ID_ISSIGNED() ); break; }
|
||||
case PROPERTY_ID_ISSEARCHABLE: { rtl_uString_newFromAscii(&pStr,getPROPERTY_ID_ISSEARCHABLE() ); break; }
|
||||
case PROPERTY_ID_LABEL: { rtl_uString_newFromAscii(&pStr,getPROPERTY_ID_LABEL() ); break; }
|
||||
case PROPERTY_ID_APPLYFILTER: { rtl_uString_newFromAscii(&pStr,getPROPERTY_ID_APPLYFILTER() ); break; }
|
||||
case PROPERTY_ID_FILTER: { rtl_uString_newFromAscii(&pStr,getPROPERTY_ID_FILTER() ); break; }
|
||||
case PROPERTY_ID_MASTERFIELDS: { rtl_uString_newFromAscii(&pStr,getPROPERTY_ID_MASTERFIELDS() ); break; }
|
||||
case PROPERTY_ID_DETAILFIELDS: { rtl_uString_newFromAscii(&pStr,getPROPERTY_ID_DETAILFIELDS() ); break; }
|
||||
case PROPERTY_ID_FIELDTYPE: { rtl_uString_newFromAscii(&pStr,getPROPERTY_ID_FIELDTYPE() ); break; }
|
||||
case PROPERTY_ID_VALUE: { rtl_uString_newFromAscii(&pStr,getPROPERTY_ID_VALUE() ); break; }
|
||||
case PROPERTY_ID_ACTIVE_CONNECTION: { rtl_uString_newFromAscii(&pStr,getPROPERTY_ID_ACTIVE_CONNECTION() ); break; }
|
||||
case PROPERTY_ID_FUNCTION: pStr = "Function"; break;
|
||||
case PROPERTY_ID_AGGREGATEFUNCTION: pStr = "AggregateFunction"; break;
|
||||
case PROPERTY_ID_TABLENAME: pStr = "TableName"; break;
|
||||
case PROPERTY_ID_REALNAME: pStr = "RealName"; break;
|
||||
case PROPERTY_ID_DBASEPRECISIONCHANGED: pStr = "DbasePrecisionChanged"; break;
|
||||
case PROPERTY_ID_ISCURRENCY: pStr = "IsCurrency"; break;
|
||||
case PROPERTY_ID_ISBOOKMARKABLE: pStr = "IsBookmarkable"; break;
|
||||
case PROPERTY_ID_HY010: pStr = "HY010"; break; //= error messages
|
||||
case PROPERTY_ID_DELIMITER: pStr = "/"; break;
|
||||
case PROPERTY_ID_FORMATKEY: pStr = "FormatKey"; break;
|
||||
case PROPERTY_ID_LOCALE: pStr = "Locale"; break;
|
||||
case PROPERTY_ID_AUTOINCREMENTCREATION: pStr = "AutoIncrementCreation"; break;
|
||||
case PROPERTY_ID_PRIVILEGES: pStr = "Privileges"; break;
|
||||
case PROPERTY_ID_HAVINGCLAUSE: pStr = "HavingClause"; break;
|
||||
case PROPERTY_ID_ISSIGNED: pStr = "IsSigned"; break;
|
||||
case PROPERTY_ID_ISSEARCHABLE: pStr = "IsSearchable"; break;
|
||||
case PROPERTY_ID_LABEL: pStr = "Label"; break;
|
||||
case PROPERTY_ID_APPLYFILTER: pStr = "ApplyFilter"; break;
|
||||
case PROPERTY_ID_FILTER: pStr = "Filter"; break;
|
||||
case PROPERTY_ID_MASTERFIELDS: pStr = "MasterFields"; break;
|
||||
case PROPERTY_ID_DETAILFIELDS: pStr = "DetailFields"; break;
|
||||
case PROPERTY_ID_FIELDTYPE: pStr = "FieldType"; break;
|
||||
case PROPERTY_ID_VALUE: pStr = "Value"; break;
|
||||
case PROPERTY_ID_ACTIVE_CONNECTION: pStr = "ActiveConnection"; break;
|
||||
}
|
||||
m_aPropertyMap[_nIndex] = pStr;
|
||||
return pStr ? OUString(pStr) : OUString();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ Reference< XNameAccess > SAL_CALL OCatalog::getTables( ) throw(RuntimeException
|
||||
|
||||
try
|
||||
{
|
||||
if(!m_pTables || m_pConnection->getForceLoadTables())
|
||||
if(!m_pTables || OConnection::getForceLoadTables())
|
||||
refreshTables();
|
||||
}
|
||||
catch( const RuntimeException& )
|
||||
|
@ -102,7 +102,7 @@ namespace connectivity
|
||||
|
||||
static OUString getDriverImplementationName();
|
||||
|
||||
bool getForceLoadTables() {return true;}
|
||||
static bool getForceLoadTables() {return true;}
|
||||
|
||||
// Added to enable me to use SQLInterpreter which requires an
|
||||
// XNameAccess i/f to access tables.
|
||||
|
@ -144,11 +144,6 @@ sal_Int32 MQueryHelper::getResultCount() const
|
||||
|
||||
|
||||
|
||||
bool MQueryHelper::queryComplete() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MQueryHelper::checkRowAvailable( sal_Int32 nDBRow )
|
||||
{
|
||||
/*
|
||||
|
@ -199,7 +199,7 @@ namespace connectivity
|
||||
void reset();
|
||||
MQueryHelperResultEntry* getByIndex( sal_uInt32 nRow );
|
||||
bool isError() const;
|
||||
bool queryComplete() const;
|
||||
static bool queryComplete() { return true; }
|
||||
sal_Int32 getResultCount() const;
|
||||
bool checkRowAvailable( sal_Int32 nDBRow );
|
||||
bool getRowValue( ORowSetValue& rValue, sal_Int32 nDBRow,const OUString& aDBColumnName, sal_Int32 nType );
|
||||
|
@ -332,35 +332,6 @@ bool OResultSet::fetchCurrentRow( ) throw(SQLException, RuntimeException)
|
||||
}
|
||||
|
||||
|
||||
bool OResultSet::pushCard(sal_uInt32 /*cardNumber*/) throw(SQLException, RuntimeException)
|
||||
{
|
||||
return true;
|
||||
/*
|
||||
if (cardNumber == 0)
|
||||
return sal_True;
|
||||
// Check whether we are storing the updated row
|
||||
if ( (m_aRow->get())[0].isNull() || (sal_Int32)(m_aRow->get())[0] != (sal_Int32)cardNumber )
|
||||
return sal_False;
|
||||
|
||||
sal_Int32 nCount = m_aColumnNames.getLength();
|
||||
m_aQuery.setRowStates(cardNumber,m_RowStates);
|
||||
for( sal_Int32 i = 1; i <= nCount; i++ )
|
||||
{
|
||||
if ( (m_aRow->get())[i].isBound() )
|
||||
{
|
||||
|
||||
// Everything in the addressbook is a string!
|
||||
|
||||
if ( !m_aQuery.setRowValue( (m_aRow->get())[i], cardNumber, m_aColumnNames[i-1], DataType::VARCHAR ))
|
||||
{
|
||||
m_pStatement->getOwnConnection()->throwSQLException( m_aQuery.getError(), *this );
|
||||
}
|
||||
}
|
||||
}
|
||||
return sal_True;
|
||||
*/
|
||||
}
|
||||
|
||||
bool OResultSet::fetchRow(sal_Int32 cardNumber,bool bForceReload) throw(SQLException, RuntimeException)
|
||||
{
|
||||
SAL_INFO("connectivity.mork", "cardNumber = " << cardNumber);
|
||||
@ -466,7 +437,7 @@ sal_Bool SAL_CALL OResultSet::isAfterLast( ) throw(SQLException, RuntimeExcepti
|
||||
|
||||
OSL_TRACE("In/Out: OResultSet::isAfterLast" );
|
||||
// return sal_True;
|
||||
return m_nRowPos > currentRowCount() && m_aQueryHelper.queryComplete();
|
||||
return m_nRowPos > currentRowCount() && MQueryHelper::queryComplete();
|
||||
}
|
||||
|
||||
sal_Bool SAL_CALL OResultSet::isFirst( ) throw(SQLException, RuntimeException, std::exception)
|
||||
@ -484,7 +455,7 @@ sal_Bool SAL_CALL OResultSet::isLast( ) throw(SQLException, RuntimeException, s
|
||||
|
||||
OSL_TRACE("In/Out: OResultSet::isLast" );
|
||||
// return sal_True;
|
||||
return m_nRowPos == currentRowCount() && m_aQueryHelper.queryComplete();
|
||||
return m_nRowPos == currentRowCount() && MQueryHelper::queryComplete();
|
||||
}
|
||||
|
||||
void SAL_CALL OResultSet::beforeFirst( ) throw(SQLException, RuntimeException, std::exception)
|
||||
@ -1258,7 +1229,7 @@ void SAL_CALL OResultSet::executeQuery() throw( ::com::sun::star::sdbc::SQLExcep
|
||||
|
||||
OSL_TRACE("Query is to be sorted");
|
||||
|
||||
OSL_ENSURE( m_aQueryHelper.queryComplete(), "Query not complete!!");
|
||||
OSL_ENSURE( MQueryHelper::queryComplete(), "Query not complete!!");
|
||||
|
||||
OSortIndex aSortIndex(eKeyType,m_aOrderbyAscending);
|
||||
|
||||
@ -1445,7 +1416,7 @@ bool OResultSet::validRow( sal_uInt32 nRow)
|
||||
{
|
||||
sal_Int32 nNumberOfRecords = m_aQueryHelper.getResultCount();
|
||||
|
||||
while ( nRow > (sal_uInt32)nNumberOfRecords && !m_aQueryHelper.queryComplete() ) {
|
||||
while ( nRow > (sal_uInt32)nNumberOfRecords && !MQueryHelper::queryComplete() ) {
|
||||
#if OSL_DEBUG_LEVEL > 0
|
||||
OSL_TRACE("validRow: waiting...");
|
||||
#endif
|
||||
@ -1466,7 +1437,7 @@ bool OResultSet::validRow( sal_uInt32 nRow)
|
||||
}
|
||||
|
||||
if (( nRow == 0 ) ||
|
||||
( nRow > (sal_uInt32)nNumberOfRecords && m_aQueryHelper.queryComplete()) ){
|
||||
( nRow > (sal_uInt32)nNumberOfRecords && MQueryHelper::queryComplete()) ){
|
||||
SAL_INFO("connectivity.mork", "validRow(" << nRow << "): return False");
|
||||
return false;
|
||||
}
|
||||
|
@ -266,8 +266,7 @@ protected:
|
||||
::com::sun::star::uno::RuntimeException);
|
||||
bool fetchCurrentRow() throw( ::com::sun::star::sdbc::SQLException,
|
||||
::com::sun::star::uno::RuntimeException);
|
||||
bool pushCard(sal_uInt32 rowIndex) throw( ::com::sun::star::sdbc::SQLException,
|
||||
::com::sun::star::uno::RuntimeException);
|
||||
static bool pushCard(sal_uInt32 ) { return true; }
|
||||
bool validRow( sal_uInt32 nRow );
|
||||
bool seekRow( eRowPosition pos, sal_Int32 nOffset = 0 );
|
||||
sal_Int32 deletedCount();
|
||||
|
@ -176,7 +176,7 @@ sal_Bool SAL_CALL OResultSetMetaData::isReadOnly( sal_Int32 column ) throw(SQLEx
|
||||
bool bReadOnly = (m_xColumns->get())[column-1]->getPropertySetInfo()->hasPropertyByName(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FUNCTION)) &&
|
||||
::cppu::any2bool((m_xColumns->get())[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FUNCTION)));
|
||||
|
||||
return m_bReadOnly || bReadOnly || m_pTable->isReadOnly();
|
||||
return m_bReadOnly || bReadOnly || OTable::isReadOnly();
|
||||
}
|
||||
|
||||
|
||||
|
@ -141,53 +141,6 @@ void SAL_CALL OCommonStatement::close( ) throw(SQLException, RuntimeException,
|
||||
|
||||
|
||||
|
||||
void OCommonStatement::createTable( ) throw ( SQLException, RuntimeException )
|
||||
{
|
||||
/*
|
||||
if(m_pParseTree)
|
||||
{
|
||||
::rtl::Reference<connectivity::OSQLColumns> xCreateColumn;
|
||||
if (m_pSQLIterator->getStatementType() == SQL_STATEMENT_CREATE_TABLE)
|
||||
{
|
||||
const OSQLTables& xTabs = m_pSQLIterator->getTables();
|
||||
OSL_ENSURE( !xTabs.empty(), "Need a Table");
|
||||
OUString ouTableName=xTabs.begin()->first;
|
||||
xCreateColumn = m_pSQLIterator->getCreateColumns();
|
||||
OSL_ENSURE(xCreateColumn.is(), "Need the Columns!!");
|
||||
|
||||
const OColumnAlias& aColumnAlias = m_pConnection->getColumnAlias();
|
||||
|
||||
OSQLColumns::Vector::const_iterator aIter = xCreateColumn->get().begin();
|
||||
const OUString sProprtyName = OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME);
|
||||
OUString sName;
|
||||
for (sal_Int32 i = 1; aIter != xCreateColumn->get().end();++aIter, i++)
|
||||
{
|
||||
(*aIter)->getPropertyValue(sProprtyName) >>= sName;
|
||||
if ( !aColumnAlias.hasAlias( sName ) )
|
||||
{
|
||||
|
||||
const OUString sError( getOwnConnection()->getResources().getResourceStringWithSubstitution(
|
||||
STR_INVALID_COLUMNNAME,
|
||||
"$columnname$", sName
|
||||
) );
|
||||
::dbtools::throwGenericSQLException(sError,*this);
|
||||
}
|
||||
}
|
||||
MDatabaseMetaDataHelper _aDbHelper;
|
||||
if (!_aDbHelper.NewAddressBook(m_pConnection,ouTableName))
|
||||
{
|
||||
getOwnConnection()->throwSQLException( _aDbHelper.getError(), *this );
|
||||
}
|
||||
m_pSQLIterator.reset( new ::connectivity::OSQLParseTreeIterator(
|
||||
m_pConnection, m_pConnection->createCatalog()->getTables(), m_aParser, NULL ) );
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
getOwnConnection()->throwSQLException( STR_QUERY_TOO_COMPLEX, *this );
|
||||
*/
|
||||
}
|
||||
|
||||
OCommonStatement::StatementType OCommonStatement::parseSql( const OUString& sql , bool bAdjusted)
|
||||
throw ( SQLException, RuntimeException )
|
||||
{
|
||||
@ -242,7 +195,6 @@ OCommonStatement::StatementType OCommonStatement::parseSql( const OUString& sql
|
||||
return eSelect;
|
||||
|
||||
case SQL_STATEMENT_CREATE_TABLE:
|
||||
createTable();
|
||||
return eCreateTable;
|
||||
|
||||
default:
|
||||
|
@ -144,8 +144,6 @@ namespace connectivity
|
||||
void analyseSQL();
|
||||
void setOrderbyColumn( connectivity::OSQLParseNode* pColumnRef,
|
||||
connectivity::OSQLParseNode* pAscendingDescending);
|
||||
void createTable( ) throw (
|
||||
::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
|
||||
|
||||
public:
|
||||
// other methods
|
||||
|
@ -43,7 +43,7 @@ namespace connectivity
|
||||
|
||||
OConnection* getConnection() { return m_pConnection;}
|
||||
|
||||
bool isReadOnly() const { return false; }
|
||||
static bool isReadOnly() { return false; }
|
||||
|
||||
OUString getTableName() const { return m_Name; }
|
||||
OUString getSchema() const { return m_SchemaName; }
|
||||
|
@ -26,9 +26,6 @@
|
||||
#include <com/sun/star/sdbc/IndexType.hpp>
|
||||
#include <comphelper/property.hxx>
|
||||
#include <com/sun/star/lang/DisposedException.hpp>
|
||||
#include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
|
||||
#include <com/sun/star/sdbc/ResultSetType.hpp>
|
||||
#include <com/sun/star/sdbc/FetchDirection.hpp>
|
||||
#include <cppuhelper/typeprovider.hxx>
|
||||
#include <comphelper/sequence.hxx>
|
||||
#include "odbc/OResultSetMetaData.hxx"
|
||||
@ -698,21 +695,6 @@ Any SAL_CALL ODatabaseMetaDataResultSet::getWarnings( ) throw(SQLException, Run
|
||||
return Any();
|
||||
}
|
||||
|
||||
sal_Int32 ODatabaseMetaDataResultSet::getResultSetConcurrency() const throw(SQLException, RuntimeException)
|
||||
{
|
||||
return ResultSetConcurrency::READ_ONLY;
|
||||
}
|
||||
|
||||
sal_Int32 ODatabaseMetaDataResultSet::getResultSetType() const throw(SQLException, RuntimeException)
|
||||
{
|
||||
return ResultSetType::FORWARD_ONLY;
|
||||
}
|
||||
|
||||
sal_Int32 ODatabaseMetaDataResultSet::getFetchDirection() const throw(SQLException, RuntimeException)
|
||||
{
|
||||
return FetchDirection::FORWARD;
|
||||
}
|
||||
|
||||
sal_Int32 ODatabaseMetaDataResultSet::getFetchSize() const throw(SQLException, RuntimeException)
|
||||
{
|
||||
sal_Int32 nValue=1;
|
||||
|
@ -1327,11 +1327,6 @@ sal_Int32 OResultSet::getResultSetType() const
|
||||
return nValue;
|
||||
}
|
||||
|
||||
sal_Int32 OResultSet::getFetchDirection() const
|
||||
{
|
||||
return FetchDirection::FORWARD;
|
||||
}
|
||||
|
||||
sal_Int32 OResultSet::getFetchSize() const
|
||||
{
|
||||
return getStmtOption<SQLULEN, SQL_IS_UINTEGER>(SQL_ATTR_ROW_ARRAY_SIZE);
|
||||
|
@ -124,11 +124,6 @@ std::vector
|
||||
#define DEFERRABILITY_INITIALLY_IMMEDIATE 6
|
||||
#define DEFERRABILITY_NONE 7
|
||||
|
||||
void DatabaseMetaData::checkClosed()
|
||||
throw (SQLException, RuntimeException)
|
||||
{
|
||||
}
|
||||
|
||||
DatabaseMetaData::DatabaseMetaData(
|
||||
const ::rtl::Reference< RefCountedMutex > & refMutex,
|
||||
const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & origin,
|
||||
@ -1110,7 +1105,6 @@ sal_Bool DatabaseMetaData::dataDefinitionIgnoredInTransactions( ) throw (SQLExc
|
||||
// LEM TODO: implement
|
||||
// LEM TODO: at least fake the columns, even if no row.
|
||||
MutexGuard guard( m_refMutex->mutex );
|
||||
checkClosed();
|
||||
return new SequenceResultSet(
|
||||
m_refMutex, *this, Sequence< OUString >(), Sequence< Sequence< Any > > (), m_pSettings->tc );
|
||||
}
|
||||
@ -1123,7 +1117,6 @@ sal_Bool DatabaseMetaData::dataDefinitionIgnoredInTransactions( ) throw (SQLExc
|
||||
{
|
||||
(void) catalog; (void) schemaPattern; (void) procedureNamePattern; (void) columnNamePattern;
|
||||
MutexGuard guard( m_refMutex->mutex );
|
||||
checkClosed();
|
||||
// LEM TODO: implement
|
||||
// LEM TODO: at least fake the columns, even if no row.
|
||||
return new SequenceResultSet(
|
||||
@ -1141,7 +1134,6 @@ sal_Bool DatabaseMetaData::dataDefinitionIgnoredInTransactions( ) throw (SQLExc
|
||||
Statics &statics = getStatics();
|
||||
|
||||
MutexGuard guard( m_refMutex->mutex );
|
||||
checkClosed();
|
||||
|
||||
if( isLog( m_pSettings, LogLevel::INFO ) )
|
||||
{
|
||||
@ -1259,7 +1251,6 @@ struct SortInternalSchemasLastAndPublicFirst
|
||||
throw (SQLException, RuntimeException, std::exception)
|
||||
{
|
||||
MutexGuard guard( m_refMutex->mutex );
|
||||
checkClosed();
|
||||
|
||||
if( isLog( m_pSettings, LogLevel::INFO ) )
|
||||
{
|
||||
@ -1297,7 +1288,6 @@ struct SortInternalSchemasLastAndPublicFirst
|
||||
// LEM TODO: return the current catalog like JDBC driver?
|
||||
// at least fake the columns, even if no content
|
||||
MutexGuard guard( m_refMutex->mutex );
|
||||
checkClosed();
|
||||
return new SequenceResultSet(
|
||||
m_refMutex, *this, Sequence< OUString >(), Sequence< Sequence< Any > > (), m_pSettings->tc );
|
||||
}
|
||||
@ -1307,7 +1297,6 @@ struct SortInternalSchemasLastAndPublicFirst
|
||||
{
|
||||
// LEM TODO: this can be made dynamic, see JDBC driver
|
||||
MutexGuard guard( m_refMutex->mutex );
|
||||
checkClosed();
|
||||
return new SequenceResultSet(
|
||||
m_refMutex, *this, getStatics().tableTypeNames, getStatics().tableTypeData,
|
||||
m_pSettings->tc );
|
||||
@ -1471,7 +1460,6 @@ static void columnMetaData2DatabaseTypeDescription(
|
||||
|
||||
// continue !
|
||||
MutexGuard guard( m_refMutex->mutex );
|
||||
checkClosed();
|
||||
|
||||
if( isLog( m_pSettings, LogLevel::INFO ) )
|
||||
{
|
||||
@ -1655,7 +1643,6 @@ static void columnMetaData2DatabaseTypeDescription(
|
||||
(void) catalog;
|
||||
|
||||
MutexGuard guard( m_refMutex->mutex );
|
||||
checkClosed();
|
||||
|
||||
if( isLog( m_pSettings, LogLevel::INFO ) )
|
||||
{
|
||||
@ -1680,13 +1667,11 @@ static void columnMetaData2DatabaseTypeDescription(
|
||||
}
|
||||
|
||||
::com::sun::star::uno::Reference< XResultSet > DatabaseMetaData::getTablePrivileges(
|
||||
const ::com::sun::star::uno::Any& catalog,
|
||||
const ::com::sun::star::uno::Any&,
|
||||
const OUString& schemaPattern,
|
||||
const OUString& tableNamePattern ) throw (SQLException, RuntimeException, std::exception)
|
||||
{
|
||||
(void) catalog;
|
||||
MutexGuard guard( m_refMutex->mutex );
|
||||
checkClosed();
|
||||
|
||||
if( isLog( m_pSettings, LogLevel::INFO ) )
|
||||
{
|
||||
@ -1708,42 +1693,36 @@ static void columnMetaData2DatabaseTypeDescription(
|
||||
}
|
||||
|
||||
::com::sun::star::uno::Reference< XResultSet > DatabaseMetaData::getBestRowIdentifier(
|
||||
const ::com::sun::star::uno::Any& catalog,
|
||||
const OUString& schema,
|
||||
const OUString& table,
|
||||
sal_Int32 scope,
|
||||
sal_Bool nullable ) throw (SQLException, RuntimeException, std::exception)
|
||||
const ::com::sun::star::uno::Any&,
|
||||
const OUString&,
|
||||
const OUString&,
|
||||
sal_Int32,
|
||||
sal_Bool ) throw (SQLException, RuntimeException, std::exception)
|
||||
{
|
||||
(void) catalog; (void) schema; (void) table; (void) scope; (void) nullable;
|
||||
//LEM TODO: implement! See JDBC driver
|
||||
MutexGuard guard( m_refMutex->mutex );
|
||||
checkClosed();
|
||||
return new SequenceResultSet(
|
||||
m_refMutex, *this, Sequence< OUString >(), Sequence< Sequence< Any > > (), m_pSettings->tc );
|
||||
}
|
||||
|
||||
::com::sun::star::uno::Reference< XResultSet > DatabaseMetaData::getVersionColumns(
|
||||
const ::com::sun::star::uno::Any& catalog,
|
||||
const OUString& schema,
|
||||
const OUString& table ) throw (SQLException, RuntimeException, std::exception)
|
||||
const ::com::sun::star::uno::Any&,
|
||||
const OUString&,
|
||||
const OUString& ) throw (SQLException, RuntimeException, std::exception)
|
||||
{
|
||||
(void) catalog; (void) schema; (void) table;
|
||||
//LEM TODO: implement! See JDBC driver
|
||||
MutexGuard guard( m_refMutex->mutex );
|
||||
checkClosed();
|
||||
return new SequenceResultSet(
|
||||
m_refMutex, *this, Sequence< OUString >(), Sequence< Sequence< Any > > (), m_pSettings->tc );
|
||||
}
|
||||
|
||||
::com::sun::star::uno::Reference< XResultSet > DatabaseMetaData::getPrimaryKeys(
|
||||
const ::com::sun::star::uno::Any& catalog,
|
||||
const ::com::sun::star::uno::Any&,
|
||||
const OUString& schema,
|
||||
const OUString& table ) throw (SQLException, RuntimeException, std::exception)
|
||||
{
|
||||
(void) catalog;
|
||||
//LEM TODO: review
|
||||
MutexGuard guard( m_refMutex->mutex );
|
||||
checkClosed();
|
||||
|
||||
// 1. TABLE_CAT string => table catalog (may be NULL )
|
||||
// 2. TABLE_SCHEM string => table schema (may be NULL )
|
||||
@ -2307,7 +2286,6 @@ static void pgTypeInfo2ResultSet(
|
||||
{
|
||||
// Note: Indexes start at 0 (in the API doc, they start at 1)
|
||||
MutexGuard guard( m_refMutex->mutex );
|
||||
checkClosed();
|
||||
|
||||
if( isLog( m_pSettings, LogLevel::INFO ) )
|
||||
{
|
||||
@ -2367,16 +2345,14 @@ static sal_Int32 seqContains( const Sequence< sal_Int32 > &seq, sal_Int32 value
|
||||
}
|
||||
|
||||
::com::sun::star::uno::Reference< XResultSet > DatabaseMetaData::getIndexInfo(
|
||||
const ::com::sun::star::uno::Any& catalog,
|
||||
const ::com::sun::star::uno::Any& ,
|
||||
const OUString& schema,
|
||||
const OUString& table,
|
||||
sal_Bool unique,
|
||||
sal_Bool approximate ) throw (SQLException, RuntimeException, std::exception)
|
||||
sal_Bool ) throw (SQLException, RuntimeException, std::exception)
|
||||
{
|
||||
(void) catalog; (void) approximate;
|
||||
//LEM TODO: review
|
||||
MutexGuard guard( m_refMutex->mutex );
|
||||
checkClosed();
|
||||
|
||||
/*
|
||||
1. TABLE_CAT string -> table catalog (may be NULL )
|
||||
@ -2562,12 +2538,10 @@ sal_Bool DatabaseMetaData::supportsBatchUpdates( ) throw (SQLException, Runtime
|
||||
return sal_True;
|
||||
}
|
||||
|
||||
::com::sun::star::uno::Reference< XResultSet > DatabaseMetaData::getUDTs( const ::com::sun::star::uno::Any& catalog, const OUString& schemaPattern, const OUString& typeNamePattern, const ::com::sun::star::uno::Sequence< sal_Int32 >& types ) throw (SQLException, RuntimeException, std::exception)
|
||||
css::uno::Reference< XResultSet > DatabaseMetaData::getUDTs( const ::com::sun::star::uno::Any&, const OUString&, const OUString&, const ::com::sun::star::uno::Sequence< sal_Int32 >& ) throw (SQLException, RuntimeException, std::exception)
|
||||
{
|
||||
(void) catalog; (void) schemaPattern; (void) typeNamePattern; (void) types;
|
||||
//LEM TODO: implement! See JDBC driver
|
||||
MutexGuard guard( m_refMutex->mutex );
|
||||
checkClosed();
|
||||
return new SequenceResultSet(
|
||||
m_refMutex, *this, Sequence< OUString >(), Sequence< Sequence< Any > > (), m_pSettings->tc );
|
||||
}
|
||||
|
@ -56,7 +56,6 @@ class DatabaseMetaData :
|
||||
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XPreparedStatement > m_getTablePrivs_stmt;
|
||||
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XPreparedStatement > m_getColumnPrivs_stmt;
|
||||
|
||||
void checkClosed() throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
|
||||
sal_Int32 getIntSetting(const OUString& settingName) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
|
||||
sal_Int32 getMaxIndexKeys() throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
|
||||
sal_Int32 getMaxNameLength() throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
|
||||
|
@ -333,7 +333,6 @@ sal_Int32 ResultSetMetaData::getColumnDisplaySize( sal_Int32 column )
|
||||
throw (SQLException, RuntimeException, std::exception)
|
||||
{
|
||||
MutexGuard guard( m_refMutex->mutex );
|
||||
checkClosed();
|
||||
checkColumnIndex( column );
|
||||
return m_colDesc[column-1].displaySize;
|
||||
}
|
||||
@ -347,7 +346,6 @@ OUString ResultSetMetaData::getColumnLabel( sal_Int32 column )
|
||||
OUString ResultSetMetaData::getColumnName( sal_Int32 column ) throw (SQLException, RuntimeException, std::exception)
|
||||
{
|
||||
MutexGuard guard( m_refMutex->mutex );
|
||||
checkClosed();
|
||||
checkColumnIndex( column );
|
||||
|
||||
return m_colDesc[column-1].name;
|
||||
@ -363,7 +361,6 @@ sal_Int32 ResultSetMetaData::getPrecision( sal_Int32 column )
|
||||
throw (SQLException, RuntimeException, std::exception)
|
||||
{
|
||||
MutexGuard guard( m_refMutex->mutex );
|
||||
checkClosed();
|
||||
checkColumnIndex( column );
|
||||
return m_colDesc[column-1].precision;
|
||||
}
|
||||
@ -372,23 +369,20 @@ sal_Int32 ResultSetMetaData::getScale( sal_Int32 column )
|
||||
throw (SQLException, RuntimeException, std::exception)
|
||||
{
|
||||
MutexGuard guard( m_refMutex->mutex );
|
||||
checkClosed();
|
||||
checkColumnIndex( column );
|
||||
return m_colDesc[column-1].scale;
|
||||
}
|
||||
|
||||
OUString ResultSetMetaData::getTableName( sal_Int32 column )
|
||||
OUString ResultSetMetaData::getTableName( sal_Int32 )
|
||||
throw (SQLException, RuntimeException, std::exception)
|
||||
{
|
||||
(void) column;
|
||||
// LEM TODO This is very fishy.. Should probably return the table to which that column belongs!
|
||||
return m_tableName;
|
||||
}
|
||||
|
||||
OUString ResultSetMetaData::getCatalogName( sal_Int32 column )
|
||||
OUString ResultSetMetaData::getCatalogName( sal_Int32 )
|
||||
throw (SQLException, RuntimeException, std::exception)
|
||||
{
|
||||
(void) column;
|
||||
// can do this through XConnection.getCatalog() !
|
||||
return OUString();
|
||||
}
|
||||
@ -458,12 +452,6 @@ OUString ResultSetMetaData::getColumnServiceName( sal_Int32 column )
|
||||
return OUString();
|
||||
}
|
||||
|
||||
void ResultSetMetaData::checkClosed()
|
||||
throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
|
||||
{
|
||||
// we never close
|
||||
}
|
||||
|
||||
void ResultSetMetaData::checkColumnIndex(sal_Int32 columnIndex)
|
||||
throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
|
||||
{
|
||||
|
@ -81,8 +81,6 @@ class ResultSetMetaData :
|
||||
|
||||
sal_Int32 m_colCount;
|
||||
|
||||
void checkClosed()
|
||||
throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
|
||||
void checkColumnIndex( sal_Int32 columnIndex )
|
||||
throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
|
||||
void checkTable();
|
||||
|
@ -20,6 +20,9 @@
|
||||
#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_ODATABASEMETADATARESULTSET_HXX
|
||||
#define INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_ODATABASEMETADATARESULTSET_HXX
|
||||
|
||||
#include <com/sun/star/sdbc/ResultSetType.hpp>
|
||||
#include <com/sun/star/sdbc/FetchDirection.hpp>
|
||||
#include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
|
||||
#include <com/sun/star/sdbc/XResultSet.hpp>
|
||||
#include <com/sun/star/sdbc/XRow.hpp>
|
||||
#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
|
||||
@ -80,9 +83,9 @@ namespace connectivity
|
||||
|
||||
// set the columncount of the driver
|
||||
void checkColumnCount();
|
||||
sal_Int32 getResultSetConcurrency() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
|
||||
sal_Int32 getResultSetType() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
|
||||
sal_Int32 getFetchDirection() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
|
||||
static sal_Int32 getResultSetConcurrency() { return css::sdbc::ResultSetConcurrency::READ_ONLY; }
|
||||
static sal_Int32 getResultSetType() { return css::sdbc::ResultSetType::FORWARD_ONLY; }
|
||||
static sal_Int32 getFetchDirection() { return css::sdbc::FetchDirection::FORWARD; }
|
||||
sal_Int32 getFetchSize() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
|
||||
OUString getCursorName() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
|
||||
SWORD impl_getColumnType_nothrow(sal_Int32 columnIndex);
|
||||
|
@ -20,6 +20,7 @@
|
||||
#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_ORESULTSET_HXX
|
||||
#define INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_ORESULTSET_HXX
|
||||
|
||||
#include <com/sun/star/sdbc/FetchDirection.hpp>
|
||||
#include <com/sun/star/sdbc/XResultSet.hpp>
|
||||
#include <com/sun/star/sdbc/XRow.hpp>
|
||||
#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
|
||||
@ -154,7 +155,7 @@ namespace connectivity
|
||||
bool isBookmarkable() const;
|
||||
sal_Int32 getResultSetConcurrency() const;
|
||||
sal_Int32 getResultSetType() const;
|
||||
sal_Int32 getFetchDirection() const;
|
||||
static sal_Int32 getFetchDirection() { return css::sdbc::FetchDirection::FORWARD; }
|
||||
sal_Int32 getFetchSize() const;
|
||||
OUString getCursorName() const;
|
||||
template < typename T, SQLINTEGER BufferLength > T getStmtOption (SQLINTEGER fOption, T dflt = 0) const;
|
||||
|
@ -30,15 +30,14 @@ namespace dbtools
|
||||
{
|
||||
class OOO_DLLPUBLIC_DBTOOLS OPropertyMap
|
||||
{
|
||||
::std::map<sal_Int32 , rtl_uString*> m_aPropertyMap;
|
||||
::std::map<sal_Int32, OUString> m_aPropertyMap;
|
||||
|
||||
OUString fillValue(sal_Int32 _nIndex);
|
||||
void fillValue(sal_Int32 _nIndex);
|
||||
public:
|
||||
OPropertyMap()
|
||||
{
|
||||
}
|
||||
~OPropertyMap();
|
||||
OUString getNameByIndex(sal_Int32 _nIndex) const;
|
||||
const OUString& getNameByIndex(sal_Int32 _nIndex) const;
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -131,7 +131,6 @@ class SubstitutePathVariables_Impl : public utl::ConfigItem
|
||||
virtual void ImplCommit() SAL_OVERRIDE;
|
||||
|
||||
// Wrapper methods for low-level functions
|
||||
static OperatingSystem GetOperatingSystem();
|
||||
const OUString& GetYPDomainName();
|
||||
const OUString& GetDNSDomainName();
|
||||
const OUString& GetNTDomainName();
|
||||
@ -464,7 +463,7 @@ void SubstitutePathVariables_Impl::ImplCommit()
|
||||
{
|
||||
}
|
||||
|
||||
inline OperatingSystem SubstitutePathVariables_Impl::GetOperatingSystem()
|
||||
static inline OperatingSystem GetOperatingSystem()
|
||||
{
|
||||
#ifdef SOLARIS
|
||||
return OS_SOLARIS;
|
||||
|
@ -67,7 +67,6 @@ public:
|
||||
// Execution of DDE-Commands
|
||||
SbxVariable* Execute( const OUString& );
|
||||
// Manage elements
|
||||
bool GetAll( SbxClassType ) { return true; }
|
||||
SbxVariable* Make( const OUString&, SbxClassType, SbxDataType, bool bIsRuntimeFunction = false );
|
||||
virtual void Insert( SbxVariable* );
|
||||
// AB 23.4.1997, Optimization, Insertion without check for duplicate Entries and
|
||||
|
@ -198,13 +198,6 @@ namespace dbtools
|
||||
*/
|
||||
void resetParameterValues();
|
||||
|
||||
/** tells the object that it's database component is being disposed
|
||||
|
||||
The object then fires the <member>XEventListener::disposing</member> notification to
|
||||
the parameter listeners
|
||||
*/
|
||||
void disposing( const ::com::sun::star::lang::EventObject& _rDisposingEvent );
|
||||
|
||||
/** adds the given listener to the list of parameter listeners
|
||||
*/
|
||||
void addParameterListener(
|
||||
|
Loading…
x
Reference in New Issue
Block a user