Hi,

I did look for it in the documentation but no luck I think it's related to the method:
dbo::id(a, id, "id"); but I couldn't know how to re-define the ID as auto-increment. Maybe it's in constraint? Can anyone comment about this? Or if there is any way to get the ID value without re-define it it could work.



On 08/04/2014 01:15 م, Tor Arne Fallingen wrote:
Hey again,

I found the reason for my troubles; I wanted access to the automatically created id field in the database, so I defined it in my class as to be able to access it. It was fine as long as the tables was created already, but if I needed to create a new table, then I guess my defining the id field conflicted with the backends creating of the id field. So… I still need to have an auto incremented number that I can access, so Ill have to figure out either how to access the id field without having defined it, or make my own auto increment field. And any hints would be greatly appreciated.

regards,
Tor

Videresendt melding:

Fra: Tor Arne Fallingen <fallin...@gmail.com>
Emne: Trouble creating tables in database.
Dato: 8. april 2014 11:43:39 CEST

Hey,

I have been working on this database handler a while, and then for some reason I ended up having to restore my whole /usr directory from a previous date, because I was having problems with Wt/Boost. Now I run the same code that previously created tables, I even get a message that its rolling back and to the existing tables, but they do not exist. Im getting really frustrated here. Anyone have any idea whats up with this?

Here is the code from my dbhandler: 

dbo::SqlConnectionPool *dbHandler::createConnectionPool(const std::string db, const std::string dbuser, const std::string dbpasswd,<
span style=" color:#c0c0c0;"> const std::string dbhost, unsigned int dbport)
{
    dbo::backend::MySQL *connection = new dbo::backend::MySQL(db, dbuser, dbpasswd, dbhost, dbport);    //"sre_db", "root", "Hioa_2014", "127.0.0.1", 3306

                  
    connection->setProperty("show-queries", "true");

                  
    return new dbo::FixedSqlConnectionPool(connection, 10);

                  
}

dbHandler::dbHandler(dbo::SqlConnectionPool& connectionPool)
    : connectionPool_(connectionPool)
{
    setConnectionPool(connectionPool);
    std::cout << " lag tabeller " << std::endl;

                  
    mapClass<gsa_table>("gsa_table");
    mapClass<gga_table>("gga_table");
    mapClass<average_gga_table>("average_gga_table");
    mapClass<average_gsa_table>("average_gsa_table");
    mapClass<jobDataT>("jobdataT");
    mapClass<pointDataT>("pointdataT");

                  

                  

                  
    try {
        createTables();

                  
        Wt::log("info") << "Database created";
    } catch (Wt::Dbo::Exception &) {

                  
        Wt::log("info") << "Using existing database";
    }
}

And in main I run:

 Wt::Dbo::SqlConnectionPool *connPool
            = dbHandler::createConnectionPool("sre_db", "root", «Password", "127.0.0.1", 3306);

                  
dbHandler * db = new dbHandler(*connPool);
And this is the pleasant message I get when I run this:
rollback
Using existing database
/Users/taf/Dropbox/qt/DbHandler/build/DbHandler exited with code 0
My current main is just a lot of testing out different methods, but just about everything is commented out at this point.
Best regards,
Tor




------------------------------------------------------------------------------
Put Bad Developers to Shame
Dominate Development with Jenkins Continuous Integration
Continuously Automate Build, Test & Deployment 
Start a new project now. Try Jenkins in the cloud.
http://p.sf.net/sfu/13600_Cloudbees


_______________________________________________
witty-interest mailing list
witty-interest@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/witty-interest



------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
witty-interest mailing list
witty-interest@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to