Changeset: f48869212f8e for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f48869212f8e
Modified Files:
        
Branch: default
Log Message:

Merged from Dec2011 branch.


diffs (126 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/SQLExecute.c b/clients/odbc/driver/SQLExecute.c
--- a/clients/odbc/driver/SQLExecute.c
+++ b/clients/odbc/driver/SQLExecute.c
@@ -392,7 +392,7 @@ SQLExecute_(ODBCStmt *stmt)
        }
 
        /* internal state correctness checks */
-       assert(stmt->ImplRowDescr->descRec != NULL);
+       assert(stmt->State == PREPARED0 || stmt->State == EXECUTED0 || 
stmt->ImplRowDescr->descRec != NULL);
 
        assert(stmt->Dbc);
        assert(stmt->Dbc->mid);
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;
@@ -133,7 +135,7 @@ SQLPrepare_(ODBCStmt *stmt,
 
                mapi_fetch_row(hdl);
                s = mapi_fetch_field(hdl, 5); /* column name: null -> param */
-               if (s == NULL) {
+               if (s == NULL || *s == 0) {
                        stmt->nparams++;
                        rec = prec++;
                        rec->sql_desc_nullable = SQL_NULLABLE;
diff --git 
a/sql/test/BugTracker/Tests/cardinality_violation.SF-1240701.stable.err 
b/sql/test/BugTracker/Tests/cardinality_violation.SF-1240701.stable.err
--- a/sql/test/BugTracker/Tests/cardinality_violation.SF-1240701.stable.err
+++ b/sql/test/BugTracker/Tests/cardinality_violation.SF-1240701.stable.err
@@ -85,7 +85,7 @@ QUERY = select * from env() as env where
 ERROR = !cardinality violation (21>1)
 MAPI  = monetdb@sofia:39182
 QUERY = select * from columns where name = (select columns.name from _tables, 
columns where _tables.id = columns.table_id);
-ERROR = !cardinality violation (316>1)
+ERROR = !cardinality violation (296>1)
 
 # 21:00:43 >  
 # 21:00:43 >  Done.
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to