|
|
Choosing A Webhost: |
CVS update of odbsequoia/src (connect.cpp connect.hpp env.cpp): msg#00131db.carob.cvs
Date: Thursday, March 23, 2006 @ 00:10:59 Author: marc Path: /cvsroot/carob/odbsequoia/src Modified: connect.cpp (1.18 -> 1.19) connect.hpp (1.8 -> 1.9) env.cpp (1.7 -> 1.8) Implemented SQLDisconnect() -------------+ connect.cpp | 27 +++++++++++++++++++++++++++ connect.hpp | 13 ++++++++++++- env.cpp | 2 ++ 3 files changed, 41 insertions(+), 1 deletion(-) Index: odbsequoia/src/connect.cpp diff -u odbsequoia/src/connect.cpp:1.18 odbsequoia/src/connect.cpp:1.19 --- odbsequoia/src/connect.cpp:1.18 Wed Mar 22 18:50:50 2006 +++ odbsequoia/src/connect.cpp Thu Mar 23 00:10:59 2006 @@ -153,6 +153,8 @@ SQLRETURN ODBCConnection::AllocStmt(SQLHANDLE * OutputHandle) { + // FIXME: leaking here when the application forgets + // to call SQLFreeHandle(STMT, newstmt) ODBCStatement * newstmt = new ODBCStatement(*this); newstmt->carob_stmt = carob_conn->createStatement(); newstmt->state = S1; @@ -160,6 +162,31 @@ return SQL_SUCCESS; } +SQLRETURN +SQLDisconnect(SQLHDBC ConnectionHandle) +{ + ODBCConnection * self_p = static_cast<ODBCConnection *>(ConnectionHandle); + self_p->clear_diags(); + + _PROTECT_SQLRETURN(self_p, disconnect()); +} + +SQLRETURN +ODBCConnection::disconnect() +{ + // TODO actually implement the spec, checking current state etc. + + // Warning: for the moment we are also called by the destructor, + // and so need to consider already closed or never connected carob + // connections. + if (carob_conn) { + delete carob_conn; + carob_conn = 0; + } + + return SQL_SUCCESS; +} + /* Index: odbsequoia/src/connect.hpp diff -u odbsequoia/src/connect.hpp:1.8 odbsequoia/src/connect.hpp:1.9 --- odbsequoia/src/connect.hpp:1.8 Mon Jan 23 13:00:44 2006 +++ odbsequoia/src/connect.hpp Thu Mar 23 00:10:59 2006 @@ -34,7 +34,10 @@ class ODBCConnection : public ODBCItem { public: - ODBCConnection(const ODBCEnv& creator) : ODBCItem(creator) { } ; + ODBCConnection(const ODBCEnv& creator) + : ODBCItem(creator), + carob_conn(0) + { } ; CarobNS::Connection* carob_conn; // TODO: rely on ConnectionParameters instead std::wstring serverhost; @@ -47,6 +50,14 @@ connectw(SQLWCHAR *sqlwdsn, SQLSMALLINT dsnlen, SQLWCHAR *user, SQLSMALLINT userlen, SQLWCHAR *pass, SQLSMALLINT passlen); + SQLRETURN + disconnect(); + + ~ODBCConnection() + { + disconnect(); + } + }; Index: odbsequoia/src/env.cpp diff -u odbsequoia/src/env.cpp:1.7 odbsequoia/src/env.cpp:1.8 --- odbsequoia/src/env.cpp:1.7 Tue Jan 17 16:36:54 2006 +++ odbsequoia/src/env.cpp Thu Mar 23 00:10:59 2006 @@ -58,6 +58,8 @@ SQLRETURN ODBCEnv::AllocConnect(SQLHANDLE * OutputHandle) { + // FIXME: leaking here when the application forgets + // to call SQLFreeHandle(DBC, newconn) ODBCConnection *newconn = new ODBCConnection(*this); *OutputHandle = newconn; return SQL_SUCCESS;
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | CVS update of odbsequoia (odbc.ini), marc-Tt5JLJuBijYiZlD9aYmxOGD2FQJk+8+b |
|---|---|
| Next by Date: | CVS update of odbsequoia (odbcinst.ini), marc-Tt5JLJuBijYiZlD9aYmxOGD2FQJk+8+b |
| Previous by Thread: | CVS update of odbsequoia (odbc.ini), marc-Tt5JLJuBijYiZlD9aYmxOGD2FQJk+8+b |
| Next by Thread: | CVS update of odbsequoia (odbcinst.ini), marc-Tt5JLJuBijYiZlD9aYmxOGD2FQJk+8+b |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
Free MagazinesCisco NewsReceive 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 |
Home
| advertise | OSDir is
an inevitable website.
|