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 odbsequoia/src (5 files): msg#00091

db.carob.cvs

Subject: CVS update of odbsequoia/src (5 files)

Date: Friday, February 24, 2006 @ 15:55:45
Author: marc
Path: /cvsroot/carob/odbsequoia/src

Modified: abstract_item.cpp (1.8 -> 1.9) abstract_item.hpp (1.15 -> 1.16)
connect.cpp (1.13 -> 1.14) stmt.hpp (1.9 -> 1.10) util.hpp (1.3
-> 1.4)

Implemented our own ODBSeqException derived from CarobException,
as well as the corresponding odbc_diag_ids different prefix in SQL diagnostics.


-------------------+
abstract_item.cpp | 11 ++++++++---
abstract_item.hpp | 19 +++++++++++++------
connect.cpp | 7 +++++--
stmt.hpp | 19 +++++++++++++++++--
util.hpp | 11 +++++++++++
5 files changed, 54 insertions(+), 13 deletions(-)


Index: odbsequoia/src/abstract_item.cpp
diff -u odbsequoia/src/abstract_item.cpp:1.8
odbsequoia/src/abstract_item.cpp:1.9
--- odbsequoia/src/abstract_item.cpp:1.8 Wed Feb 8 18:21:12 2006
+++ odbsequoia/src/abstract_item.cpp Fri Feb 24 15:55:45 2006
@@ -137,8 +137,8 @@
*StringLengthPtr = wlen*sizeof(SQLWCHAR);
return SQL_SUCCESS;

- // 2. fields that cannot be get using get_diag_recw() above
- // TODO
+ // TODO: 2. fields that cannot be get using get_diag_recw() above
+

default:
return SQL_ERROR;
@@ -168,13 +168,18 @@
void
ODBCItem::push_diag_chain(const CarobNS::CarobException& head)
{
+ // Generic ids for generic CarobException
+ std::wstring prefix = get_carob_diagids();

- std::wstring prefix = get_diagids();
+ // Now change prefix ids for more specific exceptions

// can't rethrow and catch, (even by pointer) because of slicing
if (0 != dynamic_cast<const CarobNS::BackendException*>(&head))
prefix = get_backend_diagids();

+ if (0 != dynamic_cast<const ODBSeqException*>(&head))
+ prefix = get_odbc_diagids();
+
for (const CarobNS::CarobException *current = &head;
NULL != current; current = current->getNext())
{
Index: odbsequoia/src/abstract_item.hpp
diff -u odbsequoia/src/abstract_item.hpp:1.15
odbsequoia/src/abstract_item.hpp:1.16
--- odbsequoia/src/abstract_item.hpp:1.15 Thu Feb 9 18:07:31 2006
+++ odbsequoia/src/abstract_item.hpp Fri Feb 24 15:55:45 2006
@@ -65,8 +65,9 @@
public:
ODBCItem(const ODBCItem& creator) :
owner(creator),
- diagids(L"[Continuent][odbsequoia]"),
- backend_diagids(L"[INVALID_NOT_CONNECTED]")
+ carob_diagids(L"[Continuent][carob]"),
+ backend_diagids(L"[INVALID_NOT_CONNECTED]"),
+ odbc_diagids(L"[Continuent][odbsequoia]")
{ }

virtual SQLRETURN
@@ -92,10 +93,11 @@
void
push_diag_chain(const CarobNS::CarobException& ce);

- // get___diagids() need to be public because we want to call:
owner.get_diagids()
- /** Returns our own vendor and component IDs, used to prefix the diag
message. */
+ // get_X_diagids() need to be public because we want to call:
owner.get_diagids()
+
+ /** Returns our own vendor and carob component IDs, used to prefix the
diag message. */
virtual const std::wstring&
- get_diagids() const { return diagids; };
+ get_carob_diagids() const { return carob_diagids; };

/** Returns the vendor, component and data source IDs of the
backend we are faking. Used to prefix the diag message. Defined
@@ -103,9 +105,14 @@
virtual const std::wstring&
get_backend_diagids() const { return backend_diagids; };

+ /** Returns our own vendor and odbc component IDs */
+ virtual const std::wstring&
+ get_odbc_diagids() const { return odbc_diagids; };
+
protected:
- std::wstring diagids;
+ std::wstring carob_diagids;
std::wstring backend_diagids;
+ std::wstring odbc_diagids;

virtual SQLRETURN
get_header_diag_fieldw(SQLSMALLINT DiagIdentifier,
Index: odbsequoia/src/connect.cpp
diff -u odbsequoia/src/connect.cpp:1.13 odbsequoia/src/connect.cpp:1.14
--- odbsequoia/src/connect.cpp:1.13 Thu Jan 26 12:21:36 2006
+++ odbsequoia/src/connect.cpp Fri Feb 24 15:55:45 2006
@@ -66,8 +66,11 @@
{

std::wstring wide_dsn(fromSQLW(sqlwdsn, dsnlen));
- this->diagids += L"[";
- this->diagids += wide_dsn + L"]";
+ {
+ std::wstring diag_suffix(std::wstring(L"[") + wide_dsn + L"]");
+ this->carob_diagids += diag_suffix;
+ this->odbc_diagids += diag_suffix;
+ }

char temp[MAX_VALUE_LEN];

Index: odbsequoia/src/stmt.hpp
diff -u odbsequoia/src/stmt.hpp:1.9 odbsequoia/src/stmt.hpp:1.10
--- odbsequoia/src/stmt.hpp:1.9 Mon Jan 23 13:00:44 2006
+++ odbsequoia/src/stmt.hpp Fri Feb 24 15:55:45 2006
@@ -46,10 +46,25 @@
exec_directw(const SQLWCHAR *StatementText, SQLINTEGER TextLength);

const std::wstring&
- get_diagids() const { return owner.get_diagids(); }; // connection has the
prefix/knows the source
+ get_carob_diagids() const
+ { // the owning connection has the prefix/knows the source
+ return owner.get_carob_diagids();
+ };

const std::wstring&
- get_backend_diagids() const { return owner.get_backend_diagids(); }; //
idem
+ get_backend_diagids() const
+ { // idem
+ return owner.get_backend_diagids();
+ };
+
+ const std::wstring&
+ get_odbc_diagids() const
+ { // idem
+ return owner.get_odbc_diagids();
+ };
+
+ SQLRETURN
+ fetch();

protected:
SQLRETURN
Index: odbsequoia/src/util.hpp
diff -u odbsequoia/src/util.hpp:1.3 odbsequoia/src/util.hpp:1.4
--- odbsequoia/src/util.hpp:1.3 Thu Jan 12 21:15:20 2006
+++ odbsequoia/src/util.hpp Fri Feb 24 15:55:45 2006
@@ -22,6 +22,8 @@
#ifndef ODBSEQ_UTIL
#define ODBSEQ_UTIL

+#include "CarobException.hpp"
+
#include <sql.h>
#include <sqlucode.h>

@@ -44,6 +46,15 @@
toSQLW(const std::wstring& in,
SQLWCHAR * const outbuf, const SQLSMALLINT bufsize, SQLSMALLINT *
outsize);

+class ODBSeqException : public CarobNS::CarobException
+{
+public:
+ ODBSeqException(std::wstring state, std::wstring msg) :
+ CarobException(msg)
+ { SQLState = state; };
+};
+
+
#endif // include only once

/*


<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