Changeset 19139 for trunk/FACT++/src


Ignore:
Timestamp:
08/04/18 22:48:33 (6 years ago)
Author:
tbretz
Message:
Found a nicer way to add arguments to database URI
Location:
trunk/FACT++/src
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/Configuration.cc

    r19125 r19139  
    350350//!      The URL of the database from which the configuration data is
    351351//!      retrieved. It should be given in the form
    352 //!          \li [user[:password]@]server.com[:port]/database[/comp]
     352//!          \li [user[:password]@]server.com[:port]/database[?compress=0|1]
    353353//!
    354354//!      with
     
    358358//!          - port:     the port to which to connect (usually obsolete)
    359359//!          - database: The name of the database containing the table
    360 //!          - comp:     Force [comp=+] / prohibit [comp=-] compression
     360//!          - compress: Force [=1] / prohibit [=0] compression
    361361//!
    362362//!  The default is that connections to the SQL server are compressed
  • trunk/FACT++/src/Database.h

    r19124 r19139  
    1919    DatabaseName(const std::string &database) : compression(0)
    2020    {
    21         static const boost::regex expr("(([[:word:].-]+)(:(.+))?@)?([[:word:].-]+)(:([[:digit:]]+))?(/([[:word:].-]+))(/[+-])?");
     21        static const boost::regex expr("(([[:word:].-]+)(:(.+))?@)?([[:word:].-]+)(:([[:digit:]]+))?(/([[:word:].-]+))(\\?compress=[01])?");
    2222
    2323        boost::smatch what;
     
    3333        db     = what[9];
    3434
    35         compression = std::string(what[10])[1];
     35        compression = std::string(what[10])[10];
    3636
    3737        try
     
    6565        mysqlpp::Connection()
    6666    {
    67         if ((compression!='-' && boost::algorithm::to_lower_copy(server)!="localhost" && server!="127.0.0.1")||
    68             compression=='+')
     67        if ((compression!='0' && boost::algorithm::to_lower_copy(server)!="localhost" && server!="127.0.0.1")||
     68            compression=='1')
    6969            set_option(new mysqlpp::CompressOption());
    7070
  • trunk/FACT++/src/calcsource.cc

    r19136 r19139  
    2323         ->required()
    2424#endif
    25          , "Database link as in\n\tuser:password@server[:port]/database[/comp].")
     25         , "Database link as in\n\tuser:password@server[:port]/database[?compress=0|1].")
    2626        //("source-key",     var<uint32_t>(5),                "")
    2727        //("source-name",    var<string>(""),               "")
  • trunk/FACT++/src/drivectrl.cc

    r19125 r19139  
    31583158        ("deviation-count",          var<uint16_t>(3),          "Minimum number of reported deviation below deviation-limit to get 'OnTrack'")
    31593159        ("deviation-max",            var<uint16_t>(180),        "Maximum deviation in arcsec allowed to keep status 'OnTrack'")
    3160         ("source-database",          var<string>(),             "Database link as in\n\tuser:password@server[:port]/database[/comp].")
     3160        ("source-database",          var<string>(),             "Database link as in\n\tuser:password@server[:port]/database[?compress=0|1].")
    31613161        ("source",                   vars<string>(),            "Additional source entry in the form \"name,hh:mm:ss,dd:mm:ss\"")
    31623162        ;
  • trunk/FACT++/src/fits2sql.cc

    r19137 r19139  
    4444         ->required()
    4545#endif
    46          , "Database link as in\n\tuser:password@server[:port]/database[/comp].")
     46         , "Database link as in\n\tuser:password@server[:port]/database[?compress=0|1].")
    4747        ("file",           var<string>("")
    4848#if BOOST_VERSION >= 104200
  • trunk/FACT++/src/makedata.cc

    r19125 r19139  
    1919        ("source-name", var<string>(), "Source name")
    2020        ("date-time", var<string>(), "SQL time (UTC)")
    21         ("source-database", var<string>(""), "Database link as in\n\tuser:password@server[:port]/database[/comp].")
     21        ("source-database", var<string>(""), "Database link as in\n\tuser:password@server[:port]/database[?compress=0|1].")
    2222        ("max-current", var<double>(75), "Maximum current to display in other plots.")
    2323        ("max-zd", var<double>(75), "Maximum zenith distance to display in other plots")
  • trunk/FACT++/src/makeplots.cc

    r19125 r19139  
    4848        //("dec",       var<double>(), "Source declination")
    4949        ("date-time", var<string>(), "SQL time (UTC)")
    50         ("source-database", var<string>(""), "Database link as in\n\tuser:password@server[:port]/database[/comp].")
     50        ("source-database", var<string>(""), "Database link as in\n\tuser:password@server[:port]/database[?compress=0|1].")
    5151        ("max-current", var<double>(100), "Maximum current to display in other plots.")
    5252        ("max-zd", var<double>(50), "Maximum zenith distance to display in other plots")
  • trunk/FACT++/src/makeschedule.cc

    r19125 r19139  
    1919    control.add_options()
    2020        ("date", var<string>(), "SQL time (UTC), e.g. '2016-12-24' (equiv. '2016-12-24 12:00:00' to '2016-12-25 11:59:59')")
    21         ("source-database", var<string>()->required(), "Database link as in\n\tuser:password@server[:port]/database[/comp].")
    22         ("schedule-database", var<string>(), "Database link as in\n\tuser:password@server[:port]/database[/comp].")
     21        ("source-database", var<string>()->required(), "Database link as in\n\tuser:password@server[:port]/database[?compress=0|1].")
     22        ("schedule-database", var<string>(), "Database link as in\n\tuser:password@server[:port]/database[?compress=0|1].")
    2323        ("max-current", var<double>(90), "Global maximum current limit in uA")
    2424        ("max-zd", var<double>(75), "Global zenith distance limit in degree")
  • trunk/FACT++/src/root2sql.cc

    r19137 r19139  
    4848         ->required()
    4949#endif
    50          , "Database link as in\n\tuser:password@server[:port]/database[/comp].")
     50         , "Database link as in\n\tuser:password@server[:port]/database[?compress=0|1].")
    5151        ("file",           var<string>("")
    5252#if BOOST_VERSION >= 104200
  • trunk/FACT++/src/rootifysql.cc

    r19138 r19139  
    2424    po::options_description control("Rootify SQL");
    2525    control.add_options()
    26         ("uri,u",         var<string>()->required(),   "Database link as in\n\tuser:password@server[:port]/database[/comp].")
     26        ("uri,u",         var<string>()->required(),   "Database link as in\n\tuser:password@server[:port]/database[?compress=0|1].")
    2727        ("query,q",       var<string>(""),             "MySQL query (overwrites --file)")
    2828        ("file",          var<string>("rootify.sql"),  "An ASCII file with the MySQL query (overwrites --query)")
  • trunk/FACT++/src/smartfact.cc

    r19125 r19139  
    35383538        ("pixel-map-file",  var<string>()->required(),     "Pixel mapping file. Used here to get the default reference voltage")
    35393539        ("path",            var<string>("www/smartfact/data"), "Output path for the data-files")
    3540         ("source-database", var<string>(""), "Database link as in\n\tuser:password@server[:port]/database[/comp].")
     3540        ("source-database", var<string>(""), "Database link as in\n\tuser:password@server[:port]/database[?compress=0|1].")
    35413541        ("client",          po_bool(false), "For a standalone client choose this option.")
    35423542        ;
Note: See TracChangeset for help on using the changeset viewer.