Branch data 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 _CONNECTIVITY_SQLSCAN_HXX
20 : : #define _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 : : ::rtl::OString m_sStatement; // statement to parse
37 : : ::rtl::OUString m_sErrorMessage;
38 : :
39 : : sal_Int32 m_nCurrentPos; // next position to read from the statement
40 : : sal_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 : 52 : inline static void * SAL_CALL operator new( size_t nSize ) SAL_THROW(())
48 : 52 : { return ::rtl_allocateMemory( nSize ); }
49 : : inline static void * SAL_CALL operator new( size_t,void* _pHint ) SAL_THROW(())
50 : : { return _pHint; }
51 : 52 : inline static void SAL_CALL operator delete( void * pMem ) SAL_THROW(())
52 : 52 : { ::rtl_freeMemory( pMem ); }
53 : : inline static void SAL_CALL operator delete( void *,void* ) SAL_THROW(())
54 : : { }
55 : :
56 : : virtual sal_Int32 SQLyygetc(void);
57 : : virtual void SQLyyerror(char *fmt);
58 : 0 : virtual void output(sal_Int32) { OSL_FAIL("Internal error in sdblex.l: output not possible"); }
59 : 0 : virtual void ECHO(void) { OSL_FAIL("Internal error in sdblex.l: ECHO not possible"); }
60 : : virtual IParseContext::InternationalKeyCode getInternationalTokenID(const char* sToken) const;
61 : :
62 : : // setting the new information before scanning
63 : : void prepareScan(const ::rtl::OUString & rNewStatement, const IParseContext* pContext, sal_Bool bInternational);
64 : 2 : const ::rtl::OUString& getErrorMessage() const {return m_sErrorMessage;}
65 : 72 : ::rtl::OString getStatement() const { return m_sStatement; }
66 : :
67 : : sal_Int32 SQLlex();
68 : : // set this as scanner for flex
69 : : void setScanner(sal_Bool _bNull=sal_False);
70 : : // rules settings
71 : 560 : void SetRule(sal_Int32 nRule) {m_nRule = nRule;}
72 : : sal_Int32 GetGERRule() const;
73 : : sal_Int32 GetENGRule() const;
74 : : sal_Int32 GetSQLRule() const;
75 : : sal_Int32 GetDATERule() const;
76 : : sal_Int32 GetSTRINGRule() const;
77 : 72 : inline sal_Int32 GetCurrentPos() const { return m_nCurrentPos; }
78 : : };
79 : : }
80 : :
81 : : #endif
82 : :
83 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|