Ignore:
Timestamp:
06/02/12 21:24:58 (12 years ago)
Author:
tbretz
Message:
Simplified database access.
File:
1 edited

Legend:

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

    r14043 r14045  
    77
    88#ifdef HAVE_SQL
    9 #include <mysql++/mysql++.h>
     9#include "Database.h"
    1010#endif
    1111
     
    17391739        try
    17401740        {
    1741             static const boost::regex expr("(([[:word:].-]+)(:(.+))?@)?([[:word:].-]+)(:([[:digit:]]+))?(/([[:word:].-]+))");
    1742 
    1743             boost::smatch what;
    1744             if (!boost::regex_match(fDatabase, what, expr, boost::match_extra))
    1745                 throw runtime_error("Couldn't parse '"+fDatabase+"'.");
    1746 
    1747             if (what.size()!=10)
    1748                 throw runtime_error("Error parsing '"+fDatabase+"'.");
    1749 
    1750             const string user   = what[2];
    1751             const string passwd = what[4];
    1752             const string server = what[5];
    1753             const string db     = what[9];
    1754             const int port      = atoi(string(what[7]).c_str());
    1755 
    1756             mysqlpp::Connection conn(db.c_str(), server.c_str(), user.c_str(), passwd.c_str(), port);
    1757 
    17581741            const mysqlpp::StoreQueryResult res =
    1759                 conn.query("SELECT fSourceName, fRightAscension, fDeclination FROM source").store();
     1742                Database(fDatabase).query("SELECT fSourceName, fRightAscension, fDeclination FROM source").store();
    17601743
    17611744            out  << HTML::kWhite << '\t';
Note: See TracChangeset for help on using the changeset viewer.