--- parser3/src/classes/hash.C 2025/05/26 01:56:54 1.172 +++ parser3/src/classes/hash.C 2026/11/28 22:13:43 1.175 @@ -1,7 +1,7 @@ /** @file Parser: @b hash 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 */ @@ -18,7 +18,7 @@ #include "pa_vbool.h" #include "pa_vmethod_frame.h" -volatile const char * IDENT_HASH_C="$Id: hash.C,v 1.172 2025/05/26 01:56:54 moko Exp $"; +volatile const char * IDENT_HASH_C="$Id: hash.C,v 1.175 2026/11/28 22:13:43 moko Exp $"; // class @@ -333,29 +333,22 @@ static void _sql(Request& r, MethodParam Table2hash_value_type value_type=C_HASH; if(params.count()>1) if(HashStringValue* options=params.as_hash(1, "sql options")) { - int valid_options=0; for(HashStringValue::Iterator i(*options); i; i.next() ){ String::Body key=i.key(); Value* value=i.value(); if(key == sql_bind_name) { bind=value->get_hash(); - valid_options++; } else if(key == sql_limit_name) { limit=(ulong)r.process(*value).as_double(); - valid_options++; } else if(key == sql_offset_name) { offset=(ulong)r.process(*value).as_double(); - valid_options++; } else if (key == sql_distinct_name) { distinct=r.process(*value).as_bool(); - valid_options++; } else if (key == sql_value_type_name) { value_type=get_value_type(r.process(*value)); - valid_options++; - } + } else + throw Exception(PARSER_RUNTIME, 0, CALLED_WITH_INVALID_OPTION); } - if(valid_options!=options->count()) - throw Exception(PARSER_RUNTIME, 0, CALLED_WITH_INVALID_OPTION); } SQL_Driver::Placeholder* placeholders=0; @@ -496,7 +489,7 @@ struct Hash_seq_item : public PA_Allocat }; #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 ); @@ -546,8 +539,7 @@ static void _sort(Request& r, MethodPara seq[pos].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(pos=0; pos