Hi

I am trying to populate a combobox with a list of countries from a Country 
table 
in an sqlite3 db. 

Running the query select * from country in sqlite3 lists all the countries in 
the table without any issue.

The table has been mapped as a single class as shown in the tutorial:


#include <Wt/Dbo/Types>
#include <Wt/Dbo/WtSqlTraits>

namespace dbo = Wt::Dbo;

class Country: public dbo::Dbo
{
public:
        std::string code;
        std::string country;

        template<class Action>
        void persist (Action& a)
        {
                dbo::field(a,   code,   "code");
                dbo::field(a,   country, "country");
                
        }
};

DBO_EXTERN_TEMPLATES(Country);

Next, I would like to populate the combobox with all the country names in the 
table, and so the code snippet written for this is:

WComboBox *ctry = new WComboBox;

dbo::ptr<Country> c;
typedef dbo::collection< dbo::ptr<Country>> Countries;
Countries countries = session_.find<Country>("id < ?").bind(100);

for (Countries::const_iterator i = countries.begin(); i != countries.end(); i++ 
){                      
        c = *i;
        ctry->addItem(c->country);
}

The code compiles and build fine. However, at run time, the program stalls at:

Countries countries = session_.find<Country>("id < ?").bind(100);

and WebSession throws an error, and creates a new session... 

I do not know why the session is crashing out with this query and would 
appreciate any insight on how to resolve this.

Thanks in advance!

Calvin


------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to