libidav/davqlexec.h

changeset 365
f04ab0420512
parent 348
b79fb94f9e0a
child 747
efbd59642577
equal deleted inserted replaced
364:3769ba002fd1 365:f04ab0420512
1 /* 1 /*
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 * 3 *
4 * Copyright 2016 Olaf Wintermann. All rights reserved. 4 * Copyright 2018 Olaf Wintermann. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met: 7 * modification, are permitted provided that the following conditions are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
40 40
41 typedef struct DavQLCmd DavQLCmd; 41 typedef struct DavQLCmd DavQLCmd;
42 typedef struct DavQLStackObj DavQLStackObj; 42 typedef struct DavQLStackObj DavQLStackObj;
43 typedef struct DavQLRes DavQLRes; 43 typedef struct DavQLRes DavQLRes;
44 44
45 typedef struct DavQLArg DavQLArg;
46 typedef struct DavQLArgList DavQLArgList;
47
45 typedef void*(*davql_func)(); // TODO: interface? 48 typedef void*(*davql_func)(); // TODO: interface?
49
50 struct DavQLArg {
51 int type;
52 union DavQLArgValue{
53 int d;
54 unsigned int u;
55 char *s;
56 time_t t;
57 } value;
58 DavQLArg *next;
59 };
60
61 struct DavQLArgList {
62 DavQLArg *first;
63 DavQLArg *current;
64 };
46 65
47 typedef enum { 66 typedef enum {
48 DAVQL_OK = 0, 67 DAVQL_OK = 0,
49 DAVQL_UNSUPPORTED_FORMATCHAR, 68 DAVQL_UNSUPPORTED_FORMATCHAR,
50 DAVQL_UNKNOWN_FORMATCHAR 69 DAVQL_UNKNOWN_FORMATCHAR
132 davqlresprop_t resprop; 151 davqlresprop_t resprop;
133 UcxKey property; 152 UcxKey property;
134 } column; 153 } column;
135 _Bool descending; 154 _Bool descending;
136 } DavOrderCriterion; 155 } DavOrderCriterion;
137 156
157 DavQLArgList* dav_ql_get_args(DavQLStatement *st, va_list ap);
158 void dav_ql_free_arglist(DavQLArgList *args);
159
160 int dav_ql_getarg_int(DavQLArgList *args);
161 unsigned int dav_ql_getarg_uint(DavQLArgList *args);
162 char* dav_ql_getarg_str(DavQLArgList *args);
163 time_t dav_ql_getarg_time(DavQLArgList *args);
164
138 DavResult dav_statement_exec(DavSession *sn, DavQLStatement *st, ...); 165 DavResult dav_statement_exec(DavSession *sn, DavQLStatement *st, ...);
139 DavResult dav_statement_execv(DavSession *sn, DavQLStatement *st, va_list ap); 166 DavResult dav_statement_execv(DavSession *sn, DavQLStatement *st, va_list ap);
140 167
141 UcxBuffer* dav_path_string(sstr_t src, va_list ap, davqlerror_t *error); 168 UcxBuffer* dav_path_string(sstr_t src, DavQLArgList *args, davqlerror_t *error);
142 sstr_t dav_format_string(UcxAllocator *a, sstr_t fstr, va_list ap, davqlerror_t *error); 169 sstr_t dav_format_string(UcxAllocator *a, sstr_t fstr, DavQLArgList *ap, davqlerror_t *error);
143 170
144 DavResult dav_exec_select(DavSession *sn, DavQLStatement *st, va_list ap); 171 DavResult dav_exec_select(DavSession *sn, DavQLStatement *st, va_list ap);
145 172
146 int dav_identifier2resprop(sstr_t src, davqlresprop_t *prop); 173 int dav_identifier2resprop(sstr_t src, davqlresprop_t *prop);
147 174
148 UcxBuffer* dav_compile_expr(DavContext *ctx, UcxAllocator *a, DavQLExpression *lexpr, va_list ap); 175 UcxBuffer* dav_compile_expr(DavContext *ctx, UcxAllocator *a, DavQLExpression *lexpr, DavQLArgList *ap);
149 176
150 int dav_exec_expr(UcxBuffer *bcode, DavResource *res, DavQLStackObj *result); 177 int dav_exec_expr(UcxBuffer *bcode, DavResource *res, DavQLStackObj *result);
151 178
152 179
153 180

mercurial