|
|
| version 1.243, 2008/05/27 19:01:46 | version 1.249, 2009/04/16 01:10:21 |
|---|---|
| Line 1 | Line 1 |
| /** @file | /** @file |
| Parser: @b table parser class. | Parser: @b table parser class. |
| Copyright (c) 2001-2005 ArtLebedev Group (http://www.artlebedev.com) | Copyright (c) 2001-2009 ArtLebedev Group (http://www.artlebedev.com) |
| Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru) | Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru) |
| */ | */ |
| Line 344 static void _load(Request& r, MethodPara | Line 344 static void _load(Request& r, MethodPara |
| } | } |
| // loading text | // loading text |
| char *data=file_read_text(r.charsets, | char *data=file_load_text(r, |
| r.absolute(params.as_string(filename_param_index, FILE_NAME_MUST_BE_STRING)), | r.absolute(params.as_string(filename_param_index, FILE_NAME_MUST_BE_STRING)), |
| true, | true, |
| options | options |
| Line 451 static void _save(Request& r, MethodPara | Line 451 static void _save(Request& r, MethodPara |
| --param_index; | --param_index; |
| const String& file_name=params.as_string(param_index++, FILE_NAME_MUST_NOT_BE_CODE); | const String& file_name=params.as_string(param_index++, FILE_NAME_MUST_NOT_BE_CODE); |
| String file_spec=r.absolute(file_name); | |
| if(do_append && file_exist(file_spec)) | |
| output_column_names=false; | |
| TableSeparators separators; | TableSeparators separators; |
| if(param_index<params.count()) { | if(param_index<params.count()) { |
| Line 515 static void _save(Request& r, MethodPara | Line 519 static void _save(Request& r, MethodPara |
| // write | // write |
| { | { |
| const char* data_cstr=sdata.cstr(); | const char* data_cstr=sdata.cstr(); |
| file_write(r.absolute(file_name), | file_write(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 566 static void _save(Request& r, MethodPara | Line 570 static void _save(Request& r, MethodPara |
| // write | // write |
| { | { |
| string data=ost.str(); | string data=ost.str(); |
| const char* data_cstr = data.c_str(); | const char* data_cstr=data.c_str(); |
| file_write(r.absolute(file_name), data_cstr, data.length(), true /* as text */, do_append); | file_write(file_spec, data_cstr, data.length(), true /* as text */, do_append); |
| } | } |
| #endif | #endif |
| Line 947 static void _locate(Request& r, MethodPa | Line 951 static void _locate(Request& r, MethodPa |
| bool result=params[0].get_junction()? | bool result=params[0].get_junction()? |
| _locate_expression(table, o, r, params) : | _locate_expression(table, o, r, params) : |
| _locate_name_value(table, o, r, params); | _locate_name_value(table, o, r, params); |
| r.write_no_lang(*new VBool(result)); | r.write_no_lang(VBool::get(result)); |
| } | } |
| Line 1103 void unmarshal_bind_updates(HashStringVa | Line 1107 void unmarshal_bind_updates(HashStringVa |
| if(ph->were_updated) { | if(ph->were_updated) { |
| Value* value; | Value* value; |
| if(ph->is_null) | if(ph->is_null) |
| value=new VVoid(); | value=VVoid::get(); |
| else | else |
| if(ph->value) | if(ph->value) |
| value=new VString(*new String(ph->value, 0, true/*tainted*/)); | value=new VString(*new String(ph->value, 0, true/*tainted*/)); |
| Line 1117 static void _sql(Request& r, MethodParam | Line 1121 static void _sql(Request& r, MethodParam |
| Value& statement=params.as_junction(0, "statement must be code"); | Value& statement=params.as_junction(0, "statement must be code"); |
| HashStringValue* bind=0; | HashStringValue* bind=0; |
| ulong limit=0; | ulong limit=SQL_NO_LIMIT; |
| ulong offset=0; | ulong offset=0; |
| if(params.count()>1) { | if(params.count()>1) { |
| Value& voptions=params.as_no_junction(1, "options must be hash, not code"); | Value& voptions=params.as_no_junction(1, "options must be hash, not code"); |