1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_CONNECTIVITY_PREDICATEINPUT_HXX
21 #define INCLUDED_CONNECTIVITY_PREDICATEINPUT_HXX
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 #include <com/sun/star/uno/Any.hxx>
38 //= OPredicateInputController
40 /** A class which allows input of an SQL predicate for a row set column
43 class OOO_DLLPUBLIC_DBTOOLS OPredicateInputController
46 ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XConnection
>
48 ::com::sun::star::uno::Reference
< ::com::sun::star::util::XNumberFormatter
>
50 ::com::sun::star::uno::Reference
< ::com::sun::star::i18n::XLocaleData4
>
53 ::connectivity::OSQLParser
57 OPredicateInputController(
58 const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>& rxContext
,
59 const ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XConnection
>& _rxConnection
,
60 const ::connectivity::IParseContext
* _pParseContext
= NULL
63 /** transforms a "raw" predicate value (usually obtained from a user input) into a valid predicate for the given column
64 @param _rPredicateValue
65 The text to normalize.
67 The field for which the text should be a predicate value.
69 If not <NULL/>, and a parsing error occurs, the error message will be copied to the string the argument
72 bool normalizePredicateString(
73 OUString
& _rPredicateValue
,
74 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& _rxField
,
75 OUString
* _pErrorMessage
= NULL
78 /** get the value of the predicate, as a string to be used in a WHERE clause
79 @param _rPredicateValue
80 the value which has been normalized using normalizePredicateString
82 is the field for which a predicate is to be entered
84 If not <NULL/>, and a parsing error occurs, the error message will be copied to the string the argument
86 @see normalizePredicateString
88 OUString
getPredicateValueStr(
89 const OUString
& _rPredicateValue
,
90 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
> & _rxField
,
91 OUString
* _pErrorMessage
= NULL
94 OUString
getPredicateValueStr(
95 const OUString
& _sField
96 , const OUString
& _rPredicateValue
97 , OUString
* _pErrorMessage
= NULL
) const;
99 /** get the value of the predicate, either as an empty or as a string
100 @param _rPredicateValue
101 the value which has been normalized using normalizePredicateString
103 is the field for which a predicate is to be entered
104 @param _pErrorMessage
105 If not <NULL/>, and a parsing error occurs, the error message will be copied to the string the argument
107 @see normalizePredicateString
109 ::com::sun::star::uno::Any
getPredicateValue(
110 const OUString
& _rPredicateValue
,
111 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
> & _rxField
,
112 OUString
* _pErrorMessage
= NULL
116 ::connectivity::OSQLParseNode
* implPredicateTree(
117 OUString
& _rErrorMessage
,
118 const OUString
& _rStatement
,
119 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
> & _rxField
122 bool getSeparatorChars(
123 const ::com::sun::star::lang::Locale
& _rLocale
,
124 sal_Unicode
& _rDecSep
,
125 sal_Unicode
& _rThdSep
128 ::com::sun::star::uno::Any
implParseNode(::connectivity::OSQLParseNode
* pParseNode
, bool _bForStatementUse
) const;
132 } // namespace dbtools
135 #endif // INCLUDED_CONNECTIVITY_PREDICATEINPUT_HXX
137 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */