anchor.diff:              ?assertEqual(ok, fetch_close(SKey, SR7b, IsSec))
           after
               ?assertEqual(ok, close(SKey, SR7b))
  +        end
  +    catch
  +        Class:Reason ->  
  +            timer:sleep(1000),
  +            ?LogDebug("Exception~n~p:~p~n~p~n", [Class, Reason, erlang:get_stacktrace()]),
  +            ?assert( true == "all tests completed")
  +    end,
  +    ok. 
  +
  +test_with_or_without_sec_part2(IsSec) ->
  +    try
  +        ClEr = 'ClientError',
  +        % SeEx = 'SecurityException',
  +
  +        ?LogDebug("----------------------------------~n"),
  +        ?LogDebug("---TEST--- ~p_part2 ----Security ~p", [?MODULE, IsSec]),
  +        ?LogDebug("----------------------------------~n"),
  +
  +        ?LogDebug("schema ~p~n", [imem_meta:schema()]),
  +        ?LogDebug("data nodes ~p~n", [imem_meta:data_nodes()]),
  +        ?assertEqual(true, is_atom(imem_meta:schema())),
  +        ?assertEqual(true, lists:member({imem_meta:schema(),node()}, imem_meta:data_nodes())),
  +
  +        ?assertEqual([],receive_raw()),
  +
  +        SKey=case IsSec of
  +            true ->     ?imem_test_admin_login();
  +            false ->    none
           end,
   
  +        catch imem_meta:drop_table(def),
  +
  +        ?assertEqual(ok, imem_sql:exec(SKey, "
  +            create table def (
  +                col1 varchar2(10), 
  +                col2 integer
  +            );"
  +            , 0, [{schema,imem}], IsSec)),
  +
  +        ?assertEqual(ok, insert_range(SKey, 11, def, imem, IsSec)),
  +
  +        TableRows1 = lists:sort(if_call_mfa(IsSec,read,[SKey, def])),
  +        [Meta] = if_call_mfa(IsSec, read, [SKey, ddTable, {imem,def}]),
  +        ?LogDebug("Meta table~n~p~n", [Meta]),
  +        ?LogDebug("original table~n~p~n", [TableRows1]),
  +        
           SR8 = exec(SKey,query8, 100, IsSec, "
               select 
                     col1 as c1
  
positive.code:             {ok, Sql8e, SF8e} = filter_and_sort(SKey, SR8, {'or',[{1,[<<"$in$">>,<<"3">>]},{2,[<<"$in$">>,<<"3">>]}]}, [{?MainIdx,2,<<"asc">>},{?MainIdx,3,<<"desc">>}], [2,1], IsSec),
              ?assertEqual(Sorted8b, result_tuples_sort(List8a,SR8#stmtResult.rowFun, SF8e)),
              ?LogDebug("Sql8e ~p~n", [Sql8e]),
              Expected8e = "select col2, col1 c1 from def where (imem.def.col1 = '3' or imem.def.col2 = 3) and col1 < '4' order by col1 asc, col2 desc",
              ?assertEqual(Expected8e, string:strip(binary_to_list(Sql8e))),
  
              ?assertEqual(ok, fetch_close(SKey, SR8, IsSec))
  
negative.code:             % ?LogDebug("Result9a ~p~n", [Result9a]),
              {ok, Sql9a, _SF9a} = Result9a,
              % ?LogDebug("Sql9a ~p~n", [Sql9a]),
              Expected9a = "select a.col1, b.col1, a.col2 from def as a, def as b where a.col1 = b.col1 order by 1 asc, 3 desc",
              ?assertEqual(Expected9a, string:strip(binary_to_list(Sql9a))),
  
              Result9b = filter_and_sort(SKey, SR9a, {undefined,[]}, [{3,2,<<"asc">>},{2,3,<<"desc">>}], [1,3,2], IsSec),
              % ?LogDebug("Result9b ~p~n", [Result9b]),
              {ok, Sql9b, _SF9b} = Result9b,
              % ?LogDebug("Sql9b ~p~n", [Sql9b]),
              Expected9b = "select a.col1, b.col1, a.col2 from def as a, def as b where a.col1 = b.col1 order by b.col1 asc, a.col2 desc",
              ?assertEqual(Expected9b, string:strip(binary_to_list(Sql9b))),
  
              ?assertEqual(ok, fetch_close(SKey, SR9a, IsSec))
  