2 Copyright (C) 2002-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
22 #ifndef __WebDAV_SoDAVSQLParser_H__
23 #define __WebDAV_SoDAVSQLParser_H__
25 #import <Foundation/NSObject.h>
26 #import <Foundation/NSString.h>
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.
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
41 @class EOFetchSpecification, EOQualifier;
43 @interface SoDAVSQLParser : NSObject
47 + (id)sharedSQLParser;
49 /* top level parser entry points */
51 - (EOFetchSpecification *)parseSQLSelectStatement:(NSString *)_sql;
52 - (EOQualifier *)parseSQLWhereExpression:(NSString *)_sql;
54 /* parsing parts (exported for overloading in subclasses) */
56 - (BOOL)parseSQL:(id *)result
57 from:(unichar **)pos length:(unsigned *)len
58 strict:(BOOL)beStrict;
59 - (BOOL)parseToken:(const unsigned 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;
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
82 #endif /* __WebDAV_SoDAVSQLParser_H__ */