merge the formfield patch from ooo-build
[ooovba.git] / connectivity / source / inc / sqlscan.hxx
bloba2afa33fe843749f51eb34fe3c9b5348cdf40d39
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: sqlscan.hxx,v $
10 * $Revision: 1.10 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _CONNECTIVITY_SQLSCAN_HXX
31 #define _CONNECTIVITY_SQLSCAN_HXX
33 #include <stdarg.h>
34 #include "connectivity/IParseContext.hxx"
35 #include "connectivity/dbtoolsdllapi.hxx"
37 namespace connectivity
39 //==========================================================================
40 //= OSQLScanner
41 //==========================================================================
42 /** Scanner for SQL92
44 class OOO_DLLPUBLIC_DBTOOLS OSQLScanner
46 const IParseContext* m_pContext; // context for parse, knows all international stuff
47 ::rtl::OString m_sStatement; // statement to parse
48 ::rtl::OUString m_sErrorMessage;
50 sal_Int32 m_nCurrentPos; // next position to read from the statement
51 sal_Bool m_bInternational; // do we have a statement which may uses
52 sal_Int32 m_nRule; // rule to be set
54 public:
55 OSQLScanner();
56 virtual ~OSQLScanner();
58 inline static void * SAL_CALL operator new( size_t nSize ) SAL_THROW( () )
59 { return ::rtl_allocateMemory( nSize ); }
60 inline static void * SAL_CALL operator new( size_t,void* _pHint ) SAL_THROW( () )
61 { return _pHint; }
62 inline static void SAL_CALL operator delete( void * pMem ) SAL_THROW( () )
63 { ::rtl_freeMemory( pMem ); }
64 inline static void SAL_CALL operator delete( void *,void* ) SAL_THROW( () )
65 { }
67 virtual sal_Int32 SQLyygetc(void);
68 virtual void SQLyyerror(char *fmt);
69 virtual void output(sal_Int32) { OSL_ASSERT("Internal error in sdblex.l: output not possible"); }
70 virtual void ECHO(void) { OSL_ASSERT("Internal error in sdblex.l: ECHO not possible"); }
71 virtual IParseContext::InternationalKeyCode getInternationalTokenID(const char* sToken) const;
73 // setting the new information before scanning
74 void prepareScan(const ::rtl::OUString & rNewStatement, const IParseContext* pContext, sal_Bool bInternational);
75 const ::rtl::OUString& getErrorMessage() const {return m_sErrorMessage;}
76 ::rtl::OString getStatement() const { return m_sStatement; }
78 sal_Int32 SQLlex();
79 // set this as scanner for flex
80 void setScanner(sal_Bool _bNull=sal_False);
81 // rules settings
82 void SetRule(sal_Int32 nRule) {m_nRule = nRule;}
83 sal_Int32 GetCurrentRule() const;
84 sal_Int32 GetGERRule() const;
85 sal_Int32 GetENGRule() const;
86 sal_Int32 GetSQLRule() const;
87 sal_Int32 GetDATERule() const;
88 sal_Int32 GetSTRINGRule() const;
89 inline sal_Int32 GetCurrentPos() const { return m_nCurrentPos; }
93 #endif