Date: Tuesday, January 17, 2006 @ 14:23:04
  Author: marc
    Path: /cvsroot/carob/odbsequoia/src

Modified: abstract_item.cpp (1.4 -> 1.5) abstract_item.hpp (1.7 -> 1.8)
          connect.hpp (1.5 -> 1.6) stmt.cpp (1.6 -> 1.7) stmt.hpp (1.5 ->
          1.6)

Added many const qualifiers on non-mutable variables and methods.


-------------------+
 abstract_item.cpp |   22 +++++++++++++---------
 abstract_item.hpp |   16 ++++++++++------
 connect.hpp       |    2 +-
 stmt.cpp          |    8 ++++----
 stmt.hpp          |    4 ++--
 5 files changed, 30 insertions(+), 22 deletions(-)


Index: odbsequoia/src/abstract_item.cpp
diff -u odbsequoia/src/abstract_item.cpp:1.4 
odbsequoia/src/abstract_item.cpp:1.5
--- odbsequoia/src/abstract_item.cpp:1.4        Mon Jan 16 20:01:00 2006
+++ odbsequoia/src/abstract_item.cpp    Tue Jan 17 14:23:04 2006
@@ -28,8 +28,9 @@
 
 SQLRETURN
 ODBCItem::get_diag_fieldw(SQLSMALLINT RecNumber, SQLSMALLINT DiagIdentifier,
-                          SQLPOINTER DiagInfoPtr,
-                          SQLSMALLINT BufferLength, SQLSMALLINT * 
StringLengthPtr)
+                          SQLPOINTER const DiagInfoPtr,
+                          SQLSMALLINT BufferLength, SQLSMALLINT * const 
StringLengthPtr)
+    const
 {
     // all this could be as simple as: "if (RecNumber>0)",
     // but MS has decided otherwise
@@ -67,9 +68,10 @@
 
 SQLRETURN
 ODBCItem::get_diag_recw(SQLSMALLINT RecNumber,
-                        SQLWCHAR * Sqlstate, SQLINTEGER * NativeErrorPtr,
-                        SQLWCHAR * MessageText,
-                        SQLSMALLINT BufferLength, SQLSMALLINT * TextLengthPtr)
+                        SQLWCHAR * const Sqlstate, SQLINTEGER * const 
NativeErrorPtr,
+                        SQLWCHAR * const MessageText,
+                        SQLSMALLINT BufferLength, SQLSMALLINT * const 
TextLengthPtr)
+    const
 {
 
     if (RecNumber > (SQLSMALLINT) this->diag_records.size())
@@ -91,8 +93,9 @@
 
 SQLRETURN
 ODBCItem::get_record_diag_fieldw(SQLSMALLINT RecNumber, SQLSMALLINT 
DiagIdentifier,
-                                 SQLPOINTER DiagInfoPtr,
-                                 SQLSMALLINT BufferLength, SQLSMALLINT * 
StringLengthPtr)
+                                 SQLPOINTER const DiagInfoPtr,
+                                 SQLSMALLINT BufferLength, SQLSMALLINT * const 
StringLengthPtr)
+    const
 {
     if (RecNumber > (SQLSMALLINT) this->diag_records.size())
         return SQL_NO_DATA;
@@ -139,8 +142,9 @@
 
 SQLRETURN
 ODBCItem::get_header_diag_fieldw(SQLSMALLINT DiagIdentifier,
-                                 SQLPOINTER DiagInfoPtr,
-                                 SQLSMALLINT BufferLength, SQLSMALLINT * 
StringLengthPtr)
+                                 SQLPOINTER const DiagInfoPtr,
+                                 SQLSMALLINT BufferLength, SQLSMALLINT * const 
StringLengthPtr)
+    const
 {
     switch(DiagIdentifier) {
 
Index: odbsequoia/src/abstract_item.hpp
diff -u odbsequoia/src/abstract_item.hpp:1.7 
odbsequoia/src/abstract_item.hpp:1.8
--- odbsequoia/src/abstract_item.hpp:1.7        Mon Jan 16 20:01:00 2006
+++ odbsequoia/src/abstract_item.hpp    Tue Jan 17 14:23:04 2006
@@ -42,18 +42,20 @@
 class ODBCItem
 {
 public:
-    ODBCItem(ODBCItem& creator) : owner(creator) { }
+    ODBCItem(const ODBCItem& creator) : owner(creator) { }
 
     virtual SQLRETURN
     get_diag_recw(SQLSMALLINT RecNumber,
                   SQLWCHAR * Sqlstate, SQLINTEGER * NativeErrorPtr,
                   SQLWCHAR * MessageText,
-                  SQLSMALLINT BufferLength, SQLSMALLINT * TextLengthPtr);
+                  SQLSMALLINT BufferLength, SQLSMALLINT * TextLengthPtr)
+        const;
 
     SQLRETURN
     get_diag_fieldw(SQLSMALLINT RecNumber, SQLSMALLINT DiagIdentifier,
                     SQLPOINTER DiagInfoPtr,
-                    SQLSMALLINT BufferLength, SQLSMALLINT * StringLengthPtr);
+                    SQLSMALLINT BufferLength, SQLSMALLINT * StringLengthPtr)
+        const;
 
     virtual ~ODBCItem() { };
 
@@ -61,15 +63,17 @@
     virtual SQLRETURN
     get_header_diag_fieldw(SQLSMALLINT DiagIdentifier,
                            SQLPOINTER DiagInfoPtr,
-                           SQLSMALLINT BufferLength, SQLSMALLINT * 
StringLengthPtr);
+                           SQLSMALLINT BufferLength, SQLSMALLINT * 
StringLengthPtr)
+        const;
 
     virtual SQLRETURN
     get_record_diag_fieldw(SQLSMALLINT RecNumber, SQLSMALLINT DiagIdentifier,
                            SQLPOINTER DiagInfoPtr,
-                           SQLSMALLINT BufferLength, SQLSMALLINT * 
StringLengthPtr);
+                           SQLSMALLINT BufferLength, SQLSMALLINT * 
StringLengthPtr)
+        const;
 
     std::vector<DiagRecord> diag_records;
-    ODBCItem& owner;
+    const ODBCItem& owner;
 };
 
 
Index: odbsequoia/src/connect.hpp
diff -u odbsequoia/src/connect.hpp:1.5 odbsequoia/src/connect.hpp:1.6
--- odbsequoia/src/connect.hpp:1.5      Mon Jan  9 11:32:27 2006
+++ odbsequoia/src/connect.hpp  Tue Jan 17 14:23:04 2006
@@ -31,7 +31,7 @@
 class ODBCConnection : public ODBCItem
 {
 public:
-    ODBCConnection(ODBCEnv& creator) : ODBCItem(creator) { } ;
+    ODBCConnection(const ODBCEnv& creator) : ODBCItem(creator) { } ;
     CarobNS::Connection* carob_conn;
     // TODO: rely on ConnectionParameters instead
     std::wstring serverhost;
Index: odbsequoia/src/stmt.cpp
diff -u odbsequoia/src/stmt.cpp:1.6 odbsequoia/src/stmt.cpp:1.7
--- odbsequoia/src/stmt.cpp:1.6 Fri Jan 13 00:15:09 2006
+++ odbsequoia/src/stmt.cpp     Tue Jan 17 14:23:04 2006
@@ -37,12 +37,12 @@
 }
 
 SQLRETURN
-ODBCStatement::exec_directw(SQLWCHAR *StatementText, SQLINTEGER TextLength)
+ODBCStatement::exec_directw(const SQLWCHAR *StatementText, SQLINTEGER 
TextLength)
 {
+    diag_records.clear();
     try
     {
-        diag_records.clear();
-        std::wstring wstext = fromSQLW(StatementText, TextLength);
+        const std::wstring wstext = fromSQLW(StatementText, TextLength);
         bool resultIsSet = carob_stmt->execute(wstext);
         if (resultIsSet)
             state = S5;
@@ -63,7 +63,7 @@
 SQLRETURN
 SQLRowCount(SQLHSTMT shdle, SQLLEN * rowcount)
 {
-    ODBCStatement * self_p = (ODBCStatement *)shdle;
+    const ODBCStatement * self_p = (ODBCStatement *)shdle;
 
     if (S5 != self_p->state
         && S4 != self_p->state)
Index: odbsequoia/src/stmt.hpp
diff -u odbsequoia/src/stmt.hpp:1.5 odbsequoia/src/stmt.hpp:1.6
--- odbsequoia/src/stmt.hpp:1.5 Thu Jan 12 21:15:20 2006
+++ odbsequoia/src/stmt.hpp     Tue Jan 17 14:23:04 2006
@@ -35,10 +35,10 @@
     stmt_state_t state;  // state according to "Statement Transitions"
                          // in the ODBC reference (as far as
                          // possible).
-    ODBCStatement(ODBCConnection& creator) : ODBCItem(creator)
+    ODBCStatement(const ODBCConnection& creator) : ODBCItem(creator)
     { state = S0; };
     SQLRETURN
-    ODBCStatement::exec_directw(SQLWCHAR *StatementText, SQLINTEGER 
TextLength);
+    ODBCStatement::exec_directw(const SQLWCHAR *StatementText, SQLINTEGER 
TextLength);
 };
 
 

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

Reply via email to