--- parser3/src/classes/table.C 2003/11/20 16:34:23 1.192 +++ parser3/src/classes/table.C 2004/02/11 15:33:13 1.196 @@ -1,11 +1,11 @@ /** @file Parser: @b table parser class. - Copyright (c) 2001-2003 ArtLebedev Group (http://www.artlebedev.com) + Copyright (c) 2001-2004 ArtLebedev Group (http://www.artlebedev.com) Author: Alexandr Petrosian (http://paf.design.ru) */ -static const char * const IDENT_TABLE_C="$Date: 2003/11/20 16:34:23 $"; +static const char * const IDENT_TABLE_C="$Date: 2004/02/11 15:33:13 $"; #include "classes.h" #include "pa_vmethod_frame.h" @@ -178,34 +178,6 @@ static void _create(Request& r, MethodPa GET_SELF(r, VTable).set_table(table); } -static char* remove_encloser(char* cstr, char encloser) { - if(cstr[0]!=encloser) - return cstr; - - size_t length=strlen(cstr); - if(length<2 || cstr[length-1]!=encloser) - return cstr; - - // 'string' - - cstr[length-1]=0; - cstr++; - - // double-encloser stands for encloser - char *read; - char *write; - write=read=cstr; - while(char c=*read++) { - if(c==encloser && *read==encloser) - read++; - - *write++=c; - } - *write=0; // terminate - - return cstr; -} - struct lsplit_result { char* piece; char delim; @@ -249,7 +221,7 @@ static lsplit_result lsplit(char** strin char *write; write=read=string; char c; - while(c=*read++) { + while((c=*read++)) { if(c==encloser) { char n=*read; if(n==encloser) // double-encloser stands for encloser @@ -667,17 +639,19 @@ static void _hash(Request& r, MethodPara { - Row_info info={0}; - info.r=&r; - info.table=&self_table; Value* key_param=¶ms[0]; - info.key_code=key_param->get_junction()?key_param:0; - info.key_field=info.key_code?-1 - :self_table.column_name2index(key_param->as_string(), true); - info.value_fields=&value_fields; - info.hash=&result.hash(); - info.distinct=distinct; - info.row=0; + Row_info info={ + &r, + &self_table, + /*key_code=*/key_param->get_junction()?key_param:0, + /*key_field=*/0, + &value_fields, + &result.hash(), + distinct, + /*row=*/0 + }; + info.key_field=(info.key_code?-1 + :self_table.column_name2index(key_param->as_string(), true)); int saved_current=self_table.current(); self_table.for_each(table_row_to_hash, &info); @@ -854,7 +828,7 @@ static void _join(Request& r, MethodPara 0, "source and destination are same table"); - if(Table::columns_type dest_columns=dest.columns()) // dest is named + if(dest.columns()) // dest is named src.table_for_each(join_named_row, &dest, o); else // dest is nameless src.table_for_each(join_nameless_row, &dest, o); @@ -1004,7 +978,6 @@ static void _select(Request& r, MethodPa source_table.set_current(row); bool condition=r.process_to_value(vcondition, - /*0/*no name* /,*/ false/*don't intercept string*/).as_bool(); if(condition) // ...condition is true=