--- parser3/src/classes/table.C 2009/06/14 00:33:36 1.258 +++ parser3/src/classes/table.C 2009/09/08 09:11:51 1.267 @@ -5,7 +5,7 @@ Author: Alexandr Petrosian (http://paf.design.ru) */ -static const char * const IDENT_TABLE_C="$Date: 2009/06/14 00:33:36 $"; +static const char * const IDENT_TABLE_C="$Date: 2009/09/08 09:11:51 $"; #if (!defined(NO_STRINGSTREAM) && !defined(FREEBSD4)) #include @@ -17,6 +17,7 @@ using namespace std; #include "pa_common.h" #include "pa_request.h" +#include "pa_charsets.h" #include "pa_vtable.h" #include "pa_vint.h" #include "pa_sql_connection.h" @@ -26,7 +27,7 @@ using namespace std; class MTable: public Methoded { public: // VStateless_class - Value* create_new_value(Pool&, HashStringValue*) { return new VTable(); } + Value* create_new_value(Pool&) { return new VTable(); } public: MTable(); @@ -39,10 +40,6 @@ public: // Methoded DECLARE_CLASS_VAR(table, new MTable, 0); -// externs - -extern String cycle_data_name; - #define TABLE_REVERSE_NAME "reverse" // globals @@ -465,7 +462,7 @@ static void _save(Request& r, MethodPara if(valid_options!=options->count()) throw Exception(PARSER_RUNTIME, 0, - "invalid option passed"); + INVALID_OPTION_PASSED); } else { throw Exception(PARSER_RUNTIME, 0, @@ -527,7 +524,7 @@ static void _save(Request& r, MethodPara string data=ost.str(); const char* data_cstr=data.c_str(); - file_write(file_spec, data_cstr, data.length(), true /* as text */, do_append); + file_write(r.charsets, file_spec, data_cstr, data.length(), true /* as text */, do_append); } #else @@ -569,8 +566,7 @@ static void _save(Request& r, MethodPara // write { const char* data_cstr=sdata.cstr(); - file_write(file_spec, - data_cstr, sdata.length(), true, do_append); + file_write(r.charsets, file_spec, data_cstr, sdata.length(), true, do_append); if(*data_cstr) // not empty (when empty it's not heap memory) pa_free((void*)data_cstr); // not needed anymore } @@ -611,8 +607,7 @@ static void _offset(Request& r, MethodPa } static void _menu(Request& r, MethodParams& params) { - Temp_hash_value - cycle_data_setter(r.classes_conf, cycle_data_name, /*any not null flag*/&r); + InCycle temp(r); Value& body_code=params.as_junction(0, "body must be code"); @@ -916,6 +911,14 @@ static void _sort(Request& r, MethodPara else seq[i].value.d=value.as_double(); } + + // @todo: handle this elsewhere + if(r.charsets.source().NAME()=="KOI8-R" && key_values_are_strings) { + for(i=0; ias_string().cstr(String::L_UNSPECIFIED); + ph.value=avalue->as_string().untaint_cstr(String::L_AS_IS); ph.is_null=avalue->get_class()==void_class; ph.were_updated=false; @@ -1164,8 +1166,8 @@ static void _sql(Request& r, MethodParam Temp_lang temp_lang(r, String::L_SQL); const String& statement_string=r.process_to_string(statement); - const char* statement_cstr= - statement_string.cstr(String::L_UNSPECIFIED, r.connection()); + const char* statement_cstr=statement_string.untaint_cstr(r.flang, r.connection()); + Table_sql_event_handlers handlers; #ifdef RESOURCES_DEBUG struct timeval mt[2];