Please take our Survey
logo       

Choosing A Webhost:
A web hosting service is a type of Internet hosting service that allows individuals and organizations to provide their own website accessible via the World Wide Web. Web hosts are companies that provide space on a server they own for use by their clients as well as providing Internet connectivity, typically in a data center. Web hosts can also provide data center space and connectivity to the Internet for servers they do not own to be located in their data center, called colocation. more...

CVS update of carob/include (2 files): msg#00112

db.carob.cvs

Subject: CVS update of carob/include (2 files)

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;


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe

Navigation

Home | advertise | OSDir is an inevitable website. super tiny logo