SQLJoin.hpp 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /*##############################################################################
  2. HPCC SYSTEMS software Copyright (C) 2014 HPCC Systems.
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. ############################################################################## */
  13. #ifndef SQLJOIN_HPP_
  14. #define SQLJOIN_HPP_
  15. #include "ws_sql.hpp"
  16. #include "SQLExpression.hpp"
  17. typedef enum _SQLJoinType
  18. {
  19. SQLJoinTypeUnknown=-1,
  20. SQLJoinTypeInner,
  21. SQLJoinTypeOuter,
  22. SQLJoinTypeImplicit
  23. } SQLJoinType;
  24. class SQLJoin : public CInterface, public IInterface
  25. {
  26. public:
  27. IMPLEMENT_IINTERFACE;
  28. static SQLJoin * creatSQLJoin()
  29. {
  30. return new SQLJoin();
  31. }
  32. static SQLJoin * creatSQLJoin(SQLJoinType jointype)
  33. {
  34. return new SQLJoin(jointype);
  35. }
  36. SQLJoin();
  37. SQLJoin(SQLJoinType jointype);
  38. virtual ~SQLJoin();
  39. ISQLExpression* getOnClause() const
  40. {
  41. if (!hasOnclause)
  42. return NULL;
  43. else
  44. return onClause.get();
  45. }
  46. void setOnClause(ISQLExpression* onClause)
  47. {
  48. hasOnclause = true;
  49. this->onClause.setown(onClause);
  50. }
  51. SQLJoinType getType() const
  52. {
  53. return type;
  54. }
  55. void setType(SQLJoinType type)
  56. {
  57. this->type = type;
  58. }
  59. void toString(StringBuffer & str);
  60. void getSQLTypeStr(StringBuffer & outstr);
  61. void getECLTypeStr(StringBuffer & outstr);
  62. bool doesHaveOnclause() const
  63. {
  64. return hasOnclause;
  65. }
  66. private:
  67. bool hasOnclause;
  68. SQLJoinType type;
  69. Owned<ISQLExpression> onClause;
  70. static SQLJoinType defaultType;
  71. };
  72. #endif /* SQLJOIN_HPP_ */