resultset.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. /*
  2. * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License, version 2.0, as
  6. * published by the Free Software Foundation.
  7. *
  8. * This program is also distributed with certain software (including
  9. * but not limited to OpenSSL) that is licensed under separate terms,
  10. * as designated in a particular file or component or in included license
  11. * documentation. The authors of MySQL hereby grant you an
  12. * additional permission to link the program and your derivative works
  13. * with the separately licensed software that they have included with
  14. * MySQL.
  15. *
  16. * Without limiting anything contained in the foregoing, this file,
  17. * which is part of MySQL Connector/C++, is also subject to the
  18. * Universal FOSS Exception, version 1.0, a copy of which can be found at
  19. * http://oss.oracle.com/licenses/universal-foss-exception.
  20. *
  21. * This program is distributed in the hope that it will be useful, but
  22. * WITHOUT ANY WARRANTY; without even the implied warranty of
  23. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  24. * See the GNU General Public License, version 2.0, for more details.
  25. *
  26. * You should have received a copy of the GNU General Public License
  27. * along with this program; if not, write to the Free Software Foundation, Inc.,
  28. * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  29. */
  30. #ifndef _SQL_RESULTSET_H_
  31. #define _SQL_RESULTSET_H_
  32. #include "config.h"
  33. #include <list>
  34. #include <map>
  35. #include <iostream>
  36. #include "sqlstring.h"
  37. #include "resultset_metadata.h"
  38. namespace sql
  39. {
  40. class Statement;
  41. class RowID
  42. {
  43. public:
  44. virtual ~RowID() {}
  45. };
  46. class ResultSet
  47. {
  48. public:
  49. enum
  50. {
  51. CLOSE_CURSORS_AT_COMMIT,
  52. HOLD_CURSORS_OVER_COMMIT
  53. };
  54. enum
  55. {
  56. CONCUR_READ_ONLY,
  57. CONCUR_UPDATABLE
  58. };
  59. enum
  60. {
  61. FETCH_FORWARD,
  62. FETCH_REVERSE,
  63. FETCH_UNKNOWN
  64. };
  65. typedef enum
  66. {
  67. TYPE_FORWARD_ONLY,
  68. TYPE_SCROLL_INSENSITIVE,
  69. TYPE_SCROLL_SENSITIVE
  70. } enum_type;
  71. virtual ~ResultSet() {}
  72. virtual bool absolute(int row) = 0;
  73. virtual void afterLast() = 0;
  74. virtual void beforeFirst() = 0;
  75. virtual void cancelRowUpdates() = 0;
  76. virtual void clearWarnings() = 0;
  77. virtual void close() = 0;
  78. virtual uint32_t findColumn(const sql::SQLString& columnLabel) const = 0;
  79. virtual bool first() = 0;
  80. virtual std::istream * getBlob(uint32_t columnIndex) const = 0;
  81. virtual std::istream * getBlob(const sql::SQLString& columnLabel) const = 0;
  82. virtual bool getBoolean(uint32_t columnIndex) const = 0;
  83. virtual bool getBoolean(const sql::SQLString& columnLabel) const = 0;
  84. virtual int getConcurrency() = 0;
  85. virtual SQLString getCursorName() = 0;
  86. virtual long double getDouble(uint32_t columnIndex) const = 0;
  87. virtual long double getDouble(const sql::SQLString& columnLabel) const = 0;
  88. virtual int getFetchDirection() = 0;
  89. virtual size_t getFetchSize() = 0;
  90. virtual int getHoldability() = 0;
  91. virtual int32_t getInt(uint32_t columnIndex) const = 0;
  92. virtual int32_t getInt(const sql::SQLString& columnLabel) const = 0;
  93. virtual uint32_t getUInt(uint32_t columnIndex) const = 0;
  94. virtual uint32_t getUInt(const sql::SQLString& columnLabel) const = 0;
  95. virtual int64_t getInt64(uint32_t columnIndex) const = 0;
  96. virtual int64_t getInt64(const sql::SQLString& columnLabel) const = 0;
  97. virtual uint64_t getUInt64(uint32_t columnIndex) const = 0;
  98. virtual uint64_t getUInt64(const sql::SQLString& columnLabel) const = 0;
  99. virtual ResultSetMetaData * getMetaData() const = 0;
  100. virtual size_t getRow() const = 0;
  101. virtual RowID * getRowId(uint32_t columnIndex) = 0;
  102. virtual RowID * getRowId(const sql::SQLString & columnLabel) = 0;
  103. virtual const Statement * getStatement() const = 0;
  104. virtual SQLString getString(uint32_t columnIndex) const = 0;
  105. virtual SQLString getString(const sql::SQLString& columnLabel) const = 0;
  106. virtual enum_type getType() const = 0;
  107. virtual void getWarnings() = 0;
  108. virtual void insertRow() = 0;
  109. virtual bool isAfterLast() const = 0;
  110. virtual bool isBeforeFirst() const = 0;
  111. virtual bool isClosed() const = 0;
  112. virtual bool isFirst() const = 0;
  113. virtual bool isLast() const = 0;
  114. virtual bool isNull(uint32_t columnIndex) const = 0;
  115. virtual bool isNull(const sql::SQLString& columnLabel) const = 0;
  116. virtual bool last() = 0;
  117. virtual bool next() = 0;
  118. virtual void moveToCurrentRow() = 0;
  119. virtual void moveToInsertRow() = 0;
  120. virtual bool previous() = 0;
  121. virtual void refreshRow() = 0;
  122. virtual bool relative(int rows) = 0;
  123. virtual bool rowDeleted() = 0;
  124. virtual bool rowInserted() = 0;
  125. virtual bool rowUpdated() = 0;
  126. virtual void setFetchSize(size_t rows) = 0;
  127. virtual size_t rowsCount() const = 0;
  128. virtual bool wasNull() const = 0;
  129. };
  130. } /* namespace sql */
  131. #endif /* _SQL_RESULTSET_H_ */