wined3d: Validate (2D) texture dimensions in texture_init().
[wine.git] / dlls / msi / sql.y
blob366764d5aebb1454b64eb54249be6f0af1e3fe51
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
24 #include "config.h"
26 #include <stdarg.h>
27 #include <stdio.h>
28 #include <stdlib.h>
30 #include "windef.h"
31 #include "winbase.h"
32 #include "query.h"
33 #include "wine/list.h"
34 #include "wine/debug.h"
35 #include "wine/unicode.h"
37 WINE_DEFAULT_DEBUG_CHANNEL(msi);
39 static UINT SQL_getstring( void *info, const struct sql_str *strdata, LPWSTR *str );
40 static INT SQL_getint( void *info );
41 static int sql_lex( void *SQL_lval, SQL_input *info );
42 static int sql_error( SQL_input *info, const char *str);
44 static LPWSTR parser_add_table( void *info, LPCWSTR list, LPCWSTR table );
45 static void *parser_alloc( void *info, unsigned int sz );
46 static column_info *parser_alloc_column( void *info, LPCWSTR table, LPCWSTR column );
48 static BOOL SQL_MarkPrimaryKeys( column_info **cols, column_info *keys);
50 static struct expr * EXPR_complex( void *info, struct expr *l, UINT op, struct expr *r );
51 static struct expr * EXPR_unary( void *info, struct expr *l, UINT op );
52 static struct expr * EXPR_column( void *info, const column_info *column );
53 static struct expr * EXPR_ival( void *info, int val );
54 static struct expr * EXPR_sval( void *info, const struct sql_str *str );
55 static struct expr * EXPR_wildcard( void *info );
57 #define PARSER_BUBBLE_UP_VIEW( sql, result, current_view ) \
58 *sql->view = current_view; \
59 result = current_view
63 %lex-param { SQL_input *info }
64 %parse-param { SQL_input *info }
65 %pure-parser
67 %union
69 struct sql_str str;
70 LPWSTR string;
71 column_info *column_list;
72 MSIVIEW *query;
73 struct expr *expr;
74 USHORT column_type;
75 int integer;
78 %token TK_ALTER TK_AND TK_BY TK_CHAR TK_COMMA TK_CREATE TK_DELETE TK_DROP
79 %token TK_DISTINCT TK_DOT TK_EQ TK_FREE TK_FROM TK_GE TK_GT TK_HOLD TK_ADD
80 %token <str> TK_ID
81 %token TK_ILLEGAL TK_INSERT TK_INT
82 %token <str> TK_INTEGER
83 %token TK_INTO TK_IS TK_KEY TK_LE TK_LONG TK_LONGCHAR TK_LP TK_LT
84 %token TK_LOCALIZABLE TK_MINUS TK_NE TK_NOT TK_NULL
85 %token TK_OBJECT TK_OR TK_ORDER TK_PRIMARY TK_RP
86 %token TK_SELECT TK_SET TK_SHORT TK_SPACE TK_STAR
87 %token <str> TK_STRING
88 %token TK_TABLE TK_TEMPORARY TK_UPDATE TK_VALUES TK_WHERE TK_WILDCARD
91 * These are extra tokens used by the lexer but never seen by the
92 * parser. We put them in a rule so that the parser generator will
93 * add them to the parse.h output file.
96 %nonassoc END_OF_FILE ILLEGAL SPACE UNCLOSED_STRING COMMENT FUNCTION
97 COLUMN AGG_FUNCTION.
99 %type <string> table tablelist id string
100 %type <column_list> selcollist collist selcolumn column column_and_type column_def table_def
101 %type <column_list> column_assignment update_assign_list constlist
102 %type <query> query from selectfrom unorderdfrom
103 %type <query> oneupdate onedelete oneselect onequery onecreate oneinsert onealter onedrop
104 %type <expr> expr val column_val const_val
105 %type <column_type> column_type data_type data_type_l data_count
106 %type <integer> number alterop
108 %left TK_OR
109 %left TK_AND
110 %left TK_NOT
111 %left TK_EQ TK_NE TK_LT TK_GT TK_LE TK_GE TK_LIKE
112 %right TK_NEGATION
116 query:
117 onequery
119 SQL_input* sql = (SQL_input*) info;
120 *sql->view = $1;
124 onequery:
125 oneselect
126 | onecreate
127 | oneinsert
128 | oneupdate
129 | onedelete
130 | onealter
131 | onedrop
134 oneinsert:
135 TK_INSERT TK_INTO table TK_LP collist TK_RP TK_VALUES TK_LP constlist TK_RP
137 SQL_input *sql = (SQL_input*) info;
138 MSIVIEW *insert = NULL;
140 INSERT_CreateView( sql->db, &insert, $3, $5, $9, FALSE );
141 if( !insert )
142 YYABORT;
144 PARSER_BUBBLE_UP_VIEW( sql, $$, insert );
146 | TK_INSERT TK_INTO table TK_LP collist TK_RP TK_VALUES TK_LP constlist TK_RP TK_TEMPORARY
148 SQL_input *sql = (SQL_input*) info;
149 MSIVIEW *insert = NULL;
151 INSERT_CreateView( sql->db, &insert, $3, $5, $9, TRUE );
152 if( !insert )
153 YYABORT;
155 PARSER_BUBBLE_UP_VIEW( sql, $$, insert );
159 onecreate:
160 TK_CREATE TK_TABLE table TK_LP table_def TK_RP
162 SQL_input* sql = (SQL_input*) info;
163 MSIVIEW *create = NULL;
164 UINT r;
166 if( !$5 )
167 YYABORT;
168 r = CREATE_CreateView( sql->db, &create, $3, $5, FALSE );
169 if( !create )
171 sql->r = r;
172 YYABORT;
175 PARSER_BUBBLE_UP_VIEW( sql, $$, create );
177 | TK_CREATE TK_TABLE table TK_LP table_def TK_RP TK_HOLD
179 SQL_input* sql = (SQL_input*) info;
180 MSIVIEW *create = NULL;
182 if( !$5 )
183 YYABORT;
184 CREATE_CreateView( sql->db, &create, $3, $5, TRUE );
185 if( !create )
186 YYABORT;
188 PARSER_BUBBLE_UP_VIEW( sql, $$, create );
192 oneupdate:
193 TK_UPDATE table TK_SET update_assign_list TK_WHERE expr
195 SQL_input* sql = (SQL_input*) info;
196 MSIVIEW *update = NULL;
198 UPDATE_CreateView( sql->db, &update, $2, $4, $6 );
199 if( !update )
200 YYABORT;
202 PARSER_BUBBLE_UP_VIEW( sql, $$, update );
204 | TK_UPDATE table TK_SET update_assign_list
206 SQL_input* sql = (SQL_input*) info;
207 MSIVIEW *update = NULL;
209 UPDATE_CreateView( sql->db, &update, $2, $4, NULL );
210 if( !update )
211 YYABORT;
213 PARSER_BUBBLE_UP_VIEW( sql, $$, update );
217 onedelete:
218 TK_DELETE from
220 SQL_input* sql = (SQL_input*) info;
221 MSIVIEW *delete = NULL;
223 DELETE_CreateView( sql->db, &delete, $2 );
224 if( !delete )
225 YYABORT;
227 PARSER_BUBBLE_UP_VIEW( sql, $$, delete );
231 onealter:
232 TK_ALTER TK_TABLE table alterop
234 SQL_input* sql = (SQL_input*) info;
235 MSIVIEW *alter = NULL;
237 ALTER_CreateView( sql->db, &alter, $3, NULL, $4 );
238 if( !alter )
239 YYABORT;
241 PARSER_BUBBLE_UP_VIEW( sql, $$, alter );
243 | TK_ALTER TK_TABLE table TK_ADD column_and_type
245 SQL_input *sql = (SQL_input *)info;
246 MSIVIEW *alter = NULL;
248 ALTER_CreateView( sql->db, &alter, $3, $5, 0 );
249 if (!alter)
250 YYABORT;
252 PARSER_BUBBLE_UP_VIEW( sql, $$, alter );
254 | TK_ALTER TK_TABLE table TK_ADD column_and_type TK_HOLD
256 SQL_input *sql = (SQL_input *)info;
257 MSIVIEW *alter = NULL;
259 ALTER_CreateView( sql->db, &alter, $3, $5, 1 );
260 if (!alter)
261 YYABORT;
263 PARSER_BUBBLE_UP_VIEW( sql, $$, alter );
267 alterop:
268 TK_HOLD
270 $$ = 1;
272 | TK_FREE
274 $$ = -1;
278 onedrop:
279 TK_DROP TK_TABLE table
281 SQL_input* sql = (SQL_input*) info;
282 MSIVIEW* drop = NULL;
283 UINT r;
285 r = DROP_CreateView( sql->db, &drop, $3 );
286 if( r != ERROR_SUCCESS || !$$ )
287 YYABORT;
289 PARSER_BUBBLE_UP_VIEW( sql, $$, drop );
293 table_def:
294 column_def TK_PRIMARY TK_KEY collist
296 if( SQL_MarkPrimaryKeys( &$1, $4 ) )
297 $$ = $1;
298 else
299 $$ = NULL;
303 column_def:
304 column_def TK_COMMA column_and_type
306 column_info *ci;
308 for( ci = $1; ci->next; ci = ci->next )
311 ci->next = $3;
312 $$ = $1;
314 | column_and_type
316 $$ = $1;
320 column_and_type:
321 column column_type
323 $$ = $1;
324 $$->type = ($2 | MSITYPE_VALID);
325 $$->temporary = $2 & MSITYPE_TEMPORARY ? TRUE : FALSE;
329 column_type:
330 data_type_l
332 $$ = $1;
334 | data_type_l TK_LOCALIZABLE
336 $$ = $1 | MSITYPE_LOCALIZABLE;
338 | data_type_l TK_TEMPORARY
340 $$ = $1 | MSITYPE_TEMPORARY;
344 data_type_l:
345 data_type
347 $$ |= MSITYPE_NULLABLE;
349 | data_type TK_NOT TK_NULL
351 $$ = $1;
355 data_type:
356 TK_CHAR
358 $$ = MSITYPE_STRING | 0x400;
360 | TK_CHAR TK_LP data_count TK_RP
362 $$ = MSITYPE_STRING | 0x400 | $3;
364 | TK_LONGCHAR
366 $$ = MSITYPE_STRING | 0x400;
368 | TK_SHORT
370 $$ = 2 | 0x400;
372 | TK_INT
374 $$ = 2 | 0x400;
376 | TK_LONG
378 $$ = 4;
380 | TK_OBJECT
382 $$ = MSITYPE_STRING | MSITYPE_VALID;
386 data_count:
387 number
389 if( ( $1 > 255 ) || ( $1 < 0 ) )
390 YYABORT;
391 $$ = $1;
395 oneselect:
396 TK_SELECT selectfrom
398 $$ = $2;
400 | TK_SELECT TK_DISTINCT selectfrom
402 SQL_input* sql = (SQL_input*) info;
403 MSIVIEW* distinct = NULL;
404 UINT r;
406 r = DISTINCT_CreateView( sql->db, &distinct, $3 );
407 if (r != ERROR_SUCCESS)
408 YYABORT;
410 PARSER_BUBBLE_UP_VIEW( sql, $$, distinct );
414 selectfrom:
415 selcollist from
417 SQL_input* sql = (SQL_input*) info;
418 MSIVIEW* select = NULL;
419 UINT r;
421 if( $1 )
423 r = SELECT_CreateView( sql->db, &select, $2, $1 );
424 if (r != ERROR_SUCCESS)
425 YYABORT;
427 PARSER_BUBBLE_UP_VIEW( sql, $$, select );
429 else
430 $$ = $2;
434 selcollist:
435 selcolumn
436 | selcolumn TK_COMMA selcollist
438 $1->next = $3;
440 | TK_STAR
442 $$ = NULL;
446 collist:
447 column
448 | column TK_COMMA collist
450 $1->next = $3;
452 | TK_STAR
454 $$ = NULL;
458 from:
459 TK_FROM table
461 SQL_input* sql = (SQL_input*) info;
462 MSIVIEW* table = NULL;
463 UINT r;
465 r = TABLE_CreateView( sql->db, $2, &table );
466 if( r != ERROR_SUCCESS || !$$ )
467 YYABORT;
469 PARSER_BUBBLE_UP_VIEW( sql, $$, table );
471 | unorderdfrom TK_ORDER TK_BY collist
473 UINT r;
475 if( $4 )
477 r = $1->ops->sort( $1, $4 );
478 if ( r != ERROR_SUCCESS)
479 YYABORT;
482 $$ = $1;
484 | unorderdfrom
487 unorderdfrom:
488 TK_FROM tablelist
490 SQL_input* sql = (SQL_input*) info;
491 MSIVIEW* where = NULL;
492 UINT r;
494 r = WHERE_CreateView( sql->db, &where, $2, NULL );
495 if( r != ERROR_SUCCESS )
496 YYABORT;
498 PARSER_BUBBLE_UP_VIEW( sql, $$, where );
500 | TK_FROM tablelist TK_WHERE expr
502 SQL_input* sql = (SQL_input*) info;
503 MSIVIEW* where = NULL;
504 UINT r;
506 r = WHERE_CreateView( sql->db, &where, $2, $4 );
507 if( r != ERROR_SUCCESS )
508 YYABORT;
510 PARSER_BUBBLE_UP_VIEW( sql, $$, where );
514 tablelist:
515 table
517 $$ = $1;
519 | table TK_COMMA tablelist
521 $$ = parser_add_table( info, $3, $1 );
522 if (!$$)
523 YYABORT;
527 expr:
528 TK_LP expr TK_RP
530 $$ = $2;
531 if( !$$ )
532 YYABORT;
534 | expr TK_AND expr
536 $$ = EXPR_complex( info, $1, OP_AND, $3 );
537 if( !$$ )
538 YYABORT;
540 | expr TK_OR expr
542 $$ = EXPR_complex( info, $1, OP_OR, $3 );
543 if( !$$ )
544 YYABORT;
546 | column_val TK_EQ val
548 $$ = EXPR_complex( info, $1, OP_EQ, $3 );
549 if( !$$ )
550 YYABORT;
552 | column_val TK_GT val
554 $$ = EXPR_complex( info, $1, OP_GT, $3 );
555 if( !$$ )
556 YYABORT;
558 | column_val TK_LT val
560 $$ = EXPR_complex( info, $1, OP_LT, $3 );
561 if( !$$ )
562 YYABORT;
564 | column_val TK_LE val
566 $$ = EXPR_complex( info, $1, OP_LE, $3 );
567 if( !$$ )
568 YYABORT;
570 | column_val TK_GE val
572 $$ = EXPR_complex( info, $1, OP_GE, $3 );
573 if( !$$ )
574 YYABORT;
576 | column_val TK_NE val
578 $$ = EXPR_complex( info, $1, OP_NE, $3 );
579 if( !$$ )
580 YYABORT;
582 | column_val TK_IS TK_NULL
584 $$ = EXPR_unary( info, $1, OP_ISNULL );
585 if( !$$ )
586 YYABORT;
588 | column_val TK_IS TK_NOT TK_NULL
590 $$ = EXPR_unary( info, $1, OP_NOTNULL );
591 if( !$$ )
592 YYABORT;
596 val:
597 column_val
598 | const_val
601 constlist:
602 const_val
604 $$ = parser_alloc_column( info, NULL, NULL );
605 if( !$$ )
606 YYABORT;
607 $$->val = $1;
609 | const_val TK_COMMA constlist
611 $$ = parser_alloc_column( info, NULL, NULL );
612 if( !$$ )
613 YYABORT;
614 $$->val = $1;
615 $$->next = $3;
619 update_assign_list:
620 column_assignment
621 | column_assignment TK_COMMA update_assign_list
623 $$ = $1;
624 $$->next = $3;
628 column_assignment:
629 column TK_EQ const_val
631 $$ = $1;
632 $$->val = $3;
636 const_val:
637 number
639 $$ = EXPR_ival( info, $1 );
640 if( !$$ )
641 YYABORT;
643 | TK_MINUS number %prec TK_NEGATION
645 $$ = EXPR_ival( info, -$2 );
646 if( !$$ )
647 YYABORT;
649 | TK_STRING
651 $$ = EXPR_sval( info, &$1 );
652 if( !$$ )
653 YYABORT;
655 | TK_WILDCARD
657 $$ = EXPR_wildcard( info );
658 if( !$$ )
659 YYABORT;
663 column_val:
664 column
666 $$ = EXPR_column( info, $1 );
667 if( !$$ )
668 YYABORT;
672 column:
673 table TK_DOT id
675 $$ = parser_alloc_column( info, $1, $3 );
676 if( !$$ )
677 YYABORT;
679 | id
681 $$ = parser_alloc_column( info, NULL, $1 );
682 if( !$$ )
683 YYABORT;
687 selcolumn:
688 table TK_DOT id
690 $$ = parser_alloc_column( info, $1, $3 );
691 if( !$$ )
692 YYABORT;
694 | id
696 $$ = parser_alloc_column( info, NULL, $1 );
697 if( !$$ )
698 YYABORT;
700 | string
702 $$ = parser_alloc_column( info, NULL, $1 );
703 if( !$$ )
704 YYABORT;
708 table:
711 $$ = $1;
716 TK_ID
718 if ( SQL_getstring( info, &$1, &$$ ) != ERROR_SUCCESS || !$$ )
719 YYABORT;
723 string:
724 TK_STRING
726 if ( SQL_getstring( info, &$1, &$$ ) != ERROR_SUCCESS || !$$ )
727 YYABORT;
731 number:
732 TK_INTEGER
734 $$ = SQL_getint( info );
740 static LPWSTR parser_add_table( void *info, LPCWSTR list, LPCWSTR table )
742 static const WCHAR space[] = {' ',0};
743 DWORD len = strlenW( list ) + strlenW( table ) + 2;
744 LPWSTR ret;
746 ret = parser_alloc( info, len * sizeof(WCHAR) );
747 if( ret )
749 strcpyW( ret, list );
750 strcatW( ret, space );
751 strcatW( 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( SQL_getstring( info, str, (LPWSTR *)&e->u.sval ) != ERROR_SUCCESS )
925 return NULL; /* e will be freed by query destructor */
927 return e;
930 static void swap_columns( column_info **cols, column_info *A, int idx )
932 column_info *preA = NULL, *preB = NULL, *B, *ptr;
933 int i = 0;
935 B = NULL;
936 ptr = *cols;
937 while( ptr )
939 if( i++ == idx )
940 B = ptr;
941 else if( !B )
942 preB = ptr;
944 if( ptr->next == A )
945 preA = ptr;
947 ptr = ptr->next;
950 if( preB ) preB->next = A;
951 if( preA ) preA->next = B;
952 ptr = A->next;
953 A->next = B->next;
954 B->next = ptr;
955 if( idx == 0 )
956 *cols = A;
959 static BOOL SQL_MarkPrimaryKeys( column_info **cols,
960 column_info *keys )
962 column_info *k;
963 BOOL found = TRUE;
964 int count;
966 for( k = keys, count = 0; k && found; k = k->next, count++ )
968 column_info *c;
969 int idx;
971 found = FALSE;
972 for( c = *cols, idx = 0; c && !found; c = c->next, idx++ )
974 if( strcmpW( k->column, c->column ) )
975 continue;
976 c->type |= MSITYPE_KEY;
977 found = TRUE;
978 if (idx != count)
979 swap_columns( cols, c, count );
983 return found;
986 UINT MSI_ParseSQL( MSIDATABASE *db, LPCWSTR command, MSIVIEW **phview,
987 struct list *mem )
989 SQL_input sql;
990 int r;
992 *phview = NULL;
994 sql.db = db;
995 sql.command = command;
996 sql.n = 0;
997 sql.len = 0;
998 sql.r = ERROR_BAD_QUERY_SYNTAX;
999 sql.view = phview;
1000 sql.mem = mem;
1002 r = sql_parse(&sql);
1004 TRACE("Parse returned %d\n", r);
1005 if( r )
1007 if (*sql.view)
1009 (*sql.view)->ops->delete(*sql.view);
1010 *sql.view = NULL;
1012 return sql.r;
1015 return ERROR_SUCCESS;