--- parser3/src/classes/hash.C 2016/12/26 15:56:35 1.138 +++ parser3/src/classes/hash.C 2017/05/17 14:22:11 1.142 @@ -1,7 +1,7 @@ /** @file Parser: @b hash parser class. - Copyright (c) 2001-2015 Art. Lebedev Studio (http://www.artlebedev.com) + Copyright (c) 2001-2017 Art. Lebedev Studio (http://www.artlebedev.com) Author: Alexandr Petrosian (http://paf.design.ru) */ @@ -17,7 +17,7 @@ #include "pa_vbool.h" #include "pa_vmethod_frame.h" -volatile const char * IDENT_HASH_C="$Id: hash.C,v 1.138 2016/12/26 15:56:35 moko Exp $"; +volatile const char * IDENT_HASH_C="$Id: hash.C,v 1.142 2017/05/17 14:22:11 moko Exp $"; // class @@ -61,11 +61,11 @@ public: statement_cstr(astatement_cstr), distinct(adistinct), rows_hash(arows_hash), - value_type(avalue_type), row_value(0), column_index(0), - one_bool_column(false), columns(*new ArrayString), + one_bool_column(false), + value_type(avalue_type), empty(0) { } @@ -74,7 +74,7 @@ public: columns+=new String(str, String::L_TAINTED /* no length as 0x00 can be inside */); return false; } catch(...) { - error=SQL_Error("exception occured in Hash_sql_event_handlers::add_column"); + error=SQL_Error("exception occurred in Hash_sql_event_handlers::add_column"); return true; } } @@ -180,7 +180,7 @@ public: column_index++; return false; } catch(...) { - error=SQL_Error("exception occured in Hash_sql_event_handlers::add_row_cell"); + error=SQL_Error("exception occurred in Hash_sql_event_handlers::add_row_cell"); return true; } } @@ -421,7 +421,7 @@ static void _foreach(Request& r, MethodP r.put_element(caller, *value_var_name, i.value()); Value& sv_processed=r.process(*body_code); - Request::Skip lskip=r.get_skip(); r.set_skip(Request::SKIP_NOTHING); + TempSkip4Delimiter skip(r); const String* s_processed=sv_processed.get_string(); if(s_processed && !s_processed->is_empty()) { // we have body @@ -433,7 +433,7 @@ static void _foreach(Request& r, MethodP r.write(sv_processed); - if(lskip==Request::SKIP_BREAK) + if(skip.check_break()) break; } } else { @@ -447,9 +447,8 @@ static void _foreach(Request& r, MethodP r.put_element(caller, *value_var_name, i.value()); r.process_write(*body_code); - Request::Skip lskip=r.get_skip(); r.set_skip(Request::SKIP_NOTHING); - if(lskip==Request::SKIP_BREAK) + if(r.check_skip_break()) break; } } @@ -497,9 +496,7 @@ static void _sort(Request& r, MethodPara const String& key_var_name=params.as_string(0, "key-var name must be string"); const String& value_var_name=params.as_string(1, "value-var name must be string"); Value& key_maker=params.as_junction(2, "key-maker must be code"); - bool reverse=params.count()>3/*..[desc|asc|]*/? - reverse=params.as_no_junction(3, "order must not be code").as_string()=="desc": - false; // default=asc + bool reverse=params.count()>3 /*..[desc|asc|]*/ && params.as_no_junction(3, "order must not be code").as_string()=="desc"; // default=asc const String* key_var=key_var_name.is_empty()? 0 : &key_var_name; const String* value_var=value_var_name.is_empty()? 0 : &value_var_name;