]> err.no Git - sope/blob - sope-appserver/NGObjWeb/WebDAV/SoDAVSQLParser.h
improved WebDAV property handling
[sope] / sope-appserver / NGObjWeb / WebDAV / SoDAVSQLParser.h
1 /*
2   Copyright (C) 2002-2005 SKYRIX Software AG
3
4   This file is part of SOPE.
5
6   SOPE 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   SOPE 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 SOPE; 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
22 #ifndef __WebDAV_SoDAVSQLParser_H__
23 #define __WebDAV_SoDAVSQLParser_H__
24
25 #import <Foundation/NSObject.h>
26 #import <Foundation/NSString.h>
27
28 /*
29   This is parser can be used to parse simple SQL statements. It's not a full
30   SQL implementation, but should be sufficient for simple applications.
31
32   Additional hints:
33   - the selected attributes are added to the 'attributes' hint, if a
34     wildcard select is used (*), the hint is not set
35   - the depth of WebDAV scope from-queries are set in the depth-hint, valid
36     values are "deep", "flat", "flat+self", "self"
37   - if multiple entities are queried in the FROM, they are joined using ","
38     and set as the entityName of the fetch spec
39 */
40
41 @class EOFetchSpecification, EOQualifier;
42
43 @interface SoDAVSQLParser : NSObject
44 {
45 }
46
47 + (id)sharedSQLParser;
48
49 /* top level parser entry points */
50
51 - (EOFetchSpecification *)parseSQLSelectStatement:(NSString *)_sql;
52 - (EOQualifier *)parseSQLWhereExpression:(NSString *)_sql;
53
54 /* parsing parts (exported for overloading in subclasses) */
55
56 - (BOOL)parseSQL:(id *)result
57   from:(unichar **)pos length:(unsigned *)len
58   strict:(BOOL)beStrict;
59 - (BOOL)parseToken:(const char *)tk
60   from:(unichar **)pos length:(unsigned *)len
61   consume:(BOOL)consume;
62 - (BOOL)parseIdentifier:(NSString **)result
63   from:(unichar **)pos length:(unsigned *)len
64   consume:(BOOL)consume;
65 - (BOOL)parseQualifier:(EOQualifier **)result
66   from:(unichar **)pos length:(unsigned *)len;
67 - (BOOL)parseScope:(NSString **)_scope:(NSString **)_entity
68   from:(unichar **)pos length:(unsigned *)len;
69
70 - (BOOL)parseColumnName:(NSString **)result
71   from:(unichar **)pos length:(unsigned *)len
72   consume:(BOOL)consume;
73 - (BOOL)parseTableName:(NSString **)result
74   from:(unichar **)pos length:(unsigned *)len
75   consume:(BOOL)consume;
76 - (BOOL)parseIdentifierList:(NSArray **)result
77   from:(unichar **)pos length:(unsigned *)len
78   selector:(SEL)_sel;
79
80 @end
81
82 #endif /* __WebDAV_SoDAVSQLParser_H__ */