--- parser3/src/classes/table.C 2008/02/14 09:10:24 1.239 +++ parser3/src/classes/table.C 2008/05/27 19:01:46 1.243 @@ -5,10 +5,12 @@ Author: Alexandr Petrosian (http://paf.design.ru) */ -static const char * const IDENT_TABLE_C="$Date: 2008/02/14 09:10:24 $"; +static const char * const IDENT_TABLE_C="$Date: 2008/05/27 19:01:46 $"; +#ifndef NO_STRINGSTREAM #include using namespace std; +#endif #include "classes.h" #include "pa_vmethod_frame.h" @@ -387,6 +389,8 @@ static void _load(Request& r, MethodPara GET_SELF(r, VTable).set_table(table); } +#ifdef NO_STRINGSTREAM + void maybe_enclose( String& to, const String& from, char encloser, const String* sencloser ) { if(encloser) { to<<*sencloser; @@ -407,6 +411,8 @@ void maybe_enclose( String& to, const St to<count()) - throw Exception(PARSER_RUNTIME, - 0, - "invalid option passed"); - } else { - throw Exception(PARSER_RUNTIME, - 0, - "additional params must be hash (did you spell mode parameter correctly?)"); - } - } - } - if(param_indexlength()) { // delimiter set and we have body if(need_delim) // need delim & iteration produced string? r.write_pass_lang(r.process(*delim_maybe_code)); - need_delim=true; + else + need_delim=true; } + r.write_pass_lang(sv_processed); if(lskip==Request::SKIP_BREAK) @@ -693,15 +666,13 @@ static void table_row_to_hash(Table::ele if(!key) return; // ignore rows without key [too-short-record_array if-indexed] - bool exist = false; - switch (info->value_type) { - case C_STRING: - { + bool exist=false; + switch(info->value_type) { + case C_STRING: { exist=info->hash->put_dont_replace(*key, new VString(*row->get(info->value_fields->get(0)))); + break; } - break; - case C_HASH: - { + case C_HASH: { VHash* vhash=new VHash; HashStringValue& hash=vhash->hash(); for(Array_iterator i(*info->value_fields); i.has_next(); ) { @@ -713,18 +684,16 @@ static void table_row_to_hash(Table::ele } exist=info->hash->put_dont_replace(*key, vhash); + break; } - break; - case C_TABLE: - { - VTable* vtable=(VTable*)info->hash->get(*key); // put. table existed? - if( info->distinct==D_ILLEGAL ){ - exist=true; - break; - } - + case C_TABLE: { + VTable* vtable=(VTable*)info->hash->get(*key); // table exist? Table* table; if(vtable) { + if(info->distinct==D_ILLEGAL) { + exist=true; + break; + } table=vtable->get_table(); } else { // no? creating table of same structure as source @@ -733,8 +702,8 @@ static void table_row_to_hash(Table::ele info->hash->put(*key, new VTable(table)); } *table+=row; + break; } - break; } if(exist && info->distinct==D_ILLEGAL) throw Exception(PARSER_RUNTIME,