--- parser3/src/classes/table.C 2024/12/06 22:03:58 1.375 +++ parser3/src/classes/table.C 2025/05/27 15:10:24 1.381 @@ -26,7 +26,7 @@ #include "pa_array.h" #include "pa_varray.h" -volatile const char * IDENT_TABLE_C="$Id: table.C,v 1.375 2024/12/06 22:03:58 moko Exp $"; +volatile const char * IDENT_TABLE_C="$Id: table.C,v 1.381 2025/05/27 15:10:24 moko Exp $"; // class @@ -404,7 +404,7 @@ static void skip_empty_lines( char** dat typedef void (*Skip_lines_action)(char** data_ref); 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; bool nameless=first_param=="nameless"; if(nameless) @@ -417,7 +417,7 @@ static void _load(Request& r, MethodPara control_chars.load(*options); // 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; @@ -624,7 +624,7 @@ static void table_to_csv(String& result, 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; bool do_append=false; @@ -638,7 +638,7 @@ static void _save(Request& r, MethodPara else --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); if(do_append && file_exist(file_spec)) @@ -683,7 +683,7 @@ static void _csv_string(Request& r, Meth bool output_column_names=true; size_t param_index=0; 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; param_index++; } else { @@ -849,11 +849,11 @@ static void table_row_to_hash(Table::ele for(Array_iterator i(*info->value_fields); i; ) { size_t value_field=i.next(); if(value_fieldcount()) - hash.put(columns ? *columns->get(value_field) : String(pa_uitoa(value_field)), new VString(*row->get(value_field))); + hash.put(columns ? *columns->get(value_field) : String::Body::uitoa(value_field), new VString(*row->get(value_field))); } } else { // all fields for(size_t index=0; indexcount(); index++) { - hash.put(columns && index < columns->count() ? *columns->get(index) : String(pa_uitoa(index)), new VString(*row->get(index))); + hash.put(columns && index < columns->count() ? *columns->get(index) : String::Body::uitoa(index), new VString(*row->get(index))); } } exist=info->hash->put_dont_replace(*key, vhash); @@ -1071,7 +1071,7 @@ static void _cells(Request& r, MethodPar size_t row_size=self_table[self_table.current()]->count(); // number of columns in current row if(params.count()){ - int limit=params.as_int(params.count()-1, "offset must be expression", r); + int limit=params.as_int(params.count()-1, "limit must be expression", r); if(limit<0) limit=0; if((size_t)limitis_null) value=VVoid::get(); else - value=new VString(*new String(ph->value, String::L_TAINTED)); + value=new VString(ph->value); hash.put(ph->name, value); } } @@ -1567,7 +1567,7 @@ static void _select(Request& r, MethodPa if(r.check_skip_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]; if(row==0) break; } @@ -1580,7 +1580,7 @@ static void _select(Request& r, MethodPa if(r.check_skip_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]; } }