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 : #ifndef INCLUDED_CONNECTIVITY_SQLSCAN_HXX
20 : #define INCLUDED_CONNECTIVITY_SQLSCAN_HXX
21 :
22 : #include <stdarg.h>
23 : #include <connectivity/IParseContext.hxx>
24 : #include <connectivity/dbtoolsdllapi.hxx>
25 :
26 : namespace connectivity
27 : {
28 :
29 : //= OSQLScanner
30 :
31 : /** Scanner for SQL92
32 : */
33 : class OOO_DLLPUBLIC_DBTOOLS OSQLScanner
34 : {
35 : const IParseContext* m_pContext; // context for parse, knows all international stuff
36 : OString m_sStatement; // statement to parse
37 : OUString m_sErrorMessage;
38 :
39 : sal_Int32 m_nCurrentPos; // next position to read from the statement
40 : bool m_bInternational; // do we have a statement which may uses
41 : sal_Int32 m_nRule; // rule to be set
42 :
43 : public:
44 : OSQLScanner();
45 : virtual ~OSQLScanner();
46 :
47 132 : inline static void * SAL_CALL operator new( size_t nSize )
48 132 : { return ::rtl_allocateMemory( nSize ); }
49 : inline static void * SAL_CALL operator new( size_t,void* _pHint )
50 : { return _pHint; }
51 132 : inline static void SAL_CALL operator delete( void * pMem )
52 132 : { ::rtl_freeMemory( pMem ); }
53 : inline static void SAL_CALL operator delete( void *,void* )
54 : { }
55 :
56 : sal_Int32 SQLyygetc();
57 : void SQLyyerror(char const *fmt);
58 : static void output(sal_Int32) { OSL_FAIL("Internal error in sdblex.l: output not possible"); }
59 : static void ECHO() { OSL_FAIL("Internal error in sdblex.l: ECHO not possible"); }
60 : IParseContext::InternationalKeyCode getInternationalTokenID(const char* sToken) const;
61 :
62 : // setting the new information before scanning
63 : void prepareScan(const OUString & rNewStatement, const IParseContext* pContext, bool bInternational);
64 67 : const OUString& getErrorMessage() const {return m_sErrorMessage;}
65 0 : OString getStatement() const { return m_sStatement; }
66 :
67 : static sal_Int32 SQLlex();
68 : // set this as scanner for flex
69 : void setScanner(bool _bNull=false);
70 : // rules settings
71 575 : void SetRule(sal_Int32 nRule) {m_nRule = nRule;}
72 : static sal_Int32 GetGERRule();
73 : static sal_Int32 GetENGRule();
74 : static sal_Int32 GetSQLRule();
75 : static sal_Int32 GetDATERule();
76 : static sal_Int32 GetSTRINGRule();
77 0 : inline sal_Int32 GetCurrentPos() const { return m_nCurrentPos; }
78 : };
79 : }
80 :
81 : #endif
82 :
83 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|