diff --git a/rdbms/OcciStmt.cpp b/rdbms/OcciStmt.cpp index b43403ae38bd227b337861aba59030c18688dae7..9e3aefc4936208b9a8fb25124170e78ee50b2c27 100644 --- a/rdbms/OcciStmt.cpp +++ b/rdbms/OcciStmt.cpp @@ -166,6 +166,36 @@ void OcciStmt::bindOptionalString(const std::string ¶mName, const optional<s } } +//------------------------------------------------------------------------------ +// setNbParamSets +//------------------------------------------------------------------------------ +void OcciStmt::setNbParamSets(const uint32_t nbParamSets) { + try { + m_stmt->setMaxIterations(nbParamSets); + } catch(exception::Exception &ex) { + throw exception::Exception(std::string(__FUNCTION__) + " failed for SQL statement " + + getSqlForException() + ": " + ex.getMessage().str()); + } catch(std::exception &se) { + throw exception::Exception(std::string(__FUNCTION__) + " failed for SQL statement " + + getSqlForException() + ": " + se.what()); + } +} + +//------------------------------------------------------------------------------ +// startNextParamSet +//------------------------------------------------------------------------------ +void OcciStmt::startNextParamSet() { + try { + m_stmt->addIteration(); + } catch(exception::Exception &ex) { + throw exception::Exception(std::string(__FUNCTION__) + " failed for SQL statement " + + getSqlForException() + ": " + ex.getMessage().str()); + } catch(std::exception &se) { + throw exception::Exception(std::string(__FUNCTION__) + " failed for SQL statement " + + getSqlForException() + ": " + se.what()); + } +} + //------------------------------------------------------------------------------ // executeQuery //------------------------------------------------------------------------------ diff --git a/rdbms/OcciStmt.hpp b/rdbms/OcciStmt.hpp index 66208ef221c78cfdb6a999ddfd921dc7c0a95a23..ac0b6f7b56b2ee84f6b38b699ae698072503ce9a 100644 --- a/rdbms/OcciStmt.hpp +++ b/rdbms/OcciStmt.hpp @@ -64,7 +64,7 @@ public: /** * Destructor. */ - virtual ~OcciStmt() throw() override; + ~OcciStmt() throw() override; /** * Prevent copying the object. @@ -74,7 +74,7 @@ public: /** * Idempotent close() method. The destructor calls this method. */ - virtual void close() override; + void close() override; /** * Binds an SQL parameter. @@ -82,7 +82,7 @@ public: * @param paramName The name of the parameter. * @param paramValue The value to be bound. */ - virtual void bindUint64(const std::string ¶mName, const uint64_t paramValue) override; + void bindUint64(const std::string ¶mName, const uint64_t paramValue) override; /** * Binds an SQL parameter. @@ -90,7 +90,7 @@ public: * @param paramName The name of the parameter. * @param paramValue The value to be bound. */ - virtual void bindOptionalUint64(const std::string ¶mName, const optional<uint64_t> ¶mValue) override; + void bindOptionalUint64(const std::string ¶mName, const optional<uint64_t> ¶mValue) override; /** * Binds an SQL parameter of type string. @@ -102,7 +102,7 @@ public: * @param paramName The name of the parameter. * @param paramValue The value to be bound. */ - virtual void bindString(const std::string ¶mName, const std::string ¶mValue) override; + void bindString(const std::string ¶mName, const std::string ¶mValue) override; /** * Binds an SQL parameter of type optional-string. @@ -114,7 +114,21 @@ public: * @param paramName The name of the parameter. * @param paramValue The value to be bound. */ - virtual void bindOptionalString(const std::string ¶mName, const optional<std::string> ¶mValue) override; + void bindOptionalString(const std::string ¶mName, const optional<std::string> ¶mValue) override; + + /** + * Sets the total number of parameter sets that will be entered for the next + * execution of this statement. + * + * @param nbParamSets The total numer of parameter sets + */ + void setNbParamSets(const uint32_t nbParamSets) override; + + /** + * Starts the next parameter set to be be entered for the next execution of + * this statement. + */ + void startNextParamSet() override; /** * Executes the statement and returns the result set. @@ -122,12 +136,12 @@ public: * @return The result set. Please note that it is the responsibility of the * caller to free the memory associated with the result set. */ - virtual std::unique_ptr<Rset> executeQuery() override; + std::unique_ptr<Rset> executeQuery() override; /** * Executes the statement. */ - virtual void executeNonQuery() override; + void executeNonQuery() override; /** * Returns the number of rows affected by the last execution of this @@ -135,7 +149,7 @@ public: * * @return The number of affected rows. */ - virtual uint64_t getNbAffectedRows() const override; + uint64_t getNbAffectedRows() const override; /** * Returns the underlying OCCI result set. diff --git a/rdbms/SqliteStmt.cpp b/rdbms/SqliteStmt.cpp index 481e84e112707d9ddef635b36a3be3d4a571e969..cf2d61d435b6aa5df0568062fbb6052961490608 100644 --- a/rdbms/SqliteStmt.cpp +++ b/rdbms/SqliteStmt.cpp @@ -205,6 +205,20 @@ void SqliteStmt::bindOptionalString(const std::string ¶mName, const optional } } +//------------------------------------------------------------------------------ +// setNbParamSets +//------------------------------------------------------------------------------ +void SqliteStmt::setNbParamSets(const uint32_t nbParamSets) { + throw exception::Exception(std::string(__FUNCTION__) + " not implemented"); +} + +//------------------------------------------------------------------------------ +// startNextParamSet +//------------------------------------------------------------------------------ +void SqliteStmt::startNextParamSet() { + throw exception::Exception(std::string(__FUNCTION__) + " not implemented"); +} + //------------------------------------------------------------------------------ // executeQuery //------------------------------------------------------------------------------ diff --git a/rdbms/SqliteStmt.hpp b/rdbms/SqliteStmt.hpp index 845e0f6def013b696b6da1f59dc45ddf4f0494c4..879b2b406b81e7daa0059731557b8a70e4f20472 100644 --- a/rdbms/SqliteStmt.hpp +++ b/rdbms/SqliteStmt.hpp @@ -54,12 +54,12 @@ public: /** * Destructor. */ - virtual ~SqliteStmt() throw() override; + ~SqliteStmt() throw() override; /** * Idempotent close() method. The destructor calls this method. */ - virtual void close() override; + void close() override; /** * Returns a pointer to the underlying prepared statement. @@ -77,7 +77,7 @@ public: * @param paramName The name of the parameter. * @param paramValue The value to be bound. */ - virtual void bindUint64(const std::string ¶mName, const uint64_t paramValue) override; + void bindUint64(const std::string ¶mName, const uint64_t paramValue) override; /** * Binds an SQL parameter. @@ -85,7 +85,7 @@ public: * @param paramName The name of the parameter. * @param paramValue The value to be bound. */ - virtual void bindOptionalUint64(const std::string ¶mName, const optional<uint64_t> ¶mValue) override; + void bindOptionalUint64(const std::string ¶mName, const optional<uint64_t> ¶mValue) override; /** * Binds an SQL parameter of type string. @@ -97,7 +97,7 @@ public: * @param paramName The name of the parameter. * @param paramValue The value to be bound. */ - virtual void bindString(const std::string ¶mName, const std::string ¶mValue) override; + void bindString(const std::string ¶mName, const std::string ¶mValue) override; /** * Binds an SQL parameter of type optional-string. @@ -109,7 +109,21 @@ public: * @param paramName The name of the parameter. * @param paramValue The value to be bound. */ - virtual void bindOptionalString(const std::string ¶mName, const optional<std::string> ¶mValue) override; + void bindOptionalString(const std::string ¶mName, const optional<std::string> ¶mValue) override; + + /** + * Sets the total number of parameter sets that will be entered for the next + * execution of this statement. + * + * @param nbParamSets The total numer of parameter sets + */ + void setNbParamSets(const uint32_t nbParamSets) override; + + /** + * Starts the next parameter set to be be entered for the next execution of + * this statement. + */ + void startNextParamSet() override; /** * Executes the statement and returns the result set. @@ -117,12 +131,12 @@ public: * @return The result set. Please note that it is the responsibility of the * caller to free the memory associated with the result set. */ - virtual std::unique_ptr<Rset> executeQuery() override; + std::unique_ptr<Rset> executeQuery() override; /** * Executes the statement. */ - virtual void executeNonQuery() override; + void executeNonQuery() override; /** * Returns the number of rows affected by the last execution of this @@ -130,7 +144,7 @@ public: * * @return The number of affected rows. */ - virtual uint64_t getNbAffectedRows() const override; + uint64_t getNbAffectedRows() const override; private: diff --git a/rdbms/Stmt.hpp b/rdbms/Stmt.hpp index 7683d3789cbe2fea20ef8ebbf3d8147eb9b913a9..ec47a980ec4260c82f8fc620943207eb9e9bc61d 100644 --- a/rdbms/Stmt.hpp +++ b/rdbms/Stmt.hpp @@ -150,6 +150,20 @@ public: */ virtual void bindOptionalString(const std::string ¶mName, const optional<std::string> ¶mValue) = 0; + /** + * Sets the total number of parameter sets that will be entered for the next + * execution of this statement. + * + * @param nbParamSets The total numer of parameter sets + */ + virtual void setNbParamSets(const uint32_t nbParamSets) = 0; + + /** + * Starts the next parameter set to be be entered for the next execution of + * this statement. + */ + virtual void startNextParamSet() = 0; + /** * Executes the statement and returns the result set. *