Changeset: 83a7d5587619 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=83a7d5587619
Modified Files:
clients/Tests/exports.stable.out
clients/mapilib/mapi.c
clients/mapilib/mapi.h
clients/odbc/driver/SQLEndTran.c
clients/odbc/driver/SQLPrepare.c
Branch: Dec2011
Log Message:
ODBC: Implemented releasing of prepared queries.
diffs (93 lines):
diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out
--- a/clients/Tests/exports.stable.out
+++ b/clients/Tests/exports.stable.out
@@ -516,6 +516,7 @@ MapiMsg mapi_quick_response(MapiHdl hdl,
char *mapi_quote(const char *msg, int size);
MapiMsg mapi_read_response(MapiHdl hdl);
MapiMsg mapi_reconnect(Mapi mid);
+MapiMsg mapi_release_id(Mapi mid, int id);
char **mapi_resolve(const char *host, int port, const char *pattern);
char *mapi_result_error(MapiHdl hdl);
mapi_int64 mapi_rows_affected(MapiHdl hdl);
diff --git a/clients/mapilib/mapi.c b/clients/mapilib/mapi.c
--- a/clients/mapilib/mapi.c
+++ b/clients/mapilib/mapi.c
@@ -3058,11 +3058,13 @@ mapi_timeout(Mapi mid, int timeout)
}
static MapiMsg
-mapi_Xcommand(Mapi mid, char *cmdname, char *cmdvalue)
+mapi_Xcommand(Mapi mid, const char *cmdname, const char *cmdvalue)
{
MapiHdl hdl;
mapi_check(mid, "mapi_Xcommand");
+ if (mid->active && read_into_cache(mid->active, 0) != MOK)
+ return MERROR;
if (mnstr_printf(mid->to, "X" "%s %s\n", cmdname, cmdvalue) < 0 ||
mnstr_flush(mid->to)) {
close_connection(mid);
@@ -3410,7 +3412,7 @@ MapiMsg
mapi_set_size_header(Mapi mid, int value)
{
if (mid->languageId != LANG_SQL) {
- mapi_setError(mid, "size header only supported in SQL",
"mapi_toggle_size_header", MERROR);
+ mapi_setError(mid, "size header only supported in SQL",
"mapi_set_size_header", MERROR);
return MERROR;
}
if (value)
@@ -3420,6 +3422,19 @@ mapi_set_size_header(Mapi mid, int value
}
MapiMsg
+mapi_release_id(Mapi mid, int id)
+{
+ char buf[10];
+
+ if (mid->languageId != LANG_SQL) {
+ mapi_setError(mid, "release only supported in SQL",
"mapi_release_id", MERROR);
+ return MERROR;
+ }
+ snprintf(buf, sizeof(buf), "%d", id);
+ return mapi_Xcommand(mid, "release", buf);
+}
+
+MapiMsg
mapi_trace(Mapi mid, int flag)
{
mapi_clrError(mid);
diff --git a/clients/mapilib/mapi.h b/clients/mapilib/mapi.h
--- a/clients/mapilib/mapi.h
+++ b/clients/mapilib/mapi.h
@@ -166,6 +166,7 @@ mapi_export int mapi_get_autocommit(Mapi
mapi_export MapiMsg mapi_log(Mapi mid, const char *nme);
mapi_export MapiMsg mapi_setAutocommit(Mapi mid, int autocommit);
mapi_export MapiMsg mapi_set_size_header(Mapi mid, int value);
+mapi_export MapiMsg mapi_release_id(Mapi mid, int id);
mapi_export char *mapi_result_error(MapiHdl hdl);
mapi_export MapiMsg mapi_next_result(MapiHdl hdl);
mapi_export MapiMsg mapi_needmore(MapiHdl hdl);
diff --git a/clients/odbc/driver/SQLEndTran.c b/clients/odbc/driver/SQLEndTran.c
--- a/clients/odbc/driver/SQLEndTran.c
+++ b/clients/odbc/driver/SQLEndTran.c
@@ -158,7 +158,7 @@ SQLEndTran_(SQLSMALLINT HandleType,
nativeErrCode);
}
/* clean up the statement handle */
- SQLFreeStmt_(stmt, SQL_CLOSE);
+ ODBCResetStmt(stmt);
ODBCFreeStmt_(stmt);
for (stmt = dbc->FirstStmt; stmt; stmt = stmt->next)
diff --git a/clients/odbc/driver/SQLPrepare.c b/clients/odbc/driver/SQLPrepare.c
--- a/clients/odbc/driver/SQLPrepare.c
+++ b/clients/odbc/driver/SQLPrepare.c
@@ -47,6 +47,8 @@ ODBCResetStmt(ODBCStmt *stmt)
SQLFreeStmt_(stmt, SQL_CLOSE);
setODBCDescRecCount(stmt->ImplParamDescr, 0);
+ if (stmt->queryid >= 0)
+ mapi_release_id(stmt->Dbc->mid, stmt->queryid);
stmt->queryid = -1;
stmt->nparams = 0;
stmt->State = INITED;
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list