--- parser3/src/classes/table.C 2005/08/09 08:14:48 1.210 +++ parser3/src/classes/table.C 2005/08/26 12:23:10 1.213 @@ -5,7 +5,7 @@ Author: Alexandr Petrosian (http://paf.design.ru) */ -static const char * const IDENT_TABLE_C="$Date: 2005/08/09 08:14:48 $"; +static const char * const IDENT_TABLE_C="$Date: 2005/08/26 12:23:10 $"; #include "classes.h" #include "pa_vmethod_frame.h" @@ -73,6 +73,7 @@ static Table::Action_options get_action_ ] but there is ^table.locate[name;value] + ...if(voptions.is_defined() && !voptions.is_string())) if(maybe_options.is_string()) { // allow empty options result.defined=true; return result; @@ -146,6 +147,11 @@ static void _create(Request& r, MethodPa size_t raw_pos_after=0; Table::columns_type columns; if(params.count()==2) { + String snameless=params.as_string(0, "called with two params, first param may only be string 'nameless'"); + if(snameless!="nameless") + throw Exception("parser.runtime", + &snameless, + "table::create called with two params, first param may only be 'nameless'"); columns=Table::columns_type(0); // nameless } else { columns=Table::columns_type(new ArrayString); @@ -477,8 +483,8 @@ static void _offset(Request& r, MethodPa "is invalid whence, valid are 'cur' or 'set'"); } - Value& offset_expr=params.as_junction(params.count()-1, "offset must be expression"); - table.offset(absolute, r.process_to_value(offset_expr).as_int()); + int offset=params.as_int(params.count()-1, "offset must be expression", r); + table.offset(absolute, offset); } else r.write_no_lang(*new VInt(table.current())); } @@ -939,7 +945,7 @@ static void _sql(Request& r, MethodParam ulong offset=0; if(params.count()>1) { Value& voptions=params.as_no_junction(1, "options must be hash, not code"); - if(!voptions.is_string()) + if(voptions.is_defined() && !voptions.is_string()) if(HashStringValue* options=voptions.get_hash()) { int valid_options=0; if(Value* vbind=options->get(sql_bind_name)) {