|
|
| version 1.264, 2009/08/08 13:30:20 | version 1.267, 2009/09/08 09:11:51 |
|---|---|
| Line 17 using namespace std; | Line 17 using namespace std; |
| #include "pa_common.h" | #include "pa_common.h" |
| #include "pa_request.h" | #include "pa_request.h" |
| #include "pa_charsets.h" | |
| #include "pa_vtable.h" | #include "pa_vtable.h" |
| #include "pa_vint.h" | #include "pa_vint.h" |
| #include "pa_sql_connection.h" | #include "pa_sql_connection.h" |
| Line 461 static void _save(Request& r, MethodPara | Line 462 static void _save(Request& r, MethodPara |
| if(valid_options!=options->count()) | if(valid_options!=options->count()) |
| throw Exception(PARSER_RUNTIME, | throw Exception(PARSER_RUNTIME, |
| 0, | 0, |
| "invalid option passed"); | INVALID_OPTION_PASSED); |
| } else { | } else { |
| throw Exception(PARSER_RUNTIME, | throw Exception(PARSER_RUNTIME, |
| 0, | 0, |
| Line 523 static void _save(Request& r, MethodPara | Line 524 static void _save(Request& r, MethodPara |
| string data=ost.str(); | string data=ost.str(); |
| const char* data_cstr=data.c_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 | #else |
| Line 565 static void _save(Request& r, MethodPara | Line 566 static void _save(Request& r, MethodPara |
| // write | // write |
| { | { |
| const char* data_cstr=sdata.cstr(); | const char* data_cstr=sdata.cstr(); |
| file_write(file_spec, | file_write(r.charsets, file_spec, data_cstr, sdata.length(), true, do_append); |
| data_cstr, sdata.length(), true, do_append); | |
| if(*data_cstr) // not empty (when empty it's not heap memory) | if(*data_cstr) // not empty (when empty it's not heap memory) |
| pa_free((void*)data_cstr); // not needed anymore | pa_free((void*)data_cstr); // not needed anymore |
| } | } |
| Line 911 static void _sort(Request& r, MethodPara | Line 911 static void _sort(Request& r, MethodPara |
| else | else |
| seq[i].value.d=value.as_double(); | 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; i<old_count; i++) | |
| if(*seq[i].value.c_str) | |
| seq[i].value.c_str=Charset::transcode(seq[i].value.c_str, r.charsets.source(), UTF8_charset).cstr(); | |
| } | |
| // sort keys | // sort keys |
| _qsort(seq, old_count, sizeof(Table_seq_item), | _qsort(seq, old_count, sizeof(Table_seq_item), |
| key_values_are_strings?sort_cmp_string:sort_cmp_double); | key_values_are_strings?sort_cmp_string:sort_cmp_double); |
| Line 981 static void _flip(Request& r, MethodPara | Line 989 static void _flip(Request& r, MethodPara |
| } | } |
| static void _append(Request& r, MethodParams& params) { | static void _append(Request& r, MethodParams& params) { |
| // data | |
| Temp_lang temp_lang(r, String::L_PASS_APPENDED); | Temp_lang temp_lang(r, String::L_PASS_APPENDED); |
| const String& string=r.process_to_string(params.as_junction(0, "body must be code")); | const String& string=r.process_to_string(params[0]); |
| // parse cells | // parse cells |
| Table::element_type row=new ArrayString; | Table::element_type row=new ArrayString; |