]> err.no Git - sope/blob - sope-appserver/NGObjWeb/WebDAV/SoDAVSQLParser.h
fixed umlaut issue on MacOSX
[sope] / sope-appserver / NGObjWeb / WebDAV / SoDAVSQLParser.h
1 /*
2   Copyright (C) 2000-2004 SKYRIX Software AG
3
4   This file is part of OpenGroupware.org.
5
6   OGo is free software; you can redistribute it and/or modify it under
7   the terms of the GNU Lesser General Public License as published by the
8   Free Software Foundation; either version 2, or (at your option) any
9   later version.
10
11   OGo is distributed in the hope that it will be useful, but WITHOUT ANY
12   WARRANTY; without even the implied warranty of MERCHANTABILITY or
13   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
14   License for more details.
15
16   You should have received a copy of the GNU Lesser General Public
17   License along with OGo; see the file COPYING.  If not, write to the
18   Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
19   02111-1307, USA.
20 */
21 // $Id$
22
23 #ifndef __WebDAV_SoDAVSQLParser_H__
24 #define __WebDAV_SoDAVSQLParser_H__
25
26 #import <Foundation/NSObject.h>
27 #import <Foundation/NSString.h>
28
29 /*
30   This is parser can be used to parse simple SQL statements. It's not a full
31   SQL implementation, but should be sufficient for simple applications.
32
33   Additional hints:
34   - the selected attributes are added to the 'attributes' hint, if a
35     wildcard select is used (*), the hint is not set
36   - the depth of WebDAV scope from-queries are set in the depth-hint, valid
37     values are "deep", "flat", "flat+self", "self"
38   - if multiple entities are queried in the FROM, they are joined using ","
39     and set as the entityName of the fetch spec
40 */
41
42 @class EOFetchSpecification, EOQualifier;
43
44 @interface SoDAVSQLParser : NSObject
45 {
46 }
47
48 + (id)sharedSQLParser;
49
50 /* top level parser entry points */
51
52 - (EOFetchSpecification *)parseSQLSelectStatement:(NSString *)_sql;
53 - (EOQualifier *)parseSQLWhereExpression:(NSString *)_sql;
54
55 /* parsing parts (exported for overloading in subclasses) */
56
57 - (BOOL)parseSQL:(id *)result
58   from:(unichar **)pos length:(unsigned *)len
59   strict:(BOOL)beStrict;
60 - (BOOL)parseToken:(const unsigned char *)tk
61   from:(unichar **)pos length:(unsigned *)len
62   consume:(BOOL)consume;
63 - (BOOL)parseIdentifier:(NSString **)result
64   from:(unichar **)pos length:(unsigned *)len
65   consume:(BOOL)consume;
66 - (BOOL)parseQualifier:(EOQualifier **)result
67   from:(unichar **)pos length:(unsigned *)len;
68 - (BOOL)parseScope:(NSString **)_scope:(NSString **)_entity
69   from:(unichar **)pos length:(unsigned *)len;
70
71 - (BOOL)parseColumnName:(NSString **)result
72   from:(unichar **)pos length:(unsigned *)len
73   consume:(BOOL)consume;
74 - (BOOL)parseTableName:(NSString **)result
75   from:(unichar **)pos length:(unsigned *)len
76   consume:(BOOL)consume;
77 - (BOOL)parseIdentifierList:(NSArray **)result
78   from:(unichar **)pos length:(unsigned *)len
79   selector:(SEL)_sel;
80
81 @end
82
83 #endif /* __WebDAV_SoDAVSQLParser_H__ */