xref: /AOO41X/main/connectivity/inc/connectivity/IParseContext.hxx (revision caf5cd79edad04a48dcaf209068b3b89eae4622e)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef CONNECTIVITY_IPARSECONTEXT_HXX
24 #define CONNECTIVITY_IPARSECONTEXT_HXX
25 
26 namespace connectivity { class OSQLParseNode; }
27 
28 #include <rtl/ustring.hxx>
29 #include <com/sun/star/lang/Locale.hpp>
30 #include "connectivity/dbtoolsdllapi.hxx"
31 
32 namespace connectivity
33 {
34     //==========================================================================
35     //= IParseContext
36     //==========================================================================
37     class IParseContext
38     {
39     public:
40         enum    ErrorCode
41         {
42             ERROR_NONE      = 0,
43             ERROR_GENERAL,                  // "Syntax error in SQL expression"
44             ERROR_VALUE_NO_LIKE,            // "The value #1 can not be used with LIKE."
45             ERROR_FIELD_NO_LIKE,            // "LIKE can not be used with this field."
46             ERROR_INVALID_COMPARE,          // "The entered criterion can not be compared with this field."
47             ERROR_INVALID_INT_COMPARE,      // "The field can not be compared with a number."
48             ERROR_INVALID_DATE_COMPARE,     // "The field can not be compared with a date."
49             ERROR_INVALID_REAL_COMPARE,     // "The field can not be compared with a floating point number."
50             ERROR_INVALID_TABLE,            // "The database does not contain a table named \"#\"."
51             ERROR_INVALID_TABLE_OR_QUERY,   // "The database does contain neither a table nor a query named \"#\"."
52             ERROR_INVALID_COLUMN,           // "The column \"#1\" is unknown in the table \"#2\"."
53             ERROR_INVALID_TABLE_EXIST,      // "The database already contains a table or view with name \"#\"."
54             ERROR_INVALID_QUERY_EXIST       // "The database already contains a query with name \"#\".";
55         };
56 
57         enum    InternationalKeyCode
58         {
59             KEY_NONE = 0,
60             KEY_LIKE,
61             KEY_NOT,
62             KEY_NULL,
63             KEY_TRUE,
64             KEY_FALSE,
65             KEY_IS,
66             KEY_BETWEEN,
67             KEY_OR,
68             KEY_AND,
69             KEY_AVG,
70             KEY_COUNT,
71             KEY_MAX,
72             KEY_MIN,
73             KEY_SUM,
74             KEY_EVERY,
75             KEY_ANY,
76             KEY_SOME,
77             KEY_STDDEV_POP,
78             KEY_STDDEV_SAMP,
79             KEY_VAR_SAMP,
80             KEY_VAR_POP,
81             KEY_COLLECT,
82             KEY_FUSION,
83             KEY_INTERSECTION
84         };
85 
86     public:
87         // retrieves language specific error messages
88         virtual ::rtl::OUString getErrorMessage(ErrorCode _eCodes) const = 0;
89 
90         // retrieves language specific keyword strings (only ASCII allowed)
91         virtual ::rtl::OString getIntlKeywordAscii(InternationalKeyCode _eKey) const = 0;
92 
93         // finds out, if we have an international keyword (only ASCII allowed)
94         virtual InternationalKeyCode getIntlKeyCode(const ::rtl::OString& rToken) const = 0;
95 
96         /** get's a locale instance which should be used when parsing in the context specified by this instance
97             <p>if this is not overridden by derived classes, it returns the static default locale.</p>
98         */
99         virtual ::com::sun::star::lang::Locale getPreferredLocale( ) const = 0;
100     };
101 }
102 
103 #endif // CONNECTIVITY_IPARSECONTEXT_HXX
104 
105