Project

General

Profile

Actions

Bug #2775

open

Problem with Session execute using Postgres

Added by Ariel Kruger almost 11 years ago. Updated almost 11 years ago.

Status:
Feedback
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
03/07/2014
Due date:
% Done:

0%

Estimated time:

Description

#include <iostream>
#include <Wt/WString>
#include <Wt/Dbo/Session>
#include <Wt/Dbo/FixedSqlConnectionPool>
#include <Wt/Dbo/backend/Postgres>
#include <Wt/Dbo/Transaction>
#include <Wt/WWidget>
#include <Wt/Dbo/ptr>
#include <Wt/Dbo/Call>


namespace dbo = Wt::Dbo;

class Test{
public:
    dbo::FixedSqlConnectionPool pool;

    Test(): 
        pool(new dbo::backend::Postgres(
                        Wt::WString("host=127.0.0.1 port=5432 user=postgres password=arielariel").narrow()), 20)
    {
        session_.setConnectionPool(pool);
    }

    dbo::Session& session(){
        return session_;
    }

    void insertLines(){
        dbo::Transaction transaction(session());
        for(int i=0; i<10; i++)
           session().execute("INSERT INTO geral.test(name) VALUES (?)").bind(i);

        transaction.commit();
    }
private:
    mutable dbo::Session session_;
};

int main(int argc, char **argv)
{
    Test *a = new Test();

    a->insertLines();
}

I am trying to compile this code, but I am having problems...can someone check what is happening?

this is the output error: undefined reference to `Wt::Dbo::Call& Wt::Dbo::Call::bind(int const&)

and this is how I am compiling

g -o output Test.C -I/usr/local/include -L/usr/local/lib -lwthttp -lwt -lwtdbopostgres -lwtdbo -lboost_regex -lboost_signals -lboost_system -lboost_thread -lboost_filesystem -lboost_date_time

I also tried to compile with

g -o output Test.C -I/usr/local/include -L/usr/local/lib -lwthttp -lwt -lwtdbo -lwtdbopostgres -lboost_regex -lboost_signals -lboost_system -lboost_thread -lboost_filesystem -lboost_date_time

Thanks

Actions #1

Updated by Koen Deforche almost 11 years ago

  • Status changed from New to Feedback

Hey,

You should include since you are probably missing some implementation headers.

Regards,

koen

Actions

Also available in: Atom PDF