msvcrt: Remove non-needed defines from msvcrt.h.
[wine.git] / dlls / msi / sql.y
blob5b5c8bd7f8ed201a0529e1d477173a14cd3931e3
1 %{
3 /*
4 * Implementation of the Microsoft Installer (msi.dll)
6 * Copyright 2002-2004 Mike McCormack for CodeWeavers
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 #include <stdarg.h>
24 #include <stdio.h>
25 #include <stdlib.h>
27 #include "windef.h"
28 #include "winbase.h"
29 #include "query.h"
30 #include "wine/list.h"
31 #include "wine/debug.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(msi);
35 static UINT SQL_getstring( void *info, const struct sql_str *strdata, LPWSTR *str );
36 static INT SQL_getint( void *info );
37 static int sql_lex( void *SQL_lval, SQL_input *info );
38 static int sql_error( SQL_input *info, const char *str);
40 static LPWSTR parser_add_table( void *info, LPCWSTR list, LPCWSTR table );
41 static void *parser_alloc( void *info, unsigned int sz );
42 static column_info *parser_alloc_column( void *info, LPCWSTR table, LPCWSTR column );
44 static BOOL SQL_MarkPrimaryKeys( column_info **cols, column_info *keys);
46 static struct expr * EXPR_complex( void *info, struct expr *l, UINT op, struct expr *r );
47 static struct expr * EXPR_unary( void *info, struct expr *l, UINT op );
48 static struct expr * EXPR_column( void *info, const column_info *column );
49 static struct expr * EXPR_ival( void *info, int val );
50 static struct expr * EXPR_sval( void *info, const struct sql_str *str );
51 static struct expr * EXPR_wildcard( void *info );
53 #define PARSER_BUBBLE_UP_VIEW( sql, result, current_view ) \
54 *sql->view = current_view; \
55 result = current_view
59 %lex-param { SQL_input *info }
60 %parse-param { SQL_input *info }
61 %define api.pure
63 %union
65 struct sql_str str;
66 LPWSTR string;
67 column_info *column_list;
68 MSIVIEW *query;
69 struct expr *expr;
70 USHORT column_type;
71 int integer;
74 %token TK_ALTER TK_AND TK_BY TK_CHAR TK_COMMA TK_CREATE TK_DELETE TK_DROP
75 %token TK_DISTINCT TK_DOT TK_EQ TK_FREE TK_FROM TK_GE TK_GT TK_HOLD TK_ADD
76 %token <str> TK_ID
77 %token TK_ILLEGAL TK_INSERT TK_INT
78 %token <str> TK_INTEGER
79 %token TK_INTO TK_IS TK_KEY TK_LE TK_LONG TK_LONGCHAR TK_LP TK_LT
80 %token TK_LOCALIZABLE TK_MINUS TK_NE TK_NOT TK_NULL
81 %token TK_OBJECT TK_OR TK_ORDER TK_PRIMARY TK_RP
82 %token TK_SELECT TK_SET TK_SHORT TK_SPACE TK_STAR
83 %token <str> TK_STRING
84 %token TK_TABLE TK_TEMPORARY TK_UPDATE TK_VALUES TK_WHERE TK_WILDCARD
87 * These are extra tokens used by the lexer but never seen by the
88 * parser. We put them in a rule so that the parser generator will
89 * add them to the parse.h output file.
92 %nonassoc END_OF_FILE ILLEGAL SPACE UNCLOSED_STRING COMMENT FUNCTION
93 COLUMN AGG_FUNCTION.
95 %type <string> table tablelist id string
96 %type <column_list> selcollist collist selcolumn column column_and_type column_def table_def
97 %type <column_list> column_assignment update_assign_list constlist
98 %type <query> query from selectfrom unorderdfrom
99 %type <query> oneupdate onedelete oneselect onequery onecreate oneinsert onealter onedrop
100 %type <expr> expr val column_val const_val
101 %type <column_type> column_type data_type data_type_l data_count
102 %type <integer> number alterop
104 %left TK_OR
105 %left TK_AND
106 %left TK_NOT
107 %left TK_EQ TK_NE TK_LT TK_GT TK_LE TK_GE TK_LIKE
108 %right TK_NEGATION
112 query:
113 onequery
115 SQL_input* sql = (SQL_input*) info;
116 *sql->view = $1;
120 onequery:
121 oneselect
122 | onecreate
123 | oneinsert
124 | oneupdate
125 | onedelete
126 | onealter
127 | onedrop
130 oneinsert:
131 TK_INSERT TK_INTO table TK_LP collist TK_RP TK_VALUES TK_LP constlist TK_RP
133 SQL_input *sql = (SQL_input*) info;
134 MSIVIEW *insert = NULL;
136 INSERT_CreateView( sql->db, &insert, $3, $5, $9, FALSE );
137 if( !insert )
138 YYABORT;
140 PARSER_BUBBLE_UP_VIEW( sql, $$, insert );
142 | TK_INSERT TK_INTO table TK_LP collist TK_RP TK_VALUES TK_LP constlist TK_RP TK_TEMPORARY
144 SQL_input *sql = (SQL_input*) info;
145 MSIVIEW *insert = NULL;
147 INSERT_CreateView( sql->db, &insert, $3, $5, $9, TRUE );
148 if( !insert )
149 YYABORT;
151 PARSER_BUBBLE_UP_VIEW( sql, $$, insert );
155 onecreate:
156 TK_CREATE TK_TABLE table TK_LP table_def TK_RP
158 SQL_input* sql = (SQL_input*) info;
159 MSIVIEW *create = NULL;
160 UINT r;
162 if( !$5 )
163 YYABORT;
164 r = CREATE_CreateView( sql->db, &create, $3, $5, FALSE );
165 if( !create )
167 sql->r = r;
168 YYABORT;
171 PARSER_BUBBLE_UP_VIEW( sql, $$, create );
173 | TK_CREATE TK_TABLE table TK_LP table_def TK_RP TK_HOLD
175 SQL_input* sql = (SQL_input*) info;
176 MSIVIEW *create = NULL;
178 if( !$5 )
179 YYABORT;
180 CREATE_CreateView( sql->db, &create, $3, $5, TRUE );
181 if( !create )
182 YYABORT;
184 PARSER_BUBBLE_UP_VIEW( sql, $$, create );
188 oneupdate:
189 TK_UPDATE table TK_SET update_assign_list TK_WHERE expr
191 SQL_input* sql = (SQL_input*) info;
192 MSIVIEW *update = NULL;
194 UPDATE_CreateView( sql->db, &update, $2, $4, $6 );
195 if( !update )
196 YYABORT;
198 PARSER_BUBBLE_UP_VIEW( sql, $$, update );
200 | TK_UPDATE table TK_SET update_assign_list
202 SQL_input* sql = (SQL_input*) info;
203 MSIVIEW *update = NULL;
205 UPDATE_CreateView( sql->db, &update, $2, $4, NULL );
206 if( !update )
207 YYABORT;
209 PARSER_BUBBLE_UP_VIEW( sql, $$, update );
213 onedelete:
214 TK_DELETE from
216 SQL_input* sql = (SQL_input*) info;
217 MSIVIEW *delete = NULL;
219 DELETE_CreateView( sql->db, &delete, $2 );
220 if( !delete )
221 YYABORT;
223 PARSER_BUBBLE_UP_VIEW( sql, $$, delete );
227 onealter:
228 TK_ALTER TK_TABLE table alterop
230 SQL_input* sql = (SQL_input*) info;
231 MSIVIEW *alter = NULL;
233 ALTER_CreateView( sql->db, &alter, $3, NULL, $4 );
234 if( !alter )
235 YYABORT;
237 PARSER_BUBBLE_UP_VIEW( sql, $$, alter );
239 | TK_ALTER TK_TABLE table TK_ADD column_and_type
241 SQL_input *sql = (SQL_input *)info;
242 MSIVIEW *alter = NULL;
244 ALTER_CreateView( sql->db, &alter, $3, $5, 0 );
245 if (!alter)
246 YYABORT;
248 PARSER_BUBBLE_UP_VIEW( sql, $$, alter );
250 | TK_ALTER TK_TABLE table TK_ADD column_and_type TK_HOLD
252 SQL_input *sql = (SQL_input *)info;
253 MSIVIEW *alter = NULL;
255 ALTER_CreateView( sql->db, &alter, $3, $5, 1 );
256 if (!alter)
257 YYABORT;
259 PARSER_BUBBLE_UP_VIEW( sql, $$, alter );
263 alterop:
264 TK_HOLD
266 $$ = 1;
268 | TK_FREE
270 $$ = -1;
274 onedrop:
275 TK_DROP TK_TABLE table
277 SQL_input* sql = (SQL_input*) info;
278 MSIVIEW* drop = NULL;
279 UINT r;
281 r = DROP_CreateView( sql->db, &drop, $3 );
282 if( r != ERROR_SUCCESS || !$$ )
283 YYABORT;
285 PARSER_BUBBLE_UP_VIEW( sql, $$, drop );
289 table_def:
290 column_def TK_PRIMARY TK_KEY collist
292 if( SQL_MarkPrimaryKeys( &$1, $4 ) )
293 $$ = $1;
294 else
295 $$ = NULL;
299 column_def:
300 column_def TK_COMMA column_and_type
302 column_info *ci;
304 for( ci = $1; ci->next; ci = ci->next )
307 ci->next = $3;
308 $$ = $1;
310 | column_and_type
312 $$ = $1;
316 column_and_type:
317 column column_type
319 $$ = $1;
320 $$->type = ($2 | MSITYPE_VALID);
324 column_type:
325 data_type_l
327 $$ = $1;
329 | data_type_l TK_LOCALIZABLE
331 $$ = $1 | MSITYPE_LOCALIZABLE;
333 | data_type_l TK_TEMPORARY
335 $$ = $1 | MSITYPE_TEMPORARY;
339 data_type_l:
340 data_type
342 $$ |= MSITYPE_NULLABLE;
344 | data_type TK_NOT TK_NULL
346 $$ = $1;
350 data_type:
351 TK_CHAR
353 $$ = MSITYPE_STRING | 0x400;
355 | TK_CHAR TK_LP data_count TK_RP
357 $$ = MSITYPE_STRING | 0x400 | $3;
359 | TK_LONGCHAR
361 $$ = MSITYPE_STRING | 0x400;
363 | TK_SHORT
365 $$ = 2 | 0x400;
367 | TK_INT
369 $$ = 2 | 0x400;
371 | TK_LONG
373 $$ = 4;
375 | TK_OBJECT
377 $$ = MSITYPE_STRING | MSITYPE_VALID;
381 data_count:
382 number
384 if( ( $1 > 255 ) || ( $1 < 0 ) )
385 YYABORT;
386 $$ = $1;
390 oneselect:
391 TK_SELECT selectfrom
393 $$ = $2;
395 | TK_SELECT TK_DISTINCT selectfrom
397 SQL_input* sql = (SQL_input*) info;
398 MSIVIEW* distinct = NULL;
399 UINT r;
401 r = DISTINCT_CreateView( sql->db, &distinct, $3 );
402 if (r != ERROR_SUCCESS)
403 YYABORT;
405 PARSER_BUBBLE_UP_VIEW( sql, $$, distinct );
409 selectfrom:
410 selcollist from
412 SQL_input* sql = (SQL_input*) info;
413 MSIVIEW* select = NULL;
414 UINT r;
416 if( $1 )
418 r = SELECT_CreateView( sql->db, &select, $2, $1 );
419 if (r != ERROR_SUCCESS)
420 YYABORT;
422 PARSER_BUBBLE_UP_VIEW( sql, $$, select );
424 else
425 $$ = $2;
429 selcollist:
430 selcolumn
431 | selcolumn TK_COMMA selcollist
433 $1->next = $3;
435 | TK_STAR
437 $$ = NULL;
441 collist:
442 column
443 | column TK_COMMA collist
445 $1->next = $3;
447 | TK_STAR
449 $$ = NULL;
453 from:
454 TK_FROM table
456 SQL_input* sql = (SQL_input*) info;
457 MSIVIEW* table = NULL;
458 UINT r;
460 r = TABLE_CreateView( sql->db, $2, &table );
461 if( r != ERROR_SUCCESS || !$$ )
462 YYABORT;
464 PARSER_BUBBLE_UP_VIEW( sql, $$, table );
466 | unorderdfrom TK_ORDER TK_BY collist
468 UINT r;
470 if( $4 )
472 r = $1->ops->sort( $1, $4 );
473 if ( r != ERROR_SUCCESS)
474 YYABORT;
477 $$ = $1;
479 | unorderdfrom
482 unorderdfrom:
483 TK_FROM tablelist
485 SQL_input* sql = (SQL_input*) info;
486 MSIVIEW* where = NULL;
487 UINT r;
489 r = WHERE_CreateView( sql->db, &where, $2, NULL );
490 if( r != ERROR_SUCCESS )
491 YYABORT;
493 PARSER_BUBBLE_UP_VIEW( sql, $$, where );
495 | TK_FROM tablelist TK_WHERE expr
497 SQL_input* sql = (SQL_input*) info;
498 MSIVIEW* where = NULL;
499 UINT r;
501 r = WHERE_CreateView( sql->db, &where, $2, $4 );
502 if( r != ERROR_SUCCESS )
503 YYABORT;
505 PARSER_BUBBLE_UP_VIEW( sql, $$, where );
509 tablelist:
510 table
512 $$ = $1;
514 | table TK_COMMA tablelist
516 $$ = parser_add_table( info, $3, $1 );
517 if (!$$)
518 YYABORT;
522 expr:
523 TK_LP expr TK_RP
525 $$ = $2;
526 if( !$$ )
527 YYABORT;
529 | expr TK_AND expr
531 $$ = EXPR_complex( info, $1, OP_AND, $3 );
532 if( !$$ )
533 YYABORT;
535 | expr TK_OR expr
537 $$ = EXPR_complex( info, $1, OP_OR, $3 );
538 if( !$$ )
539 YYABORT;
541 | column_val TK_EQ val
543 $$ = EXPR_complex( info, $1, OP_EQ, $3 );
544 if( !$$ )
545 YYABORT;
547 | column_val TK_GT val
549 $$ = EXPR_complex( info, $1, OP_GT, $3 );
550 if( !$$ )
551 YYABORT;
553 | column_val TK_LT val
555 $$ = EXPR_complex( info, $1, OP_LT, $3 );
556 if( !$$ )
557 YYABORT;
559 | column_val TK_LE val
561 $$ = EXPR_complex( info, $1, OP_LE, $3 );
562 if( !$$ )
563 YYABORT;
565 | column_val TK_GE val
567 $$ = EXPR_complex( info, $1, OP_GE, $3 );
568 if( !$$ )
569 YYABORT;
571 | column_val TK_NE val
573 $$ = EXPR_complex( info, $1, OP_NE, $3 );
574 if( !$$ )
575 YYABORT;
577 | column_val TK_IS TK_NULL
579 $$ = EXPR_unary( info, $1, OP_ISNULL );
580 if( !$$ )
581 YYABORT;
583 | column_val TK_IS TK_NOT TK_NULL
585 $$ = EXPR_unary( info, $1, OP_NOTNULL );
586 if( !$$ )
587 YYABORT;
591 val:
592 column_val
593 | const_val
596 constlist:
597 const_val
599 $$ = parser_alloc_column( info, NULL, NULL );
600 if( !$$ )
601 YYABORT;
602 $$->val = $1;
604 | const_val TK_COMMA constlist
606 $$ = parser_alloc_column( info, NULL, NULL );
607 if( !$$ )
608 YYABORT;
609 $$->val = $1;
610 $$->next = $3;
614 update_assign_list:
615 column_assignment
616 | column_assignment TK_COMMA update_assign_list
618 $$ = $1;
619 $$->next = $3;
623 column_assignment:
624 column TK_EQ const_val
626 $$ = $1;
627 $$->val = $3;
631 const_val:
632 number
634 $$ = EXPR_ival( info, $1 );
635 if( !$$ )
636 YYABORT;
638 | TK_MINUS number %prec TK_NEGATION
640 $$ = EXPR_ival( info, -$2 );
641 if( !$$ )
642 YYABORT;
644 | TK_STRING
646 $$ = EXPR_sval( info, &$1 );
647 if( !$$ )
648 YYABORT;
650 | TK_WILDCARD
652 $$ = EXPR_wildcard( info );
653 if( !$$ )
654 YYABORT;
656 | TK_NULL
658 $$ = EXPR_sval( info, NULL );
659 if ( !$$ )
660 YYABORT;
664 column_val:
665 column
667 $$ = EXPR_column( info, $1 );
668 if( !$$ )
669 YYABORT;
673 column:
674 table TK_DOT id
676 $$ = parser_alloc_column( info, $1, $3 );
677 if( !$$ )
678 YYABORT;
680 | id
682 $$ = parser_alloc_column( info, NULL, $1 );
683 if( !$$ )
684 YYABORT;
688 selcolumn:
689 table TK_DOT id
691 $$ = parser_alloc_column( info, $1, $3 );
692 if( !$$ )
693 YYABORT;
695 | id
697 $$ = parser_alloc_column( info, NULL, $1 );
698 if( !$$ )
699 YYABORT;
701 | string
703 $$ = parser_alloc_column( info, NULL, $1 );
704 if( !$$ )
705 YYABORT;
709 table:
712 $$ = $1;
717 TK_ID
719 if ( SQL_getstring( info, &$1, &$$ ) != ERROR_SUCCESS || !$$ )
720 YYABORT;
724 string:
725 TK_STRING
727 if ( SQL_getstring( info, &$1, &$$ ) != ERROR_SUCCESS || !$$ )
728 YYABORT;
732 number:
733 TK_INTEGER
735 $$ = SQL_getint( info );
741 static LPWSTR parser_add_table( void *info, LPCWSTR list, LPCWSTR table )
743 DWORD len = lstrlenW( list ) + lstrlenW( table ) + 2;
744 LPWSTR ret;
746 ret = parser_alloc( info, len * sizeof(WCHAR) );
747 if( ret )
749 lstrcpyW( ret, list );
750 lstrcatW( ret, L" " );
751 lstrcatW( ret, table );
753 return ret;
756 static void *parser_alloc( void *info, unsigned int sz )
758 SQL_input* sql = (SQL_input*) info;
759 struct list *mem;
761 mem = msi_alloc( sizeof (struct list) + sz );
762 list_add_tail( sql->mem, mem );
763 return &mem[1];
766 static column_info *parser_alloc_column( void *info, LPCWSTR table, LPCWSTR column )
768 column_info *col;
770 col = parser_alloc( info, sizeof (*col) );
771 if( col )
773 col->table = table;
774 col->column = column;
775 col->val = NULL;
776 col->type = 0;
777 col->next = NULL;
780 return col;
783 static int sql_lex( void *SQL_lval, SQL_input *sql )
785 int token, skip;
786 struct sql_str * str = SQL_lval;
790 sql->n += sql->len;
791 if( ! sql->command[sql->n] )
792 return 0; /* end of input */
794 /* TRACE("string : %s\n", debugstr_w(&sql->command[sql->n])); */
795 sql->len = sqliteGetToken( &sql->command[sql->n], &token, &skip );
796 if( sql->len==0 )
797 break;
798 str->data = &sql->command[sql->n];
799 str->len = sql->len;
800 sql->n += skip;
802 while( token == TK_SPACE );
804 /* TRACE("token : %d (%s)\n", token, debugstr_wn(&sql->command[sql->n], sql->len)); */
806 return token;
809 UINT SQL_getstring( void *info, const struct sql_str *strdata, LPWSTR *str )
811 LPCWSTR p = strdata->data;
812 UINT len = strdata->len;
814 /* match quotes */
815 if( ( (p[0]=='`') && (p[len-1]!='`') ) ||
816 ( (p[0]=='\'') && (p[len-1]!='\'') ) )
817 return ERROR_FUNCTION_FAILED;
819 /* if there are quotes, remove them */
820 if( ( (p[0]=='`') && (p[len-1]=='`') ) ||
821 ( (p[0]=='\'') && (p[len-1]=='\'') ) )
823 p++;
824 len -= 2;
826 *str = parser_alloc( info, (len + 1)*sizeof(WCHAR) );
827 if( !*str )
828 return ERROR_OUTOFMEMORY;
829 memcpy( *str, p, len*sizeof(WCHAR) );
830 (*str)[len]=0;
832 return ERROR_SUCCESS;
835 INT SQL_getint( void *info )
837 SQL_input* sql = (SQL_input*) info;
838 LPCWSTR p = &sql->command[sql->n];
839 INT i, r = 0;
841 for( i=0; i<sql->len; i++ )
843 if( '0' > p[i] || '9' < p[i] )
845 ERR("should only be numbers here!\n");
846 break;
848 r = (p[i]-'0') + r*10;
851 return r;
854 static int sql_error( SQL_input *info, const char *str )
856 return 0;
859 static struct expr * EXPR_wildcard( void *info )
861 struct expr *e = parser_alloc( info, sizeof *e );
862 if( e )
864 e->type = EXPR_WILDCARD;
866 return e;
869 static struct expr * EXPR_complex( void *info, struct expr *l, UINT op, struct expr *r )
871 struct expr *e = parser_alloc( info, sizeof *e );
872 if( e )
874 e->type = EXPR_COMPLEX;
875 e->u.expr.left = l;
876 e->u.expr.op = op;
877 e->u.expr.right = r;
879 return e;
882 static struct expr * EXPR_unary( void *info, struct expr *l, UINT op )
884 struct expr *e = parser_alloc( info, sizeof *e );
885 if( e )
887 e->type = EXPR_UNARY;
888 e->u.expr.left = l;
889 e->u.expr.op = op;
890 e->u.expr.right = NULL;
892 return e;
895 static struct expr * EXPR_column( void *info, const column_info *column )
897 struct expr *e = parser_alloc( info, sizeof *e );
898 if( e )
900 e->type = EXPR_COLUMN;
901 e->u.column.unparsed.column = column->column;
902 e->u.column.unparsed.table = column->table;
904 return e;
907 static struct expr * EXPR_ival( void *info, int val )
909 struct expr *e = parser_alloc( info, sizeof *e );
910 if( e )
912 e->type = EXPR_IVAL;
913 e->u.ival = val;
915 return e;
918 static struct expr * EXPR_sval( void *info, const struct sql_str *str )
920 struct expr *e = parser_alloc( info, sizeof *e );
921 if( e )
923 e->type = EXPR_SVAL;
924 if( !str) e->u.sval = NULL;
925 else if( SQL_getstring( info, str, (LPWSTR *)&e->u.sval ) != ERROR_SUCCESS )
926 return NULL; /* e will be freed by query destructor */
928 return e;
931 static void swap_columns( column_info **cols, column_info *A, int idx )
933 column_info *preA = NULL, *preB = NULL, *B, *ptr;
934 int i = 0;
936 B = NULL;
937 ptr = *cols;
938 while( ptr )
940 if( i++ == idx )
941 B = ptr;
942 else if( !B )
943 preB = ptr;
945 if( ptr->next == A )
946 preA = ptr;
948 ptr = ptr->next;
951 if( preB ) preB->next = A;
952 if( preA ) preA->next = B;
953 ptr = A->next;
954 A->next = B->next;
955 B->next = ptr;
956 if( idx == 0 )
957 *cols = A;
960 static BOOL SQL_MarkPrimaryKeys( column_info **cols,
961 column_info *keys )
963 column_info *k;
964 BOOL found = TRUE;
965 int count;
967 for( k = keys, count = 0; k && found; k = k->next, count++ )
969 column_info *c;
970 int idx;
972 found = FALSE;
973 for( c = *cols, idx = 0; c && !found; c = c->next, idx++ )
975 if( wcscmp( k->column, c->column ) )
976 continue;
977 c->type |= MSITYPE_KEY;
978 found = TRUE;
979 if (idx != count)
980 swap_columns( cols, c, count );
984 return found;
987 UINT MSI_ParseSQL( MSIDATABASE *db, LPCWSTR command, MSIVIEW **phview,
988 struct list *mem )
990 SQL_input sql;
991 int r;
993 *phview = NULL;
995 sql.db = db;
996 sql.command = command;
997 sql.n = 0;
998 sql.len = 0;
999 sql.r = ERROR_BAD_QUERY_SYNTAX;
1000 sql.view = phview;
1001 sql.mem = mem;
1003 r = sql_parse(&sql);
1005 TRACE("Parse returned %d\n", r);
1006 if( r )
1008 if (*sql.view)
1010 (*sql.view)->ops->delete(*sql.view);
1011 *sql.view = NULL;
1013 return sql.r;
1016 return ERROR_SUCCESS;