Skip to content

Commit b5793e5

Browse files
silvakidrsomla1
authored andcommitted
Fix for Bug #25547438: PASSING TABLE.SELECT() TO CREATE VIEW WITH ANY OPTION CAUSES COMPILATION ERROR
Change Executable<Res> to Executable<Res,Op> where Op is the top level operation
1 parent fdf9ab0 commit b5793e5

File tree

6 files changed

+176
-111
lines changed

6 files changed

+176
-111
lines changed

include/devapi/collection_crud.h

Lines changed: 35 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ namespace internal {
352352
DLL_WARNINGS_PUSH
353353

354354
class PUBLIC_API CollectionAdd
355-
: public virtual Executable<Result>
355+
: public virtual Executable<Result, CollectionAdd>
356356
, public internal::CollectionAddInterface<CollectionAdd&>
357357
{
358358

@@ -435,16 +435,16 @@ namespace internal {
435435
interface.
436436
*/
437437

438-
template <class Res, bool limit_with_offset>
438+
template <class Res, class Op, bool limit_with_offset>
439439
class CollectionSort
440-
: public Limit<Res, limit_with_offset>
440+
: public Limit<Res, Op, limit_with_offset>
441441
{
442442
protected:
443443

444444
typedef internal::Sort_impl Impl;
445445

446-
using Limit<Res, limit_with_offset>::check_if_valid;
447-
using Limit<Res, limit_with_offset>::m_impl;
446+
using Limit<Res, Op, limit_with_offset>::check_if_valid;
447+
using Limit<Res, Op, limit_with_offset>::m_impl;
448448

449449
Impl* get_impl()
450450
{
@@ -454,13 +454,13 @@ namespace internal {
454454

455455
public:
456456

457-
Limit<Res, limit_with_offset>& sort(const string& ord_spec)
457+
Limit<Res, Op, limit_with_offset>& sort(const string& ord_spec)
458458
{
459459
get_impl()->add_sort(ord_spec);
460460
return *this;
461461
}
462462

463-
Limit<Res, limit_with_offset>& sort(const char* ord_spec)
463+
Limit<Res, Op, limit_with_offset>& sort(const char* ord_spec)
464464
{
465465
get_impl()->add_sort(ord_spec);
466466
return *this;
@@ -474,7 +474,7 @@ namespace internal {
474474
*/
475475

476476
template <typename Ord>
477-
Limit<Res, limit_with_offset>& sort(Ord ord)
477+
Limit<Res, Op, limit_with_offset>& sort(Ord ord)
478478
{
479479
for (auto el : ord)
480480
{
@@ -491,7 +491,7 @@ namespace internal {
491491
*/
492492

493493
template <typename Ord, typename...Type>
494-
Limit<Res, limit_with_offset>& sort(Ord ord, const Type...rest)
494+
Limit<Res, Op, limit_with_offset>& sort(Ord ord, const Type...rest)
495495
{
496496
get_impl()->add_sort(ord);
497497
return sort(rest...);
@@ -509,12 +509,18 @@ namespace internal {
509509
Class defining .having() clause.
510510
*/
511511

512+
template <class Op>
512513
class CollectionHaving
513-
: public internal::CollectionSort<DocResult, true>
514+
: public internal::CollectionSort<DocResult, Op, true>
514515
{
515516

516517
typedef internal::Having_impl Impl;
517-
typedef internal::CollectionSort<DocResult, true> CollectionSort;
518+
typedef internal::CollectionSort<DocResult, Op, true> CollectionSort;
519+
520+
protected:
521+
522+
using internal::CollectionSort<DocResult, Op, true>::check_if_valid;
523+
using internal::CollectionSort<DocResult, Op, true>::m_impl;
518524

519525
Impl* get_impl()
520526
{
@@ -546,12 +552,18 @@ namespace internal {
546552
Class defining .groupBy() clause.
547553
*/
548554

555+
template <class Op>
549556
class CollectionGroupBy
550-
: public internal::CollectionHaving
557+
: public internal::CollectionHaving<Op>
551558
{
552559

553560
typedef internal::Group_by_impl Impl;
554-
typedef internal::CollectionHaving CollectionHaving;
561+
typedef internal::CollectionHaving<Op> CollectionHaving;
562+
563+
protected:
564+
565+
using internal::CollectionHaving<Op>::check_if_valid;
566+
using internal::CollectionHaving<Op>::m_impl;
555567

556568
Impl* get_impl()
557569
{
@@ -622,7 +634,7 @@ namespace internal {
622634
*/
623635

624636
class PUBLIC_API CollectionRemove
625-
: public internal::CollectionSort<Result,false>
637+
: public internal::CollectionSort<Result, CollectionRemove,false>
626638
{
627639
public:
628640

@@ -721,15 +733,18 @@ namespace internal {
721733
DLL_WARNINGS_PUSH
722734

723735
class PUBLIC_API CollectionFind
724-
: public internal::CollectionGroupBy
736+
: public internal::CollectionGroupBy<CollectionFind>
725737
{
726738

727739
DLL_WARNINGS_POP
728740

729741
protected:
730742

731743
typedef internal::Proj_impl Impl;
732-
typedef internal::CollectionGroupBy CollectionGroupBy;
744+
typedef internal::CollectionGroupBy<CollectionFind> CollectionGroupBy;
745+
746+
using internal::CollectionGroupBy<CollectionFind>::get_impl;
747+
using internal::CollectionGroupBy<CollectionFind>::m_impl;
733748

734749
Impl* get_impl()
735750
{
@@ -758,7 +773,7 @@ DIAGNOSTIC_PUSH
758773
DISABLE_WARNING(4100)
759774
#endif
760775

761-
CollectionFind(CollectionFind &other) : Executable<DocResult>(other) {}
776+
CollectionFind(CollectionFind &other) : Executable<DocResult,CollectionFind>(other) {}
762777
CollectionFind(CollectionFind &&other) : CollectionFind(other) {}
763778

764779
DIAGNOSTIC_POP
@@ -908,6 +923,7 @@ namespace internal {
908923
by the user.
909924
*/
910925

926+
911927
struct CollectionModify_impl : public Sort_impl
912928
{
913929
enum Operation
@@ -937,7 +953,7 @@ namespace internal {
937953
*/
938954

939955
class PUBLIC_API CollectionModify
940-
: public internal::CollectionSort<Result,false>
956+
: public internal::CollectionSort<Result, CollectionModify,false>
941957
{
942958
private:
943959

@@ -971,7 +987,7 @@ DIAGNOSTIC_PUSH
971987
DISABLE_WARNING(4100)
972988
#endif
973989

974-
CollectionModify(CollectionModify &other) : Executable<Result>(other) {}
990+
CollectionModify(CollectionModify &other) : Executable<Result,CollectionModify>(other) {}
975991
CollectionModify(CollectionModify &&other) : CollectionModify(other) {}
976992

977993
DIAGNOSTIC_POP

include/devapi/crud.h

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,9 @@ struct Limit_impl : public Statement_impl
131131
Base class defining operation's offset() clause.
132132
*/
133133

134-
template <class Res>
134+
template <class Res, class Op>
135135
class Offset
136-
: public Statement<Res>
136+
: public Statement<Res, Op>
137137
{
138138
protected:
139139

@@ -143,8 +143,8 @@ class Offset
143143

144144
Offset() = default;
145145

146-
using Statement<Res>::check_if_valid;
147-
using Statement<Res>::m_impl;
146+
using Statement<Res,Op>::check_if_valid;
147+
using Statement<Res,Op>::m_impl;
148148

149149
Impl* get_impl()
150150
{
@@ -159,7 +159,7 @@ class Offset
159159
to perform the operation.
160160
*/
161161

162-
Statement<Res>& offset(unsigned rows)
162+
Statement<Res,Op>& offset(unsigned rows)
163163
{
164164
get_impl()->set_offset(rows);
165165
return *this;
@@ -175,18 +175,18 @@ class Offset
175175
method) is defined by LimitRet<R,F>::type.
176176
*/
177177

178-
template <class Res, bool with_offset> struct LimitRet;
178+
template <class Res, class Op, bool with_offset> struct LimitRet;
179179

180-
template <class Res>
181-
struct LimitRet<Res,true>
180+
template <class Res, class Op>
181+
struct LimitRet<Res, Op, true>
182182
{
183-
typedef Offset<Res> type;
183+
typedef Offset<Res,Op> type;
184184
};
185185

186-
template <class Res>
187-
struct LimitRet<Res,false>
186+
template <class Res, class Op>
187+
struct LimitRet<Res, Op, false>
188188
{
189-
typedef Statement<Res> type;
189+
typedef Statement<Res,Op> type;
190190
};
191191

192192

@@ -196,18 +196,18 @@ struct LimitRet<Res,false>
196196

197197
// TODO: Doxygen does not see the base class
198198

199-
template <class Res, bool with_offset>
199+
template <class Res, class Op, bool with_offset>
200200
class Limit
201-
: public LimitRet<Res, with_offset>::type
201+
: public LimitRet<Res, Op, with_offset>::type
202202
{
203203
protected:
204204

205205
typedef Limit_impl Impl;
206206

207207
Limit() = default;
208208

209-
using LimitRet<Res, with_offset>::type::check_if_valid;
210-
using LimitRet<Res, with_offset>::type::m_impl;
209+
using LimitRet<Res, Op, with_offset>::type::check_if_valid;
210+
using LimitRet<Res, Op, with_offset>::type::m_impl;
211211

212212
Impl* get_impl()
213213
{
@@ -221,7 +221,7 @@ class Limit
221221
%Limit the operation to the given number of items (rows or documents).
222222
*/
223223

224-
typename LimitRet<Res, with_offset>::type& limit(unsigned items)
224+
typename LimitRet<Res, Op, with_offset>::type& limit(unsigned items)
225225
{
226226
get_impl()->set_limit(items);
227227
return *this;

include/devapi/result.h

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class SqlResult;
5959
class DbDoc;
6060
class DocResult;
6161

62-
template <class Res> class Executable;
62+
template <class Res, class Op> class Executable;
6363

6464

6565
/*
@@ -472,7 +472,8 @@ class PUBLIC_API Result : public internal::BaseResult
472472
init(std::move(other));
473473
}
474474

475-
friend Executable<Result>;
475+
template <class Res, class Op>
476+
friend class Executable;
476477
};
477478

478479

@@ -988,7 +989,8 @@ class PUBLIC_API RowResult
988989
return m_cur_row;
989990
}
990991

991-
friend Executable<RowResult>;
992+
template <class Res, class Op>
993+
friend class Executable;
992994
friend SqlResult;
993995
friend DocResult;
994996
friend iterator;
@@ -1050,7 +1052,8 @@ class PUBLIC_API SqlResult : public RowResult
10501052
: RowResult(std::move(init_))
10511053
{}
10521054

1053-
friend Executable<SqlResult>;
1055+
template <class Res, class Op>
1056+
friend class Executable;
10541057
};
10551058

10561059

@@ -1158,7 +1161,8 @@ class PUBLIC_API DocResult
11581161

11591162
friend Impl;
11601163
friend DbDoc;
1161-
friend Executable<DocResult>;
1164+
template <class Res,class Op>
1165+
friend class Executable;
11621166
friend iterator;
11631167
};
11641168

0 commit comments

Comments
 (0)