--- parser3/src/classes/array.C 2025/05/28 00:58:02 1.41 +++ parser3/src/classes/array.C 2026/04/25 13:38:46 1.43 @@ -1,7 +1,7 @@ /** @file Parser: @b array 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 */ @@ -17,7 +17,7 @@ #include "pa_vbool.h" #include "pa_vmethod_frame.h" -volatile const char * IDENT_ARRAY_C="$Id: array.C,v 1.41 2025/05/28 00:58:02 moko Exp $"; +volatile const char * IDENT_ARRAY_C="$Id: array.C,v 1.43 2026/04/25 13:38:46 moko Exp $"; // class @@ -452,34 +452,26 @@ 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; bool distinct_specified=false; 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(); distinct_specified=true; - valid_options++; } else if (key == sql_value_type_name) { value_type=get_value_type(r.process(*value)); - valid_options++; } else if (key == "sparse") { sparse=r.process(*value).as_bool(); - 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); if(distinct_specified && !sparse) throw Exception(PARSER_RUNTIME, 0, "'distinct' option can only be used when $.sparse(true) is specified"); }