--- parser3/src/classes/table.C 2025/05/27 15:10:24 1.381 +++ parser3/src/classes/table.C 2026/11/28 22:13:43 1.385 @@ -1,7 +1,7 @@ /** @file Parser: @b table parser class. - Copyright (c) 2001-2024 Art. Lebedev Studio (http://www.artlebedev.com) + Copyright (c) 2001-2026 Art. Lebedev Studio (https://www.artlebedev.com) Authors: Konstantin Morshnev , Alexandr Petrosian */ @@ -26,7 +26,7 @@ #include "pa_array.h" #include "pa_varray.h" -volatile const char * IDENT_TABLE_C="$Id: table.C,v 1.381 2025/05/27 15:10:24 moko Exp $"; +volatile const char * IDENT_TABLE_C="$Id: table.C,v 1.385 2026/11/28 22:13:43 moko Exp $"; // class @@ -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_file_name(filename_param_index)), true, options); + char *data=file_load_text(r, r.full_disk_path(params.as_file_name(filename_param_index), PA_ALLOW_HTTP), true, options); Skip_lines_action skip_lines_action = (control_chars.separator=='#' || control_chars.encloser=='#') ? skip_empty_lines : skip_empty_and_comment_lines; @@ -1100,7 +1100,7 @@ struct Table_seq_item : public PA_Alloca }; #endif static int sort_cmp_string(const void *a, const void *b) { - return strcmp( + return Charset::strcmp_utf8( static_cast(a)->value.c_str, static_cast(b)->value.c_str ); @@ -1143,8 +1143,7 @@ static void _sort(Request& r, MethodPara seq[i].value.d=value.as_expr_result().as_double(); } - // @todo: handle this elsewhere - if(r.charsets.source().NAME()=="KOI8-R" && key_values_are_strings) { + if(!r.charsets.source().isUTF8() && key_values_are_strings) { // Charset::strcmp_utf8 requires UTF-8 for(i=0; i pa_array_limit) + throw Exception(PARSER_RUNTIME, 0, "table size (%d) exceeds limit $MAIN:LIMITS.max_array_size (%d)", table.count(), pa_array_limit); } static void _insert(Request& r, MethodParams& params) { @@ -1320,6 +1322,9 @@ static void _insert(Request& r, MethodPa } else { table.insert(table.current(), row_from_string(r, params[0])); } + + if(table.count() > pa_array_limit) + throw Exception(PARSER_RUNTIME, 0, "table size (%d) exceeds limit $MAIN:LIMITS.max_array_size (%d)", table.count(), pa_array_limit); } static void _delete(Request& r, MethodParams&) {