Date: Thursday, March 30, 2006 @ 18:53:31
Author: marc
Path: /cvsroot/carob/odbsequoia/src
Modified: abstract_item.hpp (1.17 -> 1.18) connect.cpp (1.20 -> 1.21)
env.cpp (1.9 -> 1.10) stmt.cpp (1.23 -> 1.24)
searched/replaced all "self_p" pointers to safer "self" references
-------------------+
abstract_item.hpp | 6 ++++--
connect.cpp | 12 ++++++------
env.cpp | 6 +++---
stmt.cpp | 52 ++++++++++++++++++++++++++--------------------------
4 files changed, 39 insertions(+), 37 deletions(-)
Index: odbsequoia/src/abstract_item.hpp
diff -u odbsequoia/src/abstract_item.hpp:1.17
odbsequoia/src/abstract_item.hpp:1.18
--- odbsequoia/src/abstract_item.hpp:1.17 Thu Mar 30 14:25:50 2006
+++ odbsequoia/src/abstract_item.hpp Thu Mar 30 18:53:31 2006
@@ -39,10 +39,10 @@
// "method" MUST return some SQLRETURN code
#define _PROTECT_SQLRETURN(slf, method) \
- try { return slf->method; } \
+ try { return slf.method; } \
catch (const CarobNS::CarobException& ce) \
{ \
- slf->push_diag_chain(ce); \
+ slf.push_diag_chain(ce); \
return SQL_ERROR; \
}
@@ -90,6 +90,8 @@
void
clear_diags() { diag_records.clear(); };
+ /** Converts a CarobException chain into a SQL diagnostics list
+ * and attach it to "this" */
void
push_diag_chain(const CarobNS::CarobException& ce);
Index: odbsequoia/src/connect.cpp
diff -u odbsequoia/src/connect.cpp:1.20 odbsequoia/src/connect.cpp:1.21
--- odbsequoia/src/connect.cpp:1.20 Thu Mar 30 17:23:53 2006
+++ odbsequoia/src/connect.cpp Thu Mar 30 18:53:31 2006
@@ -50,10 +50,10 @@
SQLWCHAR * UserName, SQLSMALLINT NameLength2,
SQLWCHAR * Authentication, SQLSMALLINT NameLength3)
{
- ODBCConnection * self_p = static_cast<ODBCConnection *>(ConnectionHandle);
- self_p->clear_diags();
+ ODBCConnection & self = * static_cast<ODBCConnection *>(ConnectionHandle);
+ self.clear_diags();
- _PROTECT_SQLRETURN(self_p,
+ _PROTECT_SQLRETURN(self,
connectw(ServerName, NameLength1,
UserName, NameLength2,
Authentication, NameLength3))
@@ -188,10 +188,10 @@
SQLRETURN
SQLDisconnect(SQLHDBC ConnectionHandle)
{
- ODBCConnection * self_p = static_cast<ODBCConnection *>(ConnectionHandle);
- self_p->clear_diags();
+ ODBCConnection & self = * static_cast<ODBCConnection *>(ConnectionHandle);
+ self.clear_diags();
- _PROTECT_SQLRETURN(self_p, disconnect());
+ _PROTECT_SQLRETURN(self, disconnect());
}
SQLRETURN
Index: odbsequoia/src/env.cpp
diff -u odbsequoia/src/env.cpp:1.9 odbsequoia/src/env.cpp:1.10
--- odbsequoia/src/env.cpp:1.9 Thu Mar 30 18:42:58 2006
+++ odbsequoia/src/env.cpp Thu Mar 30 18:53:31 2006
@@ -43,10 +43,10 @@
SQLSetEnvAttr(SQLHENV env_handle, SQLINTEGER attribute, SQLPOINTER value,
SQLINTEGER str_len)
{
- ODBCEnv * self_p = static_cast<ODBCEnv *>(env_handle);
- self_p->clear_diags();
+ ODBCEnv & self = * static_cast<ODBCEnv *>(env_handle);
+ self.clear_diags();
- _PROTECT_SQLRETURN(self_p, set_env_attr(attribute, value, str_len));
+ _PROTECT_SQLRETURN(self, set_env_attr(attribute, value, str_len));
}
SQLRETURN
Index: odbsequoia/src/stmt.cpp
diff -u odbsequoia/src/stmt.cpp:1.23 odbsequoia/src/stmt.cpp:1.24
--- odbsequoia/src/stmt.cpp:1.23 Tue Mar 21 23:50:12 2006
+++ odbsequoia/src/stmt.cpp Thu Mar 30 18:53:31 2006
@@ -32,11 +32,11 @@
namespace {
-ODBCStatement *
+ODBCStatement &
objectify(SQLHANDLE StatementHandle)
{
// We don't expect the driver manager to give us corrupted handles
- return static_cast<ODBCStatement *>(StatementHandle);
+ return * static_cast<ODBCStatement *>(StatementHandle);
}
@@ -46,10 +46,10 @@
SQLExecDirectW(SQLHSTMT StatementHandle,
SQLWCHAR *StatementText, SQLINTEGER TextLength)
{
- ODBCStatement * self_p = objectify(StatementHandle);
- self_p->clear_diags();
+ ODBCStatement & self = objectify(StatementHandle);
+ self.clear_diags();
- _PROTECT_SQLRETURN(self_p, exec_directw(StatementText, TextLength));
+ _PROTECT_SQLRETURN(self, exec_directw(StatementText, TextLength));
}
@@ -69,10 +69,10 @@
SQLRETURN
SQLRowCount(SQLHSTMT shdle, SQLLEN * rowcount)
{
- ODBCStatement * self_p = objectify(shdle);
- self_p->clear_diags();
+ ODBCStatement & self = objectify(shdle);
+ self.clear_diags();
- _PROTECT_SQLRETURN(self_p, row_count(shdle, rowcount));
+ _PROTECT_SQLRETURN(self, row_count(shdle, rowcount));
}
@@ -97,10 +97,10 @@
SQLPOINTER TargetValuePtr, SQLINTEGER BufferLength,
SQLLEN * StrLen_or_Ind)
{
- ODBCStatement * self_p = objectify(StatementHandle);
- self_p->clear_diags();
+ ODBCStatement & self = objectify(StatementHandle);
+ self.clear_diags();
- _PROTECT_SQLRETURN(self_p,
+ _PROTECT_SQLRETURN(self,
bind_col(ColumnNumber, TargetType, TargetValuePtr,
BufferLength, StrLen_or_Ind));
}
@@ -125,10 +125,10 @@
SQLRETURN
SQLFetch(SQLHSTMT StatementHandle)
{
- ODBCStatement * self_p = objectify(StatementHandle);
- self_p->clear_diags();
+ ODBCStatement & self = objectify(StatementHandle);
+ self.clear_diags();
- _PROTECT_SQLRETURN(self_p, fetch());
+ _PROTECT_SQLRETURN(self, fetch());
}
@@ -161,10 +161,10 @@
SQLNumResultCols(SQLHSTMT StatementHandle,
SQLSMALLINT * ColumnCountPtr)
{
- ODBCStatement * self_p = objectify(StatementHandle);
- self_p->clear_diags();
+ ODBCStatement & self = objectify(StatementHandle);
+ self.clear_diags();
- _PROTECT_SQLRETURN(self_p, num_result_cols(ColumnCountPtr));
+ _PROTECT_SQLRETURN(self, num_result_cols(ColumnCountPtr));
}
SQLRETURN
@@ -194,10 +194,10 @@
SQLRETURN
SQLCloseCursor(SQLHSTMT StatementHandle)
{
- ODBCStatement * self_p = objectify(StatementHandle);
- self_p->clear_diags();
+ ODBCStatement & self = objectify(StatementHandle);
+ self.clear_diags();
- _PROTECT_SQLRETURN(self_p, close_cursor());
+ _PROTECT_SQLRETURN(self, close_cursor());
}
@@ -223,10 +223,10 @@
SQLWCHAR * StatementText,
SQLINTEGER TextLength)
{
- ODBCStatement * self_p = objectify(StatementHandle);
- self_p->clear_diags();
+ ODBCStatement & self = objectify(StatementHandle);
+ self.clear_diags();
- _PROTECT_SQLRETURN(self_p, prepare(StatementText, TextLength));
+ _PROTECT_SQLRETURN(self, prepare(StatementText, TextLength));
}
SQLRETURN
@@ -260,10 +260,10 @@
SQLRETURN
SQLExecute(SQLHSTMT StatementHandle)
{
- ODBCStatement * self_p = objectify(StatementHandle);
- self_p->clear_diags();
+ ODBCStatement & self = objectify(StatementHandle);
+ self.clear_diags();
- _PROTECT_SQLRETURN(self_p, execute());
+ _PROTECT_SQLRETURN(self, execute());
}
SQLRETURN
_______________________________________________
Carob-commits mailing list
[email protected]
https://forge.continuent.org/mailman/listinfo/carob-commits