Date: Monday, February 27, 2006 @ 17:29:22
Author: gilles
Path: /cvsroot/carob/carob/include
Modified: Request.hpp (1.15 -> 1.16) RequestWithResultSetParameters.hpp
(1.11 -> 1.12)
Requests are now private implementation of statements, it is no more exposed to
outside => made contructors and destructors protected, and [Prepared]Statement
friend classes to ensure this
------------------------------------+
Request.hpp | 42 ++++++++++++++++++++---------------
RequestWithResultSetParameters.hpp | 24 ++++++++++++--------
2 files changed, 40 insertions(+), 26 deletions(-)
Index: carob/include/Request.hpp
diff -u carob/include/Request.hpp:1.15 carob/include/Request.hpp:1.16
--- carob/include/Request.hpp:1.15 Tue Jan 24 19:37:27 2006
+++ carob/include/Request.hpp Mon Feb 27 17:29:22 2006
@@ -31,28 +31,21 @@
class DriverSocket;
/**
- * This class defines a Request object. This basically carries the SQL
statement
- * and the SQL template if this is a ParameterStatement.
+ * Defines a Request object, a private implementation of [Parameter]Statement
+ * class that holds and handles sql requests.<br>
+ * It basically carries the SQL statement and the SQL template if this is a
+ * ParameterStatement.
*/
class Request
{
+// We are private implementation of these two classes. So it is ok to make them
+// friends
+friend class Statement;
+friend class ParameterStatement;
+// Contructor and Destructor are protected to avoid access by anyone else than
+// our friends
public:
/**
- * Creates a new <code>Request</code> object
- *
- * @param sql the SQL statement
- */
- Request(std::wstring sql) :
- sqlQueryOrTemplate(sql),
- is_read_only(false),
- is_auto_commit(true),
- timeout_in_seconds(0),
- escape_processing(true) // default = true according to the JDBC spec
- {
- }
-
- virtual ~Request();
- /**
* Serializes the request on the output stream by sending only the needed
* parameters to reconstruct it on the controller.
*
@@ -142,6 +135,21 @@
{ timeout_in_seconds = timeoutInSecondsPrm; return
*this;}
protected:
+ /**
+ * Creates a new <code>Request</code> object. Protected to ensure no one but
+ * friend classes can use us
+ * @param sql the SQL statement
+ */
+ Request(std::wstring sql) :
+ sqlQueryOrTemplate(sql),
+ is_read_only(false),
+ is_auto_commit(true),
+ timeout_in_seconds(0),
+ escape_processing(true) // default = true according to the JDBC spec
+ {
+ }
+
+ virtual ~Request();
private:
// forbid copies (java style)
Index: carob/include/RequestWithResultSetParameters.hpp
diff -u carob/include/RequestWithResultSetParameters.hpp:1.11
carob/include/RequestWithResultSetParameters.hpp:1.12
--- carob/include/RequestWithResultSetParameters.hpp:1.11 Tue Jan 24
19:37:27 2006
+++ carob/include/RequestWithResultSetParameters.hpp Mon Feb 27 17:29:22 2006
@@ -37,17 +37,14 @@
*/
class RequestWithResultSetParameters : public Request
{
+// We are private implementation of these two classes. So it is ok to make them
+// friends
+friend class Statement;
+friend class ParameterStatement;
+// Contructor and Destructor are protected to avoid access by anyone else than
+// our friends
public:
/**
- * Creates a new <code>RequestWithResultSetParameters</code> object
- *
- * @param sql the SQL statement
- */
- RequestWithResultSetParameters(std::wstring sql);
-
- virtual ~RequestWithResultSetParameters();
-
- /**
* Also serialize ResultSet parameters to the stream. Optionally used by
* serializers of those derived requests that expect a ResultSet.
* @param out destination socket to controller
@@ -92,6 +89,15 @@
* @param maxRowsPrm maxRows to set.
*/
void setMaxRows(int maxRowsPrm) { max_rows = maxRowsPrm; }
+protected:
+ /**
+ * Creates a new <code>RequestWithResultSetParameters</code> object.
+ * Protected to ensure no one but friend classes can use us
+ * @param sql the SQL statement
+ */
+ RequestWithResultSetParameters(std::wstring sql);
+
+ virtual ~RequestWithResultSetParameters();
private:
/** Maximum number of rows for the ResultSet*/
int max_rows;
_______________________________________________
Carob-commits mailing list
[email protected]
https://forge.continuent.org/mailman/listinfo/carob-commits