|
|
| version 1.375, 2024/12/06 22:03:58 | version 1.378, 2024/12/11 15:46:38 |
|---|---|
| Line 404 static void skip_empty_lines( char** dat | Line 404 static void skip_empty_lines( char** dat |
| typedef void (*Skip_lines_action)(char** data_ref); | typedef void (*Skip_lines_action)(char** data_ref); |
| static void _load(Request& r, MethodParams& params) { | static void _load(Request& r, MethodParams& params) { |
| const String& first_param=params.as_string(0, FILE_NAME_MUST_BE_STRING); | const String& first_param=params.as_file_name(0); |
| int filename_param_index=0; | int filename_param_index=0; |
| bool nameless=first_param=="nameless"; | bool nameless=first_param=="nameless"; |
| if(nameless) | if(nameless) |
| Line 417 static void _load(Request& r, MethodPara | Line 417 static void _load(Request& r, MethodPara |
| control_chars.load(*options); | control_chars.load(*options); |
| // loading text | // loading text |
| char *data=file_load_text(r, r.full_disk_path(params.as_string(filename_param_index, FILE_NAME_MUST_BE_STRING)), true, options); | char *data=file_load_text(r, r.full_disk_path(params.as_file_name(filename_param_index)), true, options); |
| Skip_lines_action skip_lines_action = (control_chars.separator=='#' || control_chars.encloser=='#') ? skip_empty_lines : skip_empty_and_comment_lines; | Skip_lines_action skip_lines_action = (control_chars.separator=='#' || control_chars.encloser=='#') ? skip_empty_lines : skip_empty_and_comment_lines; |
| Line 624 static void table_to_csv(String& result, | Line 624 static void table_to_csv(String& result, |
| static void _save(Request& r, MethodParams& params) { | static void _save(Request& r, MethodParams& params) { |
| const String& first_arg=params.as_string(0, FIRST_ARG_MUST_NOT_BE_CODE); | const String& first_arg=params.as_string(0, PARAMETER_MUST_BE_STRING); |
| size_t param_index=1; | size_t param_index=1; |
| bool do_append=false; | bool do_append=false; |
| Line 638 static void _save(Request& r, MethodPara | Line 638 static void _save(Request& r, MethodPara |
| else | else |
| --param_index; | --param_index; |
| const String& file_name=params.as_string(param_index++, FILE_NAME_MUST_BE_STRING); | const String& file_name=params.as_file_name(param_index++); |
| String file_spec=r.full_disk_path(file_name); | String file_spec=r.full_disk_path(file_name); |
| if(do_append && file_exist(file_spec)) | if(do_append && file_exist(file_spec)) |
| Line 683 static void _csv_string(Request& r, Meth | Line 683 static void _csv_string(Request& r, Meth |
| bool output_column_names=true; | bool output_column_names=true; |
| size_t param_index=0; | size_t param_index=0; |
| if(params.count()>0 && params[0].is_string()) { | if(params.count()>0 && params[0].is_string()) { |
| if(params.as_string(0, FIRST_ARG_MUST_NOT_BE_CODE)=="nameless") { | if(params.as_string(0, PARAM_MUST_NOT_BE_CODE)=="nameless") { |
| output_column_names=false; | output_column_names=false; |
| param_index++; | param_index++; |
| } else { | } else { |
| Line 1567 static void _select(Request& r, MethodPa | Line 1567 static void _select(Request& r, MethodPa |
| if(r.check_skip_break()) | if(r.check_skip_break()) |
| break; | break; |
| if(condition && ++appended > (size_t)offset) // ...condition is true, adding to the result | if(condition && ++appended > (size_t)offset && source_table.valid(row)) // ...condition is true, adding to the result |
| result_table+=source_table[row]; | result_table+=source_table[row]; |
| if(row==0) break; | if(row==0) break; |
| } | } |
| Line 1580 static void _select(Request& r, MethodPa | Line 1580 static void _select(Request& r, MethodPa |
| if(r.check_skip_break()) | if(r.check_skip_break()) |
| break; | break; |
| if(condition && ++appended > (size_t)offset) // ...condition is true, adding to the result | if(condition && ++appended > (size_t)offset && source_table.valid(row)) // ...condition is true, adding to the result |
| result_table+=source_table[row]; | result_table+=source_table[row]; |
| } | } |
| } | } |