Fri, 29 May 2015 10:15:12 +0200
implemented order by parser
104
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1 | /* |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
3 | * |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
4 | * Copyright 2015 Olaf Wintermann. All rights reserved. |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
5 | * |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
6 | * Redistribution and use in source and binary forms, with or without |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
7 | * modification, are permitted provided that the following conditions are met: |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
8 | * |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
9 | * 1. Redistributions of source code must retain the above copyright |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
10 | * notice, this list of conditions and the following disclaimer. |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
11 | * |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
12 | * 2. Redistributions in binary form must reproduce the above copyright |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
13 | * notice, this list of conditions and the following disclaimer in the |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
14 | * documentation and/or other materials provided with the distribution. |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
15 | * |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
26 | * POSSIBILITY OF SUCH DAMAGE. |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
27 | */ |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
28 | #ifndef DAVQLEXEC_H |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
29 | #define DAVQLEXEC_H |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
30 | |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
31 | #include <stdarg.h> |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
32 | #include "davqlparser.h" |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
33 | #include "webdav.h" |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
34 | |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
35 | #include <ucx/buffer.h> |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
36 | |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
37 | #ifdef __cplusplus |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
38 | extern "C" { |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
39 | #endif |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
40 | |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
41 | typedef struct DavQLResult DavQLResult; |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
42 | |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
43 | typedef enum { |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
44 | DAVQL_OK = 0, |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
45 | DAVQL_UNSUPPORTED_FORMATCHAR, |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
46 | DAVQL_UNKNOWN_FORMATCHAR |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
47 | } davqlerror_t; |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
48 | |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
49 | struct DavQLResult { |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
50 | DavResource *result; |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
51 | int status; |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
52 | }; |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
53 | |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
54 | DavQLResult* dav_statement_exec(DavSession *sn, DavQLStatement *st, ...); |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
55 | DavQLResult* dav_statement_execv(DavSession *sn, DavQLStatement *st, va_list ap); |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
56 | |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
57 | UcxBuffer* dav_path_string(sstr_t src, va_list ap, davqlerror_t *error); |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
58 | |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
59 | void dav_exec_get(DavSession *sn,DavQLStatement *st,char* path,va_list ap); |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
60 | |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
61 | int dav_eval_lexpr(DavResource *res, DavQLExpression *lexpr); |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
62 | |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
63 | |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
64 | |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
65 | |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
66 | #ifdef __cplusplus |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
67 | } |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
68 | #endif |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
69 | |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
70 | #endif /* DAVQLEXEC_H */ |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
71 |