Ejemplo n.º 1
0
    int create_cache_db (int argc, char** argv)
    {
        try
        {
            KApp::CArgs args (argc, argv, Options, countof (Options), ::XMLLogger_Args, ::XMLLogger_ArgsQty);
            KApp::CXMLLogger xml_logger ( args );
            uint32_t param_count = args.GetParamCount ();
            if ( param_count != 2 )
            {
                MiniUsage (args.GetArgs());
                return 0;
            }

            g_Params.dbPathSrc = args.GetParamValue (0);
            g_Params.dbPathDst = args.GetParamValue (1);

            if (args.GetOptionCount (OPTION_ID_SPREAD_THRESHOLD))
                g_Params.id_spread_threshold = args.GetOptionValueUInt<int64_t> ( OPTION_ID_SPREAD_THRESHOLD, 0 );

            if (args.GetOptionCount (OPTION_CURSOR_CACHE_SIZE))
                g_Params.cursor_cache_size = 1024*1024 * args.GetOptionValueUInt<size_t> ( OPTION_CURSOR_CACHE_SIZE, 0 );

            if (args.GetOptionCount (OPTION_MIN_CACHE_COUNT))
                g_Params.min_cache_count = args.GetOptionValueUInt <size_t> ( OPTION_MIN_CACHE_COUNT, 0 );

            return create_cache_db_impl_safe ();
        }
        catch (...) // here we handle only exceptions in CArgs or CXMLLogger
        {
            return Utils::HandleException ( false, NULL, 0 );
        }
    }
Ejemplo n.º 2
0
    int expand_variations (int argc, char** argv)
    {
        int ret;
        try
        {
            KApp::CArgs args;
            args.MakeAndHandle (argc, argv, Options, countof (Options));

            if (args.GetOptionCount (OPTION_ALG) == 1)
            {
                char const* alg = args.GetOptionValue ( OPTION_ALG, 0 );
                if (!strcmp(alg, PARAM_ALG_SW))
                    g_Params.alg = ::refvarAlgSW;
                else if (!strcmp(alg, PARAM_ALG_RA))
                    g_Params.alg = ::refvarAlgRA;
                else
                {
                    PLOGMSG ( klogErr, ( klogErr,
                        "Error: Unknown algorithm specified: \"$(ALG)\"", "ALG=%s", alg ));
                    return 3;
                }
            }

            ret = expand_variations_impl ();
        }
        catch ( ngs::ErrorMsg const& e )
        {
            PLOGMSG ( klogErr,
                ( klogErr, "ngs::ErrorMsg: $(WHAT)", "WHAT=%s", e.what()
                ));
            ret = 3;
        }
        catch (...)
        {
            Utils::HandleException ();
            ret = 3;
        }

        return ret;
    }