Solution for Custom Query
I have the problem of making a WTable from a custom query where I don't know the return type.
Are there any possibilities with the DBO?
SELECT * FROM customers
I expect to design having a WTable having a coloumn each sql fields
RE: Solution for Custom Query - Added by Korneel Dumon 2 months ago
this is not possible right now in Wt::Dbo. You can have a look at Session::query() documentation to see how to specify different query return types:
For the query you show, it seems easiest to me to map the 'customers' table to a c++-class. But of course you have to know the columns to do that.
This might be possible if we add support in SqlStatement and Query classes. If it interests you, please make a feature request.
RE: Solution for Custom Query - Added by Korneel Dumon about 1 month ago
This is a bit low-level, but perhaps it works:
- use SqlConnection::prepareStatement to create directly an SqlStatement object
- use SqlStatement::getResult(int column, std::string* value) for each column in the result
I didn't test this, so no guarantees :)