Date: Friday, February 24, 2006 @ 16:05:31
Author: marc
Path: /cvsroot/carob/odbsequoia/src
Modified: explicit_type.cpp (1.6 -> 1.7)
Implemented SQLFreeHandle (simply calling destructor).
Using objectify() instead of static_cast<ODBCItem* > directly. Now objectifying
also descriptor handles.
Returning SQL_INVALID_HANDLE instead of SQL_ERROR.
-------------------+
explicit_type.cpp | 32 ++++++++++++++++++++++----------
1 files changed, 22 insertions(+), 10 deletions(-)
Index: odbsequoia/src/explicit_type.cpp
diff -u odbsequoia/src/explicit_type.cpp:1.6
odbsequoia/src/explicit_type.cpp:1.7
--- odbsequoia/src/explicit_type.cpp:1.6 Tue Jan 17 16:36:54 2006
+++ odbsequoia/src/explicit_type.cpp Fri Feb 24 16:05:31 2006
@@ -40,15 +40,13 @@
switch (HandleType)
{
case SQL_HANDLE_DESC:
- return NULL; // TODO
-
case SQL_HANDLE_ENV:
case SQL_HANDLE_DBC:
case SQL_HANDLE_STMT:
+ // We don't expect the driver manager to give us corrupted handles
return static_cast<ODBCItem *>(Handle);
-
default:
- return NULL; // TODO: invalid handletype
+ return NULL;
}
}
@@ -61,7 +59,7 @@
SQLHANDLE * OutputHandle)
{
if (SQL_HANDLE_ENV != HandleType)
- static_cast<ODBCItem *>(InputHandle)->clear_diags();
+ objectify(HandleType, InputHandle)->clear_diags();
switch (HandleType)
{
@@ -81,7 +79,7 @@
return SQL_ERROR;
default:
- return SQL_ERROR;
+ return SQL_INVALID_HANDLE; // TODO: need to push_diags sthing?
}
}
@@ -93,11 +91,25 @@
SQLFreeHandle(SQLSMALLINT HandleType, SQLHANDLE Handle)
{
// "If SQLFreeHandle returns SQL_ERROR, the handle is still valid."
- static_cast<ODBCItem *>(Handle)->clear_diags();
+ objectify(HandleType, Handle)->clear_diags();
+
+ switch (HandleType)
+ {
+
+ case SQL_HANDLE_ENV:
+ case SQL_HANDLE_DBC:
+ case SQL_HANDLE_STMT:
+ delete objectify(HandleType, Handle);
+ return SQL_SUCCESS;
+
+ case SQL_HANDLE_DESC:
+ // we don't support user allocated descriptors yet
+ // TODO: push_diags(HY017)
+ return SQL_ERROR;
- SQLRETURN ret = SQL_SUCCESS;
- // FIXME: leaking
- return ret;
+ default:
+ return SQL_INVALID_HANDLE;
+ }
}
SQLRETURN
_______________________________________________
Carob-commits mailing list
[email protected]
https://forge.continuent.org/mailman/listinfo/carob-commits