Hey,

Indeed, we do not map std::wstring, because also most backends do not
support this (and with 16-bit on Win32 platforms, they're a crippled type).

Instead, for unicode text, we recommend using WString directly as a
database-type which uses UTF-8 to talk to the back-end. You will need to
include <Wt/Dbo/WtSqlTraits>

Or alternatively, use code.toUTF8() and keep the std::string type (with the
implicit assumption that it contains UTF-8 encoded text).

Regards,
koen


2014-03-26 16:29 GMT+01:00 Nagaev Boris <[email protected]>:

> 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

Reply via email to