2 Copyright (C) 2000-2004 SKYRIX Software AG
4 This file is part of OpenGroupware.org.
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
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.
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
23 #ifndef __WebDAV_SoDAVSQLParser_H__
24 #define __WebDAV_SoDAVSQLParser_H__
26 #import <Foundation/NSObject.h>
27 #import <Foundation/NSString.h>
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.
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
42 @class EOFetchSpecification, EOQualifier;
44 @interface SoDAVSQLParser : NSObject
48 + (id)sharedSQLParser;
50 /* top level parser entry points */
52 - (EOFetchSpecification *)parseSQLSelectStatement:(NSString *)_sql;
53 - (EOQualifier *)parseSQLWhereExpression:(NSString *)_sql;
55 /* parsing parts (exported for overloading in subclasses) */
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;
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
83 #endif /* __WebDAV_SoDAVSQLParser_H__ */