Am 08.12.2010 09:48, schrieb Maciej Sobczak:
Hello,
On 08/12/2010 00:59, Jeff Garland wrote:
We have some queries that need to support tables with more than 10
columns. Has anyone hacked the boost-fusion.h file to support more than
10 column result sets? Note that after some looking boost-tuple simply
can't support more than 10.
This is a limitation of Boost, not SOCI. :-)
Is there some other way to solve this issue
in soci?
What about using regular SOCI interface?
Regards,
Hi,
attached is a patch that enables the fusion adaption to be configured to
support longer fusion sequences. It depends on Boost.Preprocessor and
introduces a macro SOCI_MAX_FUSION_SEQUENCE_LENGTH which defaults to 10.
This macro determines the maximum length of supported fusion sequences.
With this you can increase FUSION_MAX_VECTOR_SIZE and this to use more
columns.
As this patch depends on Boost.Preprocessor and may increase compile
times, I don't know if it will be incorporated into the repository.
Regards
Henning
PS: Hopefully the patch works for you, because I had to do some changes
locally to be able to compile the current repository. I have commited
those to my local copy.
>From 462df2b481a2192bed8e89f6f8573ddcb97ce98e Mon Sep 17 00:00:00 2001
From: Henning Basold <[email protected]>
Date: Wed, 8 Dec 2010 11:52:54 +0100
Subject: [PATCH] Maximum length of supported fusion sequnces may be specified by SOCI_MAX_FUSION_SEQUENCE_LENGTH
The implementation is now genererated using Boost.Preprocessor.
This may increase compile times.
---
src/core/boost-fusion.h | 311 +++++++----------------------------------------
1 files changed, 42 insertions(+), 269 deletions(-)
diff --git a/src/core/boost-fusion.h b/src/core/boost-fusion.h
index 63f9211..634b003 100644
--- a/src/core/boost-fusion.h
+++ b/src/core/boost-fusion.h
@@ -8,6 +8,10 @@
#ifndef SOCI_BOOST_FUSION_H_INCLUDED
#define SOCI_BOOST_FUSION_H_INCLUDED
+#ifndef SOCI_MAX_FUSION_SEQUENCE_LENGTH
+#define SOCI_MAX_FUSION_SEQUENCE_LENGTH 10
+#endif
+
#include "values.h"
#include "type-conversion-traits.h"
// boost
@@ -17,6 +21,9 @@
#include <boost/fusion/include/at.hpp>
#include <boost/fusion/support/is_sequence.hpp>
#include <boost/utility/enable_if.hpp>
+// boost preprocessor
+#include <boost/preprocessor/repetition/repeat.hpp>
+#include <boost/preprocessor/repetition/repeat_from_to.hpp>
namespace soci
{
@@ -25,275 +32,41 @@ namespace detail
template <typename Seq, int size>
struct type_conversion;
-template <typename Seq>
-struct type_conversion<Seq, 1>
-{
- typedef values base_type;
-
- static void from_base(base_type const & in, indicator /*ind*/, Seq & out)
- {
- in
- >> boost::fusion::at_c<0>(out);
- }
-
- static void to_base(Seq & in, base_type & out, indicator & /*ind*/)
- {
- out
- << boost::fusion::at_c<0>(in);
- }
-};
-
-template <typename Seq>
-struct type_conversion<Seq, 2>
-{
- typedef values base_type;
-
- static void from_base(base_type const & in, indicator /*ind*/, Seq & out)
- {
- in
- >> boost::fusion::at_c<0>(out)
- >> boost::fusion::at_c<1>(out);
- }
-
- static void to_base(Seq & in, base_type & out, indicator & /*ind*/)
- {
- out
- << boost::fusion::at_c<0>(in)
- << boost::fusion::at_c<1>(in);
- }
-};
-
-template <typename Seq>
-struct type_conversion<Seq, 3>
-{
- typedef values base_type;
-
- static void from_base(base_type const & in, indicator /*ind*/, Seq & out)
- {
- in
- >> boost::fusion::at_c<0>(out)
- >> boost::fusion::at_c<1>(out)
- >> boost::fusion::at_c<2>(out);
- }
-
- static void to_base(Seq & in, base_type & out, indicator & /*ind*/)
- {
- out
- << boost::fusion::at_c<0>(in)
- << boost::fusion::at_c<1>(in)
- << boost::fusion::at_c<2>(in);
- }
-};
-
-template <typename Seq>
-struct type_conversion<Seq, 4>
-{
- typedef values base_type;
-
- static void from_base(base_type const & in, indicator /*ind*/, Seq & out)
- {
- in
- >> boost::fusion::at_c<0>(out)
- >> boost::fusion::at_c<1>(out)
- >> boost::fusion::at_c<2>(out)
- >> boost::fusion::at_c<3>(out);
- }
-
- static void to_base(Seq & in, base_type & out, indicator & /*ind*/)
- {
- out
- << boost::fusion::at_c<0>(in)
- << boost::fusion::at_c<1>(in)
- << boost::fusion::at_c<2>(in)
- << boost::fusion::at_c<3>(in);
- }
-};
-
-template <typename Seq>
-struct type_conversion<Seq, 5>
-{
- typedef values base_type;
-
- static void from_base(base_type const & in, indicator /*ind*/, Seq & out)
- {
- in
- >> boost::fusion::at_c<0>(out)
- >> boost::fusion::at_c<1>(out)
- >> boost::fusion::at_c<2>(out)
- >> boost::fusion::at_c<3>(out)
- >> boost::fusion::at_c<4>(out);
- }
-
- static void to_base(Seq & in, base_type & out, indicator & /*ind*/)
- {
- out
- << boost::fusion::at_c<0>(in)
- << boost::fusion::at_c<1>(in)
- << boost::fusion::at_c<2>(in)
- << boost::fusion::at_c<3>(in)
- << boost::fusion::at_c<4>(in);
- }
-};
-
-template <typename Seq>
-struct type_conversion<Seq, 6>
-{
- typedef values base_type;
-
- static void from_base(base_type const & in, indicator /*ind*/, Seq & out)
- {
- in
- >> boost::fusion::at_c<0>(out)
- >> boost::fusion::at_c<1>(out)
- >> boost::fusion::at_c<2>(out)
- >> boost::fusion::at_c<3>(out)
- >> boost::fusion::at_c<4>(out)
- >> boost::fusion::at_c<5>(out);
- }
-
- static void to_base(Seq & in, base_type & out, indicator & /*ind*/)
- {
- out
- << boost::fusion::at_c<0>(in)
- << boost::fusion::at_c<1>(in)
- << boost::fusion::at_c<2>(in)
- << boost::fusion::at_c<3>(in)
- << boost::fusion::at_c<4>(in)
- << boost::fusion::at_c<5>(in);
- }
-};
-
-template <typename Seq>
-struct type_conversion<Seq, 7>
-{
- typedef values base_type;
-
- static void from_base(base_type const & in, indicator /*ind*/, Seq & out)
- {
- in
- >> boost::fusion::at_c<0>(out)
- >> boost::fusion::at_c<1>(out)
- >> boost::fusion::at_c<2>(out)
- >> boost::fusion::at_c<3>(out)
- >> boost::fusion::at_c<4>(out)
- >> boost::fusion::at_c<5>(out)
- >> boost::fusion::at_c<6>(out);
- }
-
- static void to_base(Seq & in, base_type & out, indicator & /*ind*/)
- {
- out
- << boost::fusion::at_c<0>(in)
- << boost::fusion::at_c<1>(in)
- << boost::fusion::at_c<2>(in)
- << boost::fusion::at_c<3>(in)
- << boost::fusion::at_c<4>(in)
- << boost::fusion::at_c<5>(in)
- << boost::fusion::at_c<6>(in);
- }
-};
-
-template <typename Seq>
-struct type_conversion<Seq, 8>
-{
- typedef values base_type;
-
- static void from_base(base_type const & in, indicator /*ind*/, Seq & out)
- {
- in
- >> boost::fusion::at_c<0>(out)
- >> boost::fusion::at_c<1>(out)
- >> boost::fusion::at_c<2>(out)
- >> boost::fusion::at_c<3>(out)
- >> boost::fusion::at_c<4>(out)
- >> boost::fusion::at_c<5>(out)
- >> boost::fusion::at_c<6>(out)
- >> boost::fusion::at_c<7>(out);
- }
-
- static void to_base(Seq & in, base_type & out, indicator & /*ind*/)
- {
- out
- << boost::fusion::at_c<0>(in)
- << boost::fusion::at_c<1>(in)
- << boost::fusion::at_c<2>(in)
- << boost::fusion::at_c<3>(in)
- << boost::fusion::at_c<4>(in)
- << boost::fusion::at_c<5>(in)
- << boost::fusion::at_c<6>(in)
- << boost::fusion::at_c<7>(in);
- }
-};
-
-template <typename Seq>
-struct type_conversion<Seq, 9>
-{
- typedef values base_type;
-
- static void from_base(base_type const & in, indicator /*ind*/, Seq & out)
- {
- in
- >> boost::fusion::at_c<0>(out)
- >> boost::fusion::at_c<1>(out)
- >> boost::fusion::at_c<2>(out)
- >> boost::fusion::at_c<3>(out)
- >> boost::fusion::at_c<4>(out)
- >> boost::fusion::at_c<5>(out)
- >> boost::fusion::at_c<6>(out)
- >> boost::fusion::at_c<7>(out)
- >> boost::fusion::at_c<8>(out);
- }
-
- static void to_base(Seq & in, base_type & out, indicator & /*ind*/)
- {
- out
- << boost::fusion::at_c<0>(in)
- << boost::fusion::at_c<1>(in)
- << boost::fusion::at_c<2>(in)
- << boost::fusion::at_c<3>(in)
- << boost::fusion::at_c<4>(in)
- << boost::fusion::at_c<5>(in)
- << boost::fusion::at_c<6>(in)
- << boost::fusion::at_c<7>(in)
- << boost::fusion::at_c<8>(in);
- }
-};
-
-template <typename Seq>
-struct type_conversion<Seq, 10>
-{
- typedef values base_type;
-
- static void from_base(base_type const & in, indicator /*ind*/, Seq & out)
- {
- in
- >> boost::fusion::at_c<0>(out)
- >> boost::fusion::at_c<1>(out)
- >> boost::fusion::at_c<2>(out)
- >> boost::fusion::at_c<3>(out)
- >> boost::fusion::at_c<4>(out)
- >> boost::fusion::at_c<5>(out)
- >> boost::fusion::at_c<6>(out)
- >> boost::fusion::at_c<7>(out)
- >> boost::fusion::at_c<8>(out)
- >> boost::fusion::at_c<9>(out);
- }
-
- static void to_base(Seq & in, base_type & out, indicator & /*ind*/)
- {
- out
- << boost::fusion::at_c<0>(in)
- << boost::fusion::at_c<1>(in)
- << boost::fusion::at_c<2>(in)
- << boost::fusion::at_c<3>(in)
- << boost::fusion::at_c<4>(in)
- << boost::fusion::at_c<5>(in)
- << boost::fusion::at_c<6>(in)
- << boost::fusion::at_c<7>(in)
- << boost::fusion::at_c<8>(in)
- << boost::fusion::at_c<9>(in);
- }
-};
+#define SOCI_READ_FROM_BASE(z, k, data) \
+ >> boost::fusion::at_c<k>(out)
+/**/
+
+#define SOCI_READ_TO_BASE(z, k, data) \
+ << boost::fusion::at_c<k>(in)
+/**/
+
+#define SOCI_TYPE_CONVERSION_FUSION(z, k, data) \
+ template <typename Seq> \
+ struct type_conversion<Seq, k> \
+ { \
+ typedef values base_type; \
+ \
+ static void from_base(base_type const & in, indicator /*ind*/, Seq & out) \
+ { \
+ in \
+ BOOST_PP_REPEAT(k, SOCI_READ_FROM_BASE, BOOST_PP_EMPTY) \
+ ; \
+ } \
+ \
+ static void to_base(Seq & in, base_type & out, indicator & /*ind*/) \
+ { \
+ out \
+ BOOST_PP_REPEAT(k, SOCI_READ_TO_BASE, BOOST_PP_EMPTY) \
+ ; \
+ } \
+ };
+/**/
+
+BOOST_PP_REPEAT_FROM_TO(1, BOOST_PP_ADD(SOCI_MAX_FUSION_SEQUENCE_LENGTH, 1), SOCI_TYPE_CONVERSION_FUSION, BOOST_PP_EMPTY)
+
+#undef SOCI_TYPE_CONVERSION_FUSION
+#undef SOCI_READ_FROM_BASE
+#undef SOCI_READ_TO_BASE
} // namespace detail
--
1.7.1
------------------------------------------------------------------------------
What happens now with your Lotus Notes apps - do you make another costly
upgrade, or settle for being marooned without product support? Time to move
off Lotus Notes and onto the cloud with Force.com, apps are easier to build,
use, and manage than apps on traditional platforms. Sign up for the Lotus
Notes Migration Kit to learn more. http://p.sf.net/sfu/salesforce-d2d
_______________________________________________
Soci-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/soci-users