|
|
| version 1.268, 2009/09/17 23:32:39 | version 1.271, 2010/05/16 22:12:50 |
|---|---|
| Line 9 static const char * const IDENT_TABLE_C= | Line 9 static const char * const IDENT_TABLE_C= |
| #if (!defined(NO_STRINGSTREAM) && !defined(FREEBSD4)) | #if (!defined(NO_STRINGSTREAM) && !defined(FREEBSD4)) |
| #include <sstream> | #include <sstream> |
| using namespace std; | |
| #endif | #endif |
| #include "classes.h" | #include "classes.h" |
| Line 388 static void _load(Request& r, MethodPara | Line 387 static void _load(Request& r, MethodPara |
| #if (!defined(NO_STRINGSTREAM) && !defined(FREEBSD4)) | #if (!defined(NO_STRINGSTREAM) && !defined(FREEBSD4)) |
| void maybe_enclose( ostringstream& to, const String& from, char encloser ) { | #include "gc_allocator.h" |
| typedef std::basic_stringstream<char, std::char_traits<char>, gc_allocator<char> > pa_stringstream; | |
| typedef std::basic_string<char, std::char_traits<char>, gc_allocator<char> > pa_string; | |
| void maybe_enclose( pa_stringstream& to, const String& from, char encloser ) { | |
| if(encloser) { | if(encloser) { |
| to<<encloser; | to<<encloser; |
| // while we have 'encloser'... | // while we have 'encloser'... |
| Line 479 static void _save(Request& r, MethodPara | Line 483 static void _save(Request& r, MethodPara |
| #if (!defined(NO_STRINGSTREAM) && !defined(FREEBSD4)) | #if (!defined(NO_STRINGSTREAM) && !defined(FREEBSD4)) |
| ostringstream ost(stringstream::out); | pa_stringstream ost(std::stringstream::out); |
| // process header | // process header |
| if(output_column_names) { | if(output_column_names) { |
| Line 521 static void _save(Request& r, MethodPara | Line 525 static void _save(Request& r, MethodPara |
| // write | // write |
| { | { |
| string data=ost.str(); | pa_string data=ost.str(); |
| const char* data_cstr=data.c_str(); | const char* data_cstr=data.c_str(); |
| file_write(r.charsets, 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); |
| Line 681 static void table_row_to_hash(Table::ele | Line 685 static void table_row_to_hash(Table::ele |
| bool exist=false; | bool exist=false; |
| switch(info->value_type) { | switch(info->value_type) { |
| case C_STRING: { | case C_STRING: { |
| exist=info->hash->put_dont_replace(*key, new VString(*row->get(info->value_fields->get(0)))); | size_t index=info->value_fields->get(0); |
| exist=info->hash->put_dont_replace(*key, (index < row->count()) ? new VString(*row->get(index)) : new VString()); | |
| break; | break; |
| } | } |
| case C_HASH: { | case C_HASH: { |
| Line 975 static void _flip(Request& r, MethodPara | Line 980 static void _flip(Request& r, MethodPara |
| Table& old_table=GET_SELF(r, VTable).table(); | Table& old_table=GET_SELF(r, VTable).table(); |
| Table& new_table=*new Table(0); | Table& new_table=*new Table(0); |
| if(size_t old_count=old_table.count()) | if(size_t old_count=old_table.count()) |
| if(size_t old_cols=old_table[0]->count()) | if(size_t old_cols=old_table.columns()?old_table.columns()->count():old_table[0]->count()) |
| for(size_t column=0; column<old_cols; column++) { | for(size_t column=0; column<old_cols; column++) { |
| Table::element_type new_row(new ArrayString(old_count)); | Table::element_type new_row(new ArrayString(old_count)); |
| for(size_t i=0; i<old_count; i++) { | for(size_t i=0; i<old_count; i++) { |