Date: Wednesday, November 23, 2005 @ 15:13:02
  Author: gilles
    Path: /cvsroot/carob/carob

   Added: include/Request.hpp (1.1)
          include/RequestWithResultSetParameters.hpp (1.1) src/Request.cpp
          (1.1) src/RequestWithResultSetParameters.cpp (1.1)
 Removed: include/AbstractRequest.hpp (1.12)
          include/AbstractWriteRequest.hpp (1.3) include/SelectRequest.hpp
          (1.7) include/UpdateRequest.hpp (1.1) src/AbstractRequest.cpp
          (1.9) src/AbstractWriteRequest.cpp (1.2) src/SelectRequest.cpp
          (1.4) src/UpdateRequest.cpp (1.1)

Replaced XXXRequests by Request and RequestWithResultSetParameters


--------------------------------------------+
 include/AbstractRequest.hpp                |  204 ---------------------------
 include/AbstractWriteRequest.hpp           |   36 ----
 include/Request.hpp                        |  166 +++++++++++++++++++++
 include/RequestWithResultSetParameters.hpp |  105 +++++++++++++
 include/SelectRequest.hpp                  |   59 -------
 include/UpdateRequest.hpp                  |   46 ------
 src/AbstractRequest.cpp                    |   77 ----------
 src/AbstractWriteRequest.cpp               |   30 ---
 src/Request.cpp                            |   37 ++++
 src/RequestWithResultSetParameters.cpp     |   32 ++++
 src/SelectRequest.cpp                      |   40 -----
 src/UpdateRequest.cpp                      |   29 ---
 12 files changed, 340 insertions(+), 521 deletions(-)


Index: carob/include/AbstractRequest.hpp
diff -u carob/include/AbstractRequest.hpp:1.12 
carob/include/AbstractRequest.hpp:removed
--- carob/include/AbstractRequest.hpp:1.12      Tue Oct 18 15:48:03 2005
+++ carob/include/AbstractRequest.hpp   Wed Nov 23 15:13:02 2005
@@ -1,204 +0,0 @@
-/**
- * Sequoia: Database clustering technology.
- * Copyright (C) 2005 Emic Networks
- * Contact: [EMAIL PROTECTED]
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * Initial developer(s): Gilles Rayrat
- * Contributor(s): 
- */
-
-#ifndef ABSTRACTREQUEST_H_
-#define ABSTRACTREQUEST_H_
-
-#include "DriverSocket.hpp"
-
-/** Request types */
-enum RequestType
-{
-  //Forced to be int32s with the same values as in java
-  UNDEFINED = (int32_t)0,
-//Not implemented yet  DELETE    = (int32_t)1,
-//Not implemented yet  INSERT    = (int32_t)2,
-  UPDATE    = (int32_t)3,
-  SELECT    = (int32_t)4
-};
-
-/**
- * Defines the skeleton of an SQL request.
- * Requests have to be deserializable for communications with controller.
- * This class is 'pure virtual' and should me the mother class of all 
- * request classes.
- */
-class AbstractRequest
-{
-public:
-  /**
-   * Default constructor that should be called by subclasses
-   * 
-   * @param sqlQuery the SQL query
-   * @param escapeProcessing should the driver to escape processing before
-   *          sending to the database ?
-   * @param timeout in seconds
-   * @param lineSeparator the line separator used in the query
-   * @param requestType the request type
-   */
-  AbstractRequest(wstring sqlQuery, bool escapeProcessing, int32_t timeout, 
-                  wstring lineSeparator, RequestType requestType);
-  virtual ~AbstractRequest();
-  
-  /**
-   * Serialize the request on the output stream by sending only the needed
-   * parameters to reconstruct it on the controller.
-   * 
-   * @param out destination DriverBufferedOutputStream
-   * @param controllerWantsSqlSkeleton true if controller requires SQL 
templates
-   *          for better parsing.
-   * @throws IOException if fails
-   */
-  void              sendToStream(const DriverSocket& out,
-                                 bool controllerWantsSqlSkeleton) const
-                        throw (SocketIOException, UnexpectedException);
-
-  /** Gives the type of the request */
-  RequestType       getType() const { return requestType; }
-  /** Cast to wstring operator to ease printing (for debug/traces) */
-  operator          wstring& () { return SQLQuery; }
-  
-  /**
-   * Serializes ResultSet parameters to the stream. Optionally used by
-   * serializers of those derived requests that expect a ResultSet.
-   * @throws IOException stream error
-   */
-  void              sendResultSetParams(const DriverSocket&)
-                        throw (SocketIOException, UnexpectedException);
-  /**
-   * Gets the maximum number of rows the ResultSet can contain.
-   * @return maximum number of rows
-   */
-  int32_t           getMaxRows() {return maxRows;}
-  /**
-   * Sets the maximum number of rows in the ResultSet. Used only by Statement.
-   * @param mr maximum number of rows
-   */
-  void              setMaxRows(int32_t mr) {maxRows = mr;}
-  /**
-   * Gets the fetch size for this request.
-   * @return fetch size.
-   */
-  int32_t           getFetchSize() {return fetchSize;}
-  /**
-   * Sets the fetchSize value.
-   * @param fs fetchSize to set
-   */
-  void              setFetchSize(int32_t fs) { fetchSize = fs; }
-  /**
-   * Gets the cursor name
-   * @return cursor name
-   */
-   wstring          getCursorName() { return cursorName; }
-  /**
-   * Sets the cursor name
-   * @param cn cursor name to set
-   */
-  void              setCursorName(wstring cn) { cursorName = cn; hasCursor = 
true; }
-  /**
-   * Gets the autocommit mode
-   * @return true if request is in autocommit mode
-   */
-  bool              getIsAutoCommit() { return isAutoCommit; }
-  /**
-   * Sets the autocommit option
-   * @param ac true for autocommit mode, false for transaction mode
-   */
-  void              setIsAutoCommit(bool ac) { isAutoCommit = ac; }
-  /**
-   * Returns <code>true</code> if the connection is set to read-only
-   * @return a <code>boolean</code> value
-   */
-  bool              getIsReadOnly() { return isReadOnly; }
-  /**
-   * Sets the read-only mode for this request.
-   * @param iro <code>true</code> if connection is read-only
-   */
-  void              setIsReadOnly(bool iro) { isReadOnly = iro; }
-  /**
-   * Sets the SQL query
-   * @param q new query to affect
-   */
-  void              setSQLQuery(wstring q) { SQLQuery = q; }
-protected:
-  /** SQL query (set in constructor). */
-  wstring           SQLQuery;
-  /**
-   * Should the backend driver do escape processing before sending to the
-   * database? Simply forwarded to backend driver. No setter for this member,
-   * as it is set in constructor.
-   */
-  bool              escapeProcessing;
-  /**
-   * Set and sent by the driver to the controller. Required for parsing the
-   * request.
-   */
-  wstring           lineSeparator;
-  /**
-   * Timeout for this request in seconds, value 0 means no timeout. It is set
-   * in constructor.
-   */
-  int32_t           timeoutInSeconds;
-  /**
-   * Whether this request has been sent in <code>autocommit</code> mode or
-   * not. Does not do anything yet since we are always in autocommit mode...
-   */
-  bool              isAutoCommit;
-  /**
-   * true if the connection has been set to read-only
-   */
-  bool              isReadOnly;
-  /**
-   * If set to true, this query is/was interpreted on the driver side, if false
-   * the various parameters are encoded and passed as is to the database native
-   * driver by the controller. Look for "proxy mode" in the documentation.
-   */
-   bool             driverProcessed;
-  /**
-   * SQL query skeleton as it appears in PreparedStatements. Ignored if 
isSkeletonNull
-   * is true, which means that it is not a PreparedStatement
-   */
-  wstring           sqlSkeleton;
-  /**
-   * If true, means that the sqlSkeleton string is null (has to be ignored)
-   */
-  bool              isSkeletonNull;
-  /**
-   * The type of request.
-   */
-  RequestType       requestType;
-
-  /** Maximum number of rows that the result set can contain */
-  int32_t           maxRows;
-  /** Maximum number of rows to retrieve at a time (hint) */
-  int32_t           fetchSize;
-  /** Cursor name */
-  wstring           cursorName;
-  /**
-   * Whether <code>cursorName</code> value is valid or not.
-   * false means that cursor name string has to be ignored
-   */
-  bool              hasCursor;
-  /** makes the class "pure virtual" */
-  virtual bool      isClassImplementable()=0;
-};
-
-#endif /*ABSTRACTREQUEST_H_*/
Index: carob/include/AbstractWriteRequest.hpp
diff -u carob/include/AbstractWriteRequest.hpp:1.3 
carob/include/AbstractWriteRequest.hpp:removed
--- carob/include/AbstractWriteRequest.hpp:1.3  Mon Sep 19 14:29:48 2005
+++ carob/include/AbstractWriteRequest.hpp      Wed Nov 23 15:13:02 2005
@@ -1,36 +0,0 @@
-/**
- * Sequoia: Database clustering technology.
- * Copyright (C) 2005 Emic Networks
- * Contact: [EMAIL PROTECTED]
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * Initial developer(s): Gilles Rayrat
- * Contributor(s): 
- */
-
-#ifndef ABSTRACTWRITEREQUEST_H_
-#define ABSTRACTWRITEREQUEST_H_
-
-#include "AbstractRequest.hpp"
-
-class AbstractWriteRequest : public AbstractRequest
-{
-public:
-  AbstractWriteRequest(wstring, bool, int32_t, wstring, RequestType);
-protected:
-  /** The class is "pure virtual" */
-  virtual bool isClassImplementable()=0;
-};
-
-#endif /*ABSTRACTWRITEREQUEST_H_*/
Index: carob/include/Request.hpp
diff -u /dev/null carob/include/Request.hpp:1.1
--- /dev/null   Wed Nov 23 15:13:02 2005
+++ carob/include/Request.hpp   Wed Nov 23 15:13:02 2005
@@ -0,0 +1,166 @@
+/**
+ * Sequoia: Database clustering technology.
+ * Copyright (C) 2005 Emic Networks
+ * Contact: [EMAIL PROTECTED]
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Initial developer(s): Gilles Rayrat
+ * Contributor(s): 
+ */
+
+#ifndef REQUEST_HPP_
+#define REQUEST_HPP_
+
+#include "DriverSocket.hpp"
+
+using namespace std;
+/**
+ * This class defines a Request object. This basically carries the SQL 
statement
+ * and the SQL template if this is a PreparedStatement.
+ */
+class Request
+{
+public:
+  /**
+   * Creates a new <code>Request</code> object
+   * 
+   * @param sql the SQL statement
+   * @param nullSqlTemplate true if no SQL template
+   * @param sqlTemplate the SQL template (using ? as parameter placeholders)
+   * @param escapeProcessing Should the backend driver do escape processing
+   *          before sending to the database?
+   * @param timeoutInSeconds Timeout for this request in seconds, value 0 means
+   *          no timeout
+   */
+  Request(wstring sql, bool nullSqlTemplate, wstring sqlTemplate,
+      bool escapeProcessing, int timeoutInSeconds);
+       virtual ~Request();
+  /**
+   * Serializes the request on the output stream by sending only the needed
+   * parameters to reconstruct it on the controller.
+   * 
+   * @param out destination socket to controller
+   * @param controllerWantsSqlSkeleton true if controller requires SQL 
templates
+   *          for better parsing.
+   * @throws SocketIOException an error occurs on the stream
+   */
+  void              sendToStream(const DriverSocket& out,
+                                 bool controllerWantsSqlSkeleton) const
+                        throw (SocketIOException, UnexpectedException);
+  /**
+   * Returns the escapeProcessing value.
+   * @return the escapeProcessing.
+   */
+  bool              isEscapeProcessing() const { return escapeProcessing; }
+  /**
+   * Sets the escapeProcessing value.
+   * @param escapeProcessingPrm escapeProcessing to set.
+   */
+  void              setEscapeProcessing (bool escapeProcessingPrm)
+                         { escapeProcessing = escapeProcessingPrm; }
+  /**
+   * Returns the sqlQuery value.
+   * @return Returns the sqlQuery.
+   */
+  wstring           getSqlQuery() const { return sqlQuery; }
+  /**
+   * Sets the sqlQuery value.
+   */
+  void              setSqlQuery(wstring sqlQueryPrm) { sqlQuery = sqlQueryPrm; 
}
+  /**
+   * Cast to wstring operator to ease printing (for debug/traces).
+   * @return sql query as a string
+   */
+  operator          wstring& () { return sqlQuery; }
+  /**
+   * Returns the sqlTemplateNull value.
+   * @return true if the sqlTemplate string is NULL (inconsistent)
+   */
+  bool              isSqlTemplateNull() const { return sqlTemplateIsNull; }
+  /**
+   * Returns the sqlTemplate value. A check should be done previously on
+   * isSqlTemplateNull() to ensure this value consistency
+   * @return Returns the sqlTemplate.
+   */
+  wstring           getSqlTemplate() const { return sqlTemplate; }
+  /**
+   * Returns the isReadOnly value.
+   * @return true if the connection has been set to read only
+   */
+  bool              getIsReadOnly() { return isReadOnly; }
+  /**
+   * Sets the isReadOnly value.
+   * @param isReadOnly value to set.
+   */
+  void              setIsReadOnly(bool isReadOnlyPrm)
+                        { isReadOnly = isReadOnlyPrm; }
+  /**
+   * Returns the isAutoCommit value.
+   * @return the isAutoCommit
+   */
+  bool              getIsAutoCommit() const { return isAutoCommit; }
+  /**
+   * Sets the isAutoCommit value.
+   * @param isAutoCommitPrm The isAutoCommit to set.
+   */
+  void              setIsAutoCommit(bool isAutoCommitPrm)
+                        { isAutoCommit = isAutoCommitPrm; }
+  /**
+   * Returns the timeoutInSeconds value.
+   * @return Returns the timeoutInSeconds.
+   */
+  int               getTimeoutInSeconds() const { return timeoutInSeconds; }
+  /**
+   * Sets the timeoutInSeconds value.
+   * @param timeoutInSecondsPrm The timeoutInSeconds to set.
+   */
+  void              setTimeoutInSeconds(int timeoutInSecondsPrm)
+                        { timeoutInSeconds = timeoutInSecondsPrm; }
+
+protected:
+
+private:
+  /** SQL query (should be set in constructor). */
+  wstring           sqlQuery;
+  /**
+   * SQL query skeleton as it appears in PreparedStatements.
+   * sqlTemplateIsNull must be set to true if is not a PreparedStatement
+   */
+  wstring           sqlTemplate;
+  /** Whether the sqlTemplate string is NULL */
+  bool              sqlTemplateIsNull;
+  /** True if the connection has been set to read-only */
+  bool              isReadOnly;
+  /**
+   * Whether this request has been sent in <code>autocommit</code> mode or
+   * not.
+   */
+  bool              isAutoCommit;
+  /**
+   * Timeout for this request in seconds, value 0 means no timeout (should be
+   * set in constructor). This timeout is in seconds, reflecting the jdbc-spec,
+   * and is passed as-is to the backends jdbc-driver. Internally converted to 
ms
+   * via getTimeoutMs().
+   */
+  int               timeoutInSeconds;
+
+  /**
+   * Should the backend driver do escape processing before sending to the
+   * database? Simply forwarded to backend driver. No setter for this member,
+   * should be set in constructor.
+   */
+  bool              escapeProcessing;
+};
+
+#endif /*REQUEST_HPP_*/
Index: carob/include/RequestWithResultSetParameters.hpp
diff -u /dev/null carob/include/RequestWithResultSetParameters.hpp:1.1
--- /dev/null   Wed Nov 23 15:13:02 2005
+++ carob/include/RequestWithResultSetParameters.hpp    Wed Nov 23 15:13:02 2005
@@ -0,0 +1,105 @@
+/**
+ * Sequoia: Database clustering technology.
+ * Copyright (C) 2005 Emic Networks
+ * Contact: [EMAIL PROTECTED]
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Initial developer(s): Gilles Rayrat
+ * Contributor(s): 
+ */
+
+#ifndef REQUESTWITHRESULTSETPARAMETERS_HPP_
+#define REQUESTWITHRESULTSETPARAMETERS_HPP_
+
+#include "Request.hpp"
+
+class RequestWithResultSetParameters : public Request
+{
+public:
+  /**
+   * Creates a new <code>RequestWithResultSetParameters</code> object
+   * 
+   * @param sql the SQL statement
+   * @param sqlTemplate the SQL template (using ? as parameter placeholders)
+   * @param nullSqlTemplate true if no SQL template
+   * @param escapeProcessing Should the backend driver do escape processing
+   *          before sending to the database?
+   * @param timeoutInSeconds Timeout for this request in seconds, value 0 means
+   *          no timeout
+   */
+       RequestWithResultSetParameters(wstring sql, bool nullSqlTemplate,
+      wstring sqlTemplate, bool escapeProcessing, int timeoutInSeconds);
+
+       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
+   * @param controllerWantsSqlSkeleton true if controller requires SQL 
templates
+   *          for better parsing.
+   * @throws SocketIOException an error occurs on the stream
+   * @see Request#sendToStream(const DriverSocket&, bool) const
+   */
+  void              sendToStream(const DriverSocket& out,
+                                 bool controllerWantsSqlSkeleton) const
+                        throw (SocketIOException, UnexpectedException);
+  /**
+   * Returns the cursorNameIsNull value
+   * @return true if the cursorName is NULL (not valid)
+   */
+  bool              isCursorNameNull() const { return cursorNameIsNull; }
+  /**
+   * Returns the cursorName value.
+   * @return Returns the cursorName.
+   */
+  wstring           getCursorName() const { return cursorName; }
+  /**
+   * Sets the cursorName value.
+   * @param cursorNamePrm cursorName to set.
+   */
+  void              setCursorName(wstring cursorNamePrm)
+                        { cursorName = cursorNamePrm; }
+  /**
+   * Returns the fetchSize value.
+   * @return Returns the fetchSize.
+   */
+  int               getFetchSize () const { return fetchSize; }
+  /**
+   * Sets the fetchSize value.
+   * @param fetchSizePrm fetchSize to set.
+   */
+  void              setFetchSize(int fetchSizePrm) { fetchSize = fetchSizePrm; 
}
+  /**
+   * Returns the maxRows value.
+   * @return maximum number of rows.
+   */
+  int               getMaxRows() const { return maxRows; }
+  /**
+   * Sets the maxRows value.
+   * @param maxRowsPrm maxRows to set.
+   */
+  void              setMaxRows(int maxRowsPrm) { maxRows = maxRowsPrm; }
+private:
+  /** Maximum number of rows for the ResultSet*/
+  int               maxRows;
+  /** Size to be fetched for the ResultSet */
+  int               fetchSize;
+  /** Name of the cursor of the ResultSet */
+  wstring           cursorName;
+  /** Whether the cursor name is valid */
+  bool              cursorNameIsNull;
+
+};
+#endif /*REQUESTWITHRESULTSETPARAMETERS_HPP_*/
Index: carob/include/SelectRequest.hpp
diff -u carob/include/SelectRequest.hpp:1.7 
carob/include/SelectRequest.hpp:removed
--- carob/include/SelectRequest.hpp:1.7 Fri Nov 18 17:37:28 2005
+++ carob/include/SelectRequest.hpp     Wed Nov 23 15:13:02 2005
@@ -1,59 +0,0 @@
-/**
- * Sequoia: Database clustering technology.
- * Copyright (C) 2005 Emic Networks
- * Contact: [EMAIL PROTECTED]
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * Initial developer(s): Gilles Rayrat
- * Contributor(s): 
- */
-
-#ifndef SELECTREQUEST_H_
-#define SELECTREQUEST_H_
-
-#include "AbstractRequest.hpp"
-
-class SelectRequest : public AbstractRequest
-{
-public:
-  /**
-   * Creates a new <code>SelectRequest</code> instance. The caller must give
-   * an SQL request, without any leading or trailing spaces and beginning with
-   * the 'select' keyword (it will not be checked).
-   * <p>
-   * @param sqlQuery the SQL query
-   * @param escapeProcessing should the driver to escape processing before
-   *          sending to the database ?
-   * @param timeout an <code>int32_t</code> value
-   * @param lineSeparator the line separator used in the query
-   */
-  SelectRequest(wstring sqlQuery, bool escapeProcessing, int32_t timeout,
-      wstring lineSeparator);
-  /**
-   * Overrides <code>AbstractRequest.sendToStream</code> to send resultset
-   * parameters and needSqlSkeleton
-   * @param sockPtr the socket to write on
-   * @param needSqlSkeleton true if controller requires SQL templates
-   *        for better parsing.
-   * @see AbstractRequest#sendToStream(DriverSocket&, bool);
-   */
-  void sendToStream(const DriverSocket& sockPtr, bool needSqlSkeleton)
-      throw (SocketIOException, UnexpectedException);
-protected:
-  // this class is **not** abstract, so we give a dummy implem here
-  bool isClassImplementable() { return true; }
-private:
-};
-
-#endif /*SELECTREQUEST_H_*/
Index: carob/include/UpdateRequest.hpp
diff -u carob/include/UpdateRequest.hpp:1.1 
carob/include/UpdateRequest.hpp:removed
--- carob/include/UpdateRequest.hpp:1.1 Mon Sep 19 10:05:27 2005
+++ carob/include/UpdateRequest.hpp     Wed Nov 23 15:13:02 2005
@@ -1,46 +0,0 @@
-/**
- * Sequoia: Database clustering technology.
- * Copyright (C) 2005 Emic Networks
- * Contact: [EMAIL PROTECTED]
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * Initial developer(s): Gilles Rayrat
- * Contributor(s): 
- */
-
-#ifndef UPDATEREQUEST_H_
-#define UPDATEREQUEST_H_
-
-#include "AbstractWriteRequest.hpp"
-
-class UpdateRequest : public AbstractWriteRequest
-{
-public:
-
-  /**
-   * Constructs an update request
-   * @param sqlQuery the SQL query
-   * @param escapeProcessing should the driver to escape processing before
-   *          sending to the database ?
-   * @param timeOut an <code>int32_t</code> value
-   * @param lineSeparator the line separator used in the query
-   */
-  UpdateRequest(wstring sqlQuery, bool escapeProcessing, 
-                int32_t timeOut, wstring lineSeparator);
-protected:
-  // this class is **not** abstract
-  bool isClassImplementable() { return true; }
-};
-
-#endif /*UPDATEREQUEST_H_*/
Index: carob/src/AbstractRequest.cpp
diff -u carob/src/AbstractRequest.cpp:1.9 carob/src/AbstractRequest.cpp:removed
--- carob/src/AbstractRequest.cpp:1.9   Tue Nov 15 17:20:28 2005
+++ carob/src/AbstractRequest.cpp       Wed Nov 23 15:13:02 2005
@@ -1,77 +0,0 @@
-/**
- * Sequoia: Database clustering technology.
- * Copyright (C) 2005 Emic Networks
- * Contact: [EMAIL PROTECTED]
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * Initial developer(s): Gilles Rayrat
- * Contributor(s): 
- */
-
-#include "AbstractRequest.hpp"
-
-AbstractRequest::AbstractRequest(wstring sqlQueryPrm, bool escapeProcessingPrm,
-                int32_t timeoutPrm, wstring lineSeparatorPrm, RequestType 
requestTypePrm) :
-    SQLQuery(sqlQueryPrm),
-    escapeProcessing(escapeProcessingPrm),
-    lineSeparator(lineSeparatorPrm),
-    timeoutInSeconds(timeoutPrm),
-    isReadOnly(false),
-    isSkeletonNull(true),
-    requestType(requestTypePrm),
-    maxRows(0),
-    fetchSize(0),
-    hasCursor(false)
-{
-}
-
-AbstractRequest::~AbstractRequest()
-{
-}
-
-void AbstractRequest::sendToStream(const DriverSocket& out, 
-                                   bool controllerWantsSqlSkeleton) const
-    throw (SocketIOException, UnexpectedException)
-{
-  out<<SQLQuery;
-  out<<escapeProcessing;
-  out<<timeoutInSeconds;
-  out<<isAutoCommit;
-  // If Statements are not processed by the driver, the controller
-  // will need the skeleton.
-  if (controllerWantsSqlSkeleton && !isSkeletonNull)
-  {
-    out<<true;
-    out<<sqlSkeleton;
-  }
-  else
-    out<<false;
-
-}
-
-void AbstractRequest::sendResultSetParams(const DriverSocket& sock)
-    throw (SocketIOException, UnexpectedException)
-{
-  sock<<maxRows;
-  sock<<fetchSize;
-  
-  if (hasCursor) // do we have a cursor name ?
-  {
-    sock<<true;
-    sock<<cursorName;
-  }
-  else
-    sock<<false;
-}
-
Index: carob/src/AbstractWriteRequest.cpp
diff -u carob/src/AbstractWriteRequest.cpp:1.2 
carob/src/AbstractWriteRequest.cpp:removed
--- carob/src/AbstractWriteRequest.cpp:1.2      Mon Sep 19 14:29:48 2005
+++ carob/src/AbstractWriteRequest.cpp  Wed Nov 23 15:13:02 2005
@@ -1,30 +0,0 @@
-/**
- * Sequoia: Database clustering technology.
- * Copyright (C) 2005 Emic Networks
- * Contact: [EMAIL PROTECTED]
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * Initial developer(s): Gilles Rayrat
- * Contributor(s): 
- */
-
-#include "AbstractWriteRequest.hpp"
-
-AbstractWriteRequest::AbstractWriteRequest(wstring sqlQueryPrm, 
-    bool escapeProcessingPrm, int32_t timeOutPrm, wstring lineSepPrm,
-    RequestType requestTypePrm) :
-  AbstractRequest(sqlQueryPrm, escapeProcessingPrm, timeOutPrm, 
-      lineSepPrm, requestTypePrm)
-{
-}
Index: carob/src/Request.cpp
diff -u /dev/null carob/src/Request.cpp:1.1
--- /dev/null   Wed Nov 23 15:13:02 2005
+++ carob/src/Request.cpp       Wed Nov 23 15:13:02 2005
@@ -0,0 +1,37 @@
+#include "Request.hpp"
+
+Request::Request(wstring sql, bool nullSqlTemplate, wstring sqlTemplatePrm,
+      bool escapeProcessingPrm, int timeoutInSecondsPrm) :
+sqlQuery(sql),
+sqlTemplate(sqlTemplatePrm),
+sqlTemplateIsNull(nullSqlTemplate),
+isReadOnly(false),
+isAutoCommit(true),
+timeoutInSeconds(timeoutInSecondsPrm),
+escapeProcessing(escapeProcessingPrm)
+{
+}
+
+Request::~Request()
+{
+}
+
+void Request::sendToStream(const DriverSocket& out, 
+                           bool controllerWantsSqlSkeleton) const
+    throw (SocketIOException, UnexpectedException)
+{
+  out<<sqlQuery;
+  out<<escapeProcessing;
+  out<<timeoutInSeconds;
+  out<<isAutoCommit;
+  // If Statements are not processed by the driver, the controller
+  // will need the skeleton.
+  if (controllerWantsSqlSkeleton && !sqlTemplateIsNull)
+  {
+    out<<true;
+    out<<sqlTemplate;
+  }
+  else
+    out<<false;
+
+}
Index: carob/src/RequestWithResultSetParameters.cpp
diff -u /dev/null carob/src/RequestWithResultSetParameters.cpp:1.1
--- /dev/null   Wed Nov 23 15:13:02 2005
+++ carob/src/RequestWithResultSetParameters.cpp        Wed Nov 23 15:13:02 2005
@@ -0,0 +1,32 @@
+#include "RequestWithResultSetParameters.hpp"
+
+RequestWithResultSetParameters::RequestWithResultSetParameters(wstring sql, 
+    bool nullSqlTemplate, wstring sqlTemplatePrm, bool escapeProcessingPrm, 
+    int timeoutInSecondsPrm) :
+Request(sql, nullSqlTemplate, sqlTemplatePrm, escapeProcessingPrm, 
timeoutInSecondsPrm),
+maxRows(0),
+fetchSize(0),
+cursorNameIsNull(true)
+{
+}
+
+RequestWithResultSetParameters::~RequestWithResultSetParameters()
+{
+}
+void RequestWithResultSetParameters::sendToStream(const DriverSocket& out, 
+                           bool controllerWantsSqlSkeleton) const
+    throw (SocketIOException, UnexpectedException)
+{
+    Request::sendToStream(out, controllerWantsSqlSkeleton);
+
+    out<<maxRows;
+    out<<fetchSize;
+
+    if (!isCursorNameNull()) // do we have a cursor name ?
+    {
+      out<<true;
+      out<<cursorName;
+    }
+    else
+      out<<false;
+}
Index: carob/src/SelectRequest.cpp
diff -u carob/src/SelectRequest.cpp:1.4 carob/src/SelectRequest.cpp:removed
--- carob/src/SelectRequest.cpp:1.4     Fri Nov 18 17:37:28 2005
+++ carob/src/SelectRequest.cpp Wed Nov 23 15:13:02 2005
@@ -1,40 +0,0 @@
-/**
- * Sequoia: Database clustering technology.
- * Copyright (C) 2005 Emic Networks
- * Contact: [EMAIL PROTECTED]
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * Initial developer(s): Gilles Rayrat
- * Contributor(s): 
- */
-
-#include "SelectRequest.hpp"
-
-
-
-SelectRequest::SelectRequest(wstring sqlQuery, bool escapeProcessing, 
-    int32_t timeout, wstring lineSeparator) :
-  AbstractRequest(sqlQuery, escapeProcessing, timeout, lineSeparator,
-      SELECT)
-{
-}
-
-void SelectRequest::sendToStream(const DriverSocket& sockPtr, 
-                                 bool needSqlSkeleton)
-    throw (SocketIOException, UnexpectedException)
-{
-  AbstractRequest::sendToStream(sockPtr, needSqlSkeleton);
-  sendResultSetParams(sockPtr);
-}
-
Index: carob/src/UpdateRequest.cpp
diff -u carob/src/UpdateRequest.cpp:1.1 carob/src/UpdateRequest.cpp:removed
--- carob/src/UpdateRequest.cpp:1.1     Mon Sep 19 10:05:27 2005
+++ carob/src/UpdateRequest.cpp Wed Nov 23 15:13:02 2005
@@ -1,29 +0,0 @@
-/**
- * Sequoia: Database clustering technology.
- * Copyright (C) 2005 Emic Networks
- * Contact: [EMAIL PROTECTED]
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * Initial developer(s): Gilles Rayrat
- * Contributor(s): 
- */
-
-#include "UpdateRequest.hpp"
-
-UpdateRequest::UpdateRequest(wstring sqlQueryPrm, 
-    bool escapeProcessingPrm, int32_t timeOutPrm, wstring lineSepPrm) :
-  AbstractWriteRequest(sqlQueryPrm, escapeProcessingPrm, timeOutPrm, 
-      lineSepPrm, UPDATE)
-{
-}

_______________________________________________
Carob-commits mailing list
[email protected]
https://forge.continuent.org/mailman/listinfo/carob-commits

Reply via email to