Well thanks. I was able to get my code working.
I would suggest documenting those two things:
1. Use WStrings in the db layer when using it with Wt
2. Put the class after the traits. The documentation all has it class then
traits.
What do you suggest we use for strings? I really would like a WString that
works like QString because there is a significant discrepancy between the
std::string/WString and QString.
Also, is there any documentation on using QtCreator with Wt? I got something
kind-of working. But Creator has some issues. Like I cannot set a break point,
if I try to set one the application quits. When I set the breakpoint:
[2014-Mar-26 13:04:31.238637] 21718 - [info] "WServer/wthttp: shutdown (signal
= 2)"
[2014-Mar-26 13:04:31.238715] 21718 - [info] "WebController: shutdown: stopping
sessions."
[2014-Mar-26 13:04:31.239064] 21718 [/ nu3DFjM3nCKtC2qt] [info] "Wt: session
destroyed (#sessions = 0)"
[2014-Mar-26 13:04:31.239105] 21718 - [info] "WServer/wthttp: Shutdown:
stopping web server."
I also have a install.sh/stop.sh that I found somewhere that copies resources
to the build dir, and kills it apropriately.
Many thanks!
sample.pro for reference.
QT-=core
QT-=gui
TARGET=test1.wt
CONFIG+=console
CONFIG-=app_bundle
TEMPLATE=app
INCLUDEPATH+=/usr/include/Wt
LIBS+=\
-lboost_filesystem-lboost_program_options-lboost_system-lboost_signals\
-L/usr/local/wt/lib-lwt-lwthttp-lwtdbo-lwtdbosqlite3
________________________________
From: Koen Deforche <[email protected]>
To: Jason H <[email protected]>; "[email protected]"
<[email protected]>
Cc: Nagaev Boris <[email protected]>
Sent: Wednesday, March 26, 2014 11:51 AM
Subject: Re: [Wt-interest] Simple statement error
Hey Jason,
IMO, std::string for everything but interaction with Wt; and WString in your
presentation layer.
The approach we take is to settle on UTF-8 encoded std::string's inside an
application. In the rare cases that you really need to do character processing,
only then convert the UTF-8 string to a real unicode character point
representation (e.g. std::wstring on linux platforms or using char32_t in
C++11).
We deliberately did not add all kinds of processing to WString because we want
you to not use this type, except when dealing with the Wt API.
Regards,
koen
2014-03-26 16:35 GMT+01:00 Jason H <[email protected]>:
/usr/include/Wt/Dbo/SqlTraits_impl.h:16: note: no known conversion for
argument 1 from 'Wt::WString' to 'const char*'
>
>
>
>Yeah, I seem to be fighting everything with wstrings, strings, WStrings, etc.
>Also WString is not near as useful as QString. (No split, join, etc)
>
>
>I don't want to fight it and have to convert all the time. What should I be
>using?
>
>
>
>________________________________
> From: Nagaev Boris <[email protected]>
>To: Jason H <[email protected]>; witty-interest
><[email protected]>
>Sent: Wednesday, March 26, 2014 11:29 AM
>Subject: Re: [Wt-interest] Simple statement error
>
>
>Try to .bind(code)
>
>This method does not accept std::wstring
>
>
>
>
>On Wed, Mar 26, 2014 at 5:46 PM, Jason H <[email protected]> wrote:
>> Ok now that it knows my PostalCode type mapping, I am attempting to do:
>>
>> ---------------------
>>
>> WString code = postalCodeLE->text();
>>
>> if
(code.value().length() )
>>
>> {
>>
>>
>> dbo::ptr<PostalCode> pc =
>> ((MyApplication*)wApp)->session.find<PostalCode>().where("code =
>> ?").bind(code.value());
>>
>> if (!pc->city.empty())
>>
>> cityLE->setText(pc->city);
>>
>> if (!pc->state.empty())
>>
>> stateCmb->setValueText(stateCmb->nameFromCode(pc->state));
>>
>>
>> }
>>
>>
>> However after several "required froms" I get
>>
>> /usr/include/Wt/Dbo/Field_impl.h:54: error: no matching function for call to
>>
'Wt::Dbo::sql_value_traits<std::basic_string<wchar_t>,
>> void>::bind(std::basic_string<wchar_t>&, Wt::Dbo::SqlStatement*&, int&,
>> const int&)'
>> sql_value_traits<V>::bind(value_, statement, column, size_);
>> ^
>>
>> /usr/include/Wt/Dbo/SqlTraits_impl.h:16: static void
>> Wt::Dbo::sql_value_traits<V, Enable>::bind(const char*,
>> Wt::Dbo::SqlStatement*, int, int) [with V = std::basic_string<wchar_t>;
>> Enable = void]
>> void sql_value_traits<V, Enable>::bind(const char *v,
SqlStatement
>> *statement,
>> ^
>>
>> /usr/include/Wt/Dbo/SqlTraits_impl.h:16: note: no known conversion for
>> argument 1 from 'std::basic_string<wchar_t>' to 'const char*'
>>
>> ----------------------
>>
>>
>> Any help?
>>
>>
>>
>> ------------------------------------------------------------------------------
>> 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/13534_NeoTech
>> _______________________________________________
>> witty-interest mailing list
>> [email protected]
>> 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/13534_NeoTech
>_______________________________________________
>witty-interest mailing list
>[email protected]
>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/13534_NeoTech
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest