Is __WORDSIZE portable?

Wouldn't using sizeof() be more appropriate? You can then use a helper
"traits" template that has a size parameter.
In reality though you should be matching against the type the database is
using.

In practical use, by the way, we found SOCI too restrictive when we were
converting existing code to use it as SOCI generates runtime errors when
the type does not match exactly, and in reality it doesn't need to match
exactly as long as the types are compatible. Our code was using "long" to
receive integral values all over and we had to put in conversions (in our
own code) to make this work.

The other main thing I changed was allowing later binding of "intos" when
the statement had been executed thus you could get the result columns. SOCI
was rather restrictive in this too.

On Thu, Apr 12, 2012 at 8:58 AM, Michael Evdokimov
<[email protected]>wrote:

> Hello!
>
> Please consider applying this patch.
> Otherwise we don't have long int for 32-bit arch.
>
> diff --git a/src/core/exchange-traits.h b/src/core/exchange-traits.h
> index 90314d9..81ecec4 100644
> --- a/src/core/exchange-traits.h
> +++ b/src/core/exchange-traits.h
> @@ -90,6 +90,13 @@ struct exchange_traits<long int>
>      typedef basic_type_tag type_family;
>      enum { x_type = x_long_long };
>  };
> +#elif ( __WORDSIZE == 32 )
> +template <>
> +struct exchange_traits<long int>
> +{
> +    typedef basic_type_tag type_family;
> +    enum { x_type = x_integer };
> +};
>  #endif // #if defined (__LP64__) || ( __WORDSIZE == 64 )
>
>  template <>
>
> --
> Best regards, Michael Evdokimov
> Network Solutions, Moscow, Russia, Office: +7-495-7950677, Mobile:
> +7-963-6054013
> Web: www.lanbilling.ru, www.lanbilling.tv, www.helpdesk2.ru
>
>
> ------------------------------------------------------------------------------
> For Developers, A Lot Can Happen In A Second.
> Boundary is the first to Know...and Tell You.
> Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
> http://p.sf.net/sfu/Boundary-d2dvs2
> _______________________________________________
> Soci-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/soci-users
>
------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
Soci-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/soci-users

Reply via email to