--- parser3/src/classes/table.C 2007/03/14 10:57:52 1.224 +++ parser3/src/classes/table.C 2007/04/23 10:30:10 1.226 @@ -5,7 +5,7 @@ Author: Alexandr Petrosian (http://paf.design.ru) */ -static const char * const IDENT_TABLE_C="$Date: 2007/03/14 10:57:52 $"; +static const char * const IDENT_TABLE_C="$Date: 2007/04/23 10:30:10 $"; #include using namespace std; @@ -94,7 +94,7 @@ static Table::Action_options get_action_ if(soffset == "cur") result.offset=source.current(); else - throw Exception("parser.runtime", + throw Exception(PARSER_RUNTIME, &soffset, "must be 'cur' string or expression"); } else @@ -112,7 +112,7 @@ static Table::Action_options get_action_ } if(valid_options!=options->count()) - throw Exception("parser.runtime", + throw Exception(PARSER_RUNTIME, 0, "called with invalid option"); @@ -122,7 +122,7 @@ static void check_option_param(bool opti MethodParams& params, size_t next_param_index, const char *msg) { if(next_param_index+(options_defined?1:0) != params.count()) - throw Exception("parser.runtime", + throw Exception(PARSER_RUNTIME, 0, "%s", msg); } @@ -148,7 +148,7 @@ static void _create(Request& r, MethodPa if(params.count()==2) { const String& snameless=params.as_string(0, "called with two params, first param may only be string 'nameless'"); if(snameless!="nameless") - throw Exception("parser.runtime", + throw Exception(PARSER_RUNTIME, &snameless, "table::create called with two params, first param may only be 'nameless'"); columns=Table::columns_type(0); // nameless @@ -280,7 +280,7 @@ struct TableSeparators { if(Value* vseparator=options.get(PA_COLUMN_SEPARATOR_NAME)) { scolumn=&vseparator->as_string(); if(scolumn->length()!=1) - throw Exception("parser.runtime", + throw Exception(PARSER_RUNTIME, scolumn, "separator must be one character long"); column=scolumn->first_char(); @@ -289,7 +289,7 @@ struct TableSeparators { if(Value* vencloser=options.get(PA_COLUMN_ENCLOSER_NAME)) { sencloser=&vencloser->as_string(); if(sencloser->length()!=1) - throw Exception("parser.runtime", + throw Exception(PARSER_RUNTIME, sencloser, "encloser must be one character long"); encloser=sencloser->first_char(); @@ -427,18 +427,18 @@ static void _save_old(Request& r, Method if(HashStringValue* options=voptions.get_hash()) { int valid_options=separators.load(*options); if(valid_options!=options->count()) - throw Exception("parser.runtime", + throw Exception(PARSER_RUNTIME, 0, "invalid option passed"); } else { - throw Exception("parser.runtime", + throw Exception(PARSER_RUNTIME, 0, "additional params must be hash (did you spell mode parameter correctly?)"); } } } if(param_indexcount()) - throw Exception("parser.runtime", + throw Exception(PARSER_RUNTIME, 0, "invalid option passed"); } else { - throw Exception("parser.runtime", + throw Exception(PARSER_RUNTIME, 0, "additional params must be hash (did you spell mode parameter correctly?)"); } } } if(param_indexcount():0) for(int column=0; columncount()) - throw Exception("parser.runtime", + throw Exception(PARSER_RUNTIME, 0, "called with invalid option"); } } if(param_index==2) // bad options param type - throw Exception("parser.runtime", + throw Exception(PARSER_RUNTIME, 0, "options must be hash"); @@ -759,10 +764,10 @@ static void _hash(Request& r, MethodPara +=self_table.column_name2index(value_field_name, true); } } else - throw Exception("parser.runtime", + throw Exception(PARSER_RUNTIME, 0, - "value field(s) must be string or table" - ); + "value field(s) must be string or table"); + } else { // by all columns, including key if(!(distinct!=D_ILLEGAL && distinct!=D_FIRST)) for(size_t i=0; icount(); i++) @@ -947,7 +952,7 @@ static void join_nameless_row(Table& src static void _join(Request& r, MethodParams& params) { Table* maybe_src=params.as_no_junction(0, "table ref must not be code").get_table(); if(!maybe_src) - throw Exception("parser.runtime", + throw Exception(PARSER_RUNTIME, 0, "source is not a table"); Table& src=*maybe_src; @@ -958,7 +963,7 @@ static void _join(Request& r, MethodPara Table& dest=GET_SELF(r, VTable).table(); if(&src == &dest) - throw Exception("parser.runtime", + throw Exception(PARSER_RUNTIME, 0, "source and destination are same table"); @@ -1087,11 +1092,11 @@ static void _sql(Request& r, MethodParam offset=(ulong)r.process_to_value(*voffset).as_double(); } if(valid_options!=options->count()) - throw Exception("parser.runtime", + throw Exception(PARSER_RUNTIME, 0, "called with invalid option"); } else - throw Exception("parser.runtime", + throw Exception(PARSER_RUNTIME, 0, "options must be hash"); }