From e666422ebf51b9433db1f413af38962a0937a69e Mon Sep 17 00:00:00 2001 From: Hiroshi Inoue Date: Sat, 10 Mar 2001 03:34:57 +0000 Subject: [PATCH] 1)Allow the access to indexes with up to 16 keys. 2)Fix some memory leaks. 3)Change some bogus error messages. --- src/interfaces/odbc/convert.c | 9 ++++++--- src/interfaces/odbc/info.c | 6 +++--- src/interfaces/odbc/qresult.c | 2 ++ src/interfaces/odbc/results.c | 4 ++-- src/interfaces/odbc/statement.c | 3 ++- 5 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/interfaces/odbc/convert.c b/src/interfaces/odbc/convert.c index 47b1882dfb..0d8ada3256 100644 --- a/src/interfaces/odbc/convert.c +++ b/src/interfaces/odbc/convert.c @@ -273,14 +273,16 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2 /* this is an array of eight integers */ short *short_array = (short *) ( (char *) rgbValue + rgbValueOffset); - len = 16; + len = 32; vp = value; nval = 0; - for (i = 0; i < 8; i++) +mylog("index=("); + for (i = 0; i < 16; i++) { if (sscanf(vp, "%hd", &short_array[i]) != 1) break; +mylog(" %d", short_array[i]); nval++; /* skip the current token */ @@ -290,8 +292,9 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2 if (*vp == '\0') break; } +mylog(") nval = %d\n", nval); - for (i = nval; i < 8; i++) + for (i = nval; i < 16; i++) { short_array[i] = 0; } diff --git a/src/interfaces/odbc/info.c b/src/interfaces/odbc/info.c index bf43d6522b..685248eeb7 100644 --- a/src/interfaces/odbc/info.c +++ b/src/interfaces/odbc/info.c @@ -1761,7 +1761,7 @@ HSTMT hindx_stmt; RETCODE result; char *table_name; char index_name[MAX_INFO_STRING]; -short fields_vector[8]; +short fields_vector[16]; char isunique[10], isclustered[10]; SDWORD index_name_len, fields_vector_len; TupleNode *row; @@ -1924,7 +1924,7 @@ mylog("%s: entering...stmt=%u\n", func, stmt); } /* bind the vector column */ result = SQLBindCol(hindx_stmt, 2, SQL_C_DEFAULT, - fields_vector, 16, &fields_vector_len); + fields_vector, 32, &fields_vector_len); if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) { stmt->errormsg = indx_stmt->errormsg; /* "Couldn't bind column in SQLStatistics."; */ stmt->errornumber = indx_stmt->errornumber; @@ -2003,7 +2003,7 @@ mylog("%s: entering...stmt=%u\n", func, stmt); (fUnique == SQL_INDEX_UNIQUE && atoi(isunique))) { i = 0; /* add a row in this table for each field in the index */ - while(i < 8 && fields_vector[i] != 0) { + while(i < 16 && fields_vector[i] != 0) { row = (TupleNode *)malloc(sizeof(TupleNode) + (13 - 1) * sizeof(TupleField)); diff --git a/src/interfaces/odbc/qresult.c b/src/interfaces/odbc/qresult.c index 56641d36b5..2f17c64334 100644 --- a/src/interfaces/odbc/qresult.c +++ b/src/interfaces/odbc/qresult.c @@ -311,6 +311,7 @@ QResultClass *res; QR_set_message(self, "Error closing cursor."); return FALSE; } + QR_Destructor(res); /* End the transaction if there are no cursors left on this conn */ if (CC_cursor_count(self->conn) == 0) { @@ -325,6 +326,7 @@ QResultClass *res; QR_set_message(self, "Error ending transaction."); return FALSE; } + QR_Destructor(res); } } diff --git a/src/interfaces/odbc/results.c b/src/interfaces/odbc/results.c index 8ef3936a8a..b4eedda79d 100644 --- a/src/interfaces/odbc/results.c +++ b/src/interfaces/odbc/results.c @@ -405,7 +405,7 @@ int len = 0, value = 0; if (icol >= cols) { stmt->errornumber = STMT_INVALID_COLUMN_NUMBER_ERROR; - stmt->errormsg = "Invalid column number in DescribeCol."; + stmt->errormsg = "Invalid column number in ColAttributes."; SC_log_error(func, "", stmt); return SQL_ERROR; } @@ -442,7 +442,7 @@ int len = 0, value = 0; if (icol >= cols) { stmt->errornumber = STMT_INVALID_COLUMN_NUMBER_ERROR; - stmt->errormsg = "Invalid column number in DescribeCol."; + stmt->errormsg = "Invalid column number in ColAttributes."; SC_log_error(func, "", stmt); return SQL_ERROR; } diff --git a/src/interfaces/odbc/statement.c b/src/interfaces/odbc/statement.c index 8a8d5523ad..6c0d855217 100644 --- a/src/interfaces/odbc/statement.c +++ b/src/interfaces/odbc/statement.c @@ -404,7 +404,8 @@ mylog("recycle statement: self= %u\n", self); conn = SC_get_conn(self); if ( ! CC_is_in_autocommit(conn) && CC_is_in_trans(conn)) { - CC_send_query(conn, "ABORT", NULL); + QResultClass *res = CC_send_query(conn, "ABORT", NULL); + QR_Destructor(res); CC_set_no_trans(conn); } break; -- 2.40.0