示例#1
0
    UrlTagFixtureClass()
        : SqliteTestFixtureClass(t4p::ResourceSqlSchemaAsset())
        , Finder(DetectorTagSession)
        , SourceDirs()
        , SourceId(0) {
        DetectorTagSession.open(*soci::factory_sqlite3(), ":memory:");
        CreateDatabase(DetectorTagSession, t4p::DetectorSqlSchemaAsset());

        wxFileName tmpDir;
        tmpDir.AssignDir(wxStandardPaths::Get().GetTempDir());
        SourceDirs.push_back(tmpDir);
        std::string stdDir = t4p::WxToChar(tmpDir.GetPathWithSep());

        // create the source
        soci::statement stmt = (DetectorTagSession.prepare << "INSERT INTO sources(directory) VALUES(?)",
                                soci::use(stdDir));
        stmt.execute(true);
        soci::sqlite3_statement_backend* backend = static_cast<soci::sqlite3_statement_backend*>(stmt.get_backend());
        SourceId = sqlite3_last_insert_rowid(backend->session_.conn_);

        AddToDb1("http://localhost/index.php",
                 "/home/user/welcome.php", "WelcomeController", "index");
        AddToDb1("http://localhost/frontend.php",
                 "/home/user/frontend.php", "FrontendController", "action");
    }
示例#2
0
void open (soci::session& s,
           std::string const& beName,
           std::string const& connectionString)
{
    if (beName == "sqlite")
        s.open(soci::sqlite3, connectionString);
    else
        throw std::runtime_error ("Unsupported soci backend: " + beName);
}
示例#3
0
void SociConfig::open (soci::session& s) const
{
    s.open (backendFactory_, connectionString ());
}