LCOV - code coverage report
Current view: top level - include/connectivity - predicateinput.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 1 0.0 %
Date: 2014-04-14 Functions: 0 1 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #ifndef INCLUDED_CONNECTIVITY_PREDICATEINPUT_HXX
      21             : #define INCLUDED_CONNECTIVITY_PREDICATEINPUT_HXX
      22             : 
      23             : #include <com/sun/star/beans/XPropertySet.hpp>
      24             : #include <com/sun/star/uno/XComponentContext.hpp>
      25             : #include <com/sun/star/sdbc/XConnection.hpp>
      26             : #include <com/sun/star/util/XNumberFormatter.hpp>
      27             : #include <com/sun/star/i18n/XLocaleData4.hpp>
      28             : #include <connectivity/sqlparse.hxx>
      29             : #include <connectivity/dbtoolsdllapi.hxx>
      30             : 
      31             : 
      32             : namespace dbtools
      33             : {
      34             : 
      35             : 
      36             : 
      37             :     //= OPredicateInputController
      38             : 
      39             :     /** A class which allows input of an SQL predicate for a row set column
      40             :         into a edit field.
      41             :     */
      42           0 :     class OOO_DLLPUBLIC_DBTOOLS OPredicateInputController
      43             :     {
      44             :     private:
      45             :         ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >
      46             :                 m_xConnection;
      47             :         ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >
      48             :                 m_xFormatter;
      49             :         ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XLocaleData4 >
      50             :                 m_xLocaleData;
      51             : 
      52             :         ::connectivity::OSQLParser
      53             :                 m_aParser;
      54             : 
      55             :     public:
      56             :         OPredicateInputController(
      57             :             const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
      58             :             const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
      59             :             const ::connectivity::IParseContext* _pParseContext = NULL
      60             :         );
      61             : 
      62             :         /** transforms a "raw" predicate value (usually obtained from a user input) into a valid predicate for the given column
      63             :         @param _rPredicateValue
      64             :             The text to normalize.
      65             :         @param _rxField
      66             :             The field for which the text should be a predicate value.
      67             :         @param _pErrorMessage
      68             :             If not <NULL/>, and a parsing error occurs, the error message will be copied to the string the argument
      69             :             points to.
      70             :         */
      71             :         bool        normalizePredicateString(
      72             :             OUString& _rPredicateValue,
      73             :             const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxField,
      74             :             OUString* _pErrorMessage = NULL
      75             :         ) const;
      76             : 
      77             :         /** get's a value of the predicate which can be used in a WHERE clause.
      78             :         @param _rPredicateValue
      79             :             the value which has been normalized using normalizePredicateString
      80             :         @param _rxField
      81             :             is the field for which a predicate is to be entered
      82             :         @param _bForStatementUse
      83             :             If <TRUE/>, the returned value can be used in an SQL statement. If <FALSE/>, it can be used
      84             :             for instance for setting parameter values.
      85             :         @param _pErrorMessage
      86             :             If not <NULL/>, and a parsing error occurs, the error message will be copied to the string the argument
      87             :             points to.
      88             :         @see normalizePredicateString
      89             :         */
      90             :         OUString getPredicateValue(
      91             :             const OUString& _rPredicateValue,
      92             :             const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & _rxField,
      93             :             bool _bForStatementUse,
      94             :             OUString* _pErrorMessage = NULL
      95             :         ) const;
      96             : 
      97             :         OUString getPredicateValue(
      98             :             const OUString& _sField
      99             :             , const OUString& _rPredicateValue
     100             :             , bool _bForStatementUse
     101             :             , OUString* _pErrorMessage = NULL) const;
     102             : 
     103             :     private:
     104             :         ::connectivity::OSQLParseNode* implPredicateTree(
     105             :             OUString& _rErrorMessage,
     106             :             const OUString& _rStatement,
     107             :             const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & _rxField
     108             :         ) const;
     109             : 
     110             :         bool getSeparatorChars(
     111             :             const ::com::sun::star::lang::Locale& _rLocale,
     112             :             sal_Unicode& _rDecSep,
     113             :             sal_Unicode& _rThdSep
     114             :         ) const;
     115             : 
     116             :         OUString implParseNode(::connectivity::OSQLParseNode* pParseNode, bool _bForStatementUse) const;
     117             :     };
     118             : 
     119             : 
     120             : }   // namespace dbtools
     121             : 
     122             : 
     123             : #endif // INCLUDED_CONNECTIVITY_PREDICATEINPUT_HXX
     124             : 
     125             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10