Commit e666422e authored by Hiroshi Inoue's avatar Hiroshi Inoue

1)Allow the access to indexes with up to 16 keys.

2)Fix some memory leaks.
3)Change some bogus error messages.
parent 5490195f
...@@ -273,14 +273,16 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2 ...@@ -273,14 +273,16 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2
/* this is an array of eight integers */ /* this is an array of eight integers */
short *short_array = (short *) ( (char *) rgbValue + rgbValueOffset); short *short_array = (short *) ( (char *) rgbValue + rgbValueOffset);
len = 16; len = 32;
vp = value; vp = value;
nval = 0; nval = 0;
for (i = 0; i < 8; i++) mylog("index=(");
for (i = 0; i < 16; i++)
{ {
if (sscanf(vp, "%hd", &short_array[i]) != 1) if (sscanf(vp, "%hd", &short_array[i]) != 1)
break; break;
mylog(" %d", short_array[i]);
nval++; nval++;
/* skip the current token */ /* skip the current token */
...@@ -290,8 +292,9 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2 ...@@ -290,8 +292,9 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2
if (*vp == '\0') if (*vp == '\0')
break; break;
} }
mylog(") nval = %d\n", nval);
for (i = nval; i < 8; i++) for (i = nval; i < 16; i++)
{ {
short_array[i] = 0; short_array[i] = 0;
} }
......
...@@ -1761,7 +1761,7 @@ HSTMT hindx_stmt; ...@@ -1761,7 +1761,7 @@ HSTMT hindx_stmt;
RETCODE result; RETCODE result;
char *table_name; char *table_name;
char index_name[MAX_INFO_STRING]; char index_name[MAX_INFO_STRING];
short fields_vector[8]; short fields_vector[16];
char isunique[10], isclustered[10]; char isunique[10], isclustered[10];
SDWORD index_name_len, fields_vector_len; SDWORD index_name_len, fields_vector_len;
TupleNode *row; TupleNode *row;
...@@ -1924,7 +1924,7 @@ mylog("%s: entering...stmt=%u\n", func, stmt); ...@@ -1924,7 +1924,7 @@ mylog("%s: entering...stmt=%u\n", func, stmt);
} }
/* bind the vector column */ /* bind the vector column */
result = SQLBindCol(hindx_stmt, 2, SQL_C_DEFAULT, 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)) { if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
stmt->errormsg = indx_stmt->errormsg; /* "Couldn't bind column in SQLStatistics."; */ stmt->errormsg = indx_stmt->errormsg; /* "Couldn't bind column in SQLStatistics."; */
stmt->errornumber = indx_stmt->errornumber; stmt->errornumber = indx_stmt->errornumber;
...@@ -2003,7 +2003,7 @@ mylog("%s: entering...stmt=%u\n", func, stmt); ...@@ -2003,7 +2003,7 @@ mylog("%s: entering...stmt=%u\n", func, stmt);
(fUnique == SQL_INDEX_UNIQUE && atoi(isunique))) { (fUnique == SQL_INDEX_UNIQUE && atoi(isunique))) {
i = 0; i = 0;
/* add a row in this table for each field in the index */ /* 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) + row = (TupleNode *)malloc(sizeof(TupleNode) +
(13 - 1) * sizeof(TupleField)); (13 - 1) * sizeof(TupleField));
......
...@@ -311,6 +311,7 @@ QResultClass *res; ...@@ -311,6 +311,7 @@ QResultClass *res;
QR_set_message(self, "Error closing cursor."); QR_set_message(self, "Error closing cursor.");
return FALSE; return FALSE;
} }
QR_Destructor(res);
/* End the transaction if there are no cursors left on this conn */ /* End the transaction if there are no cursors left on this conn */
if (CC_cursor_count(self->conn) == 0) { if (CC_cursor_count(self->conn) == 0) {
...@@ -325,6 +326,7 @@ QResultClass *res; ...@@ -325,6 +326,7 @@ QResultClass *res;
QR_set_message(self, "Error ending transaction."); QR_set_message(self, "Error ending transaction.");
return FALSE; return FALSE;
} }
QR_Destructor(res);
} }
} }
......
...@@ -405,7 +405,7 @@ int len = 0, value = 0; ...@@ -405,7 +405,7 @@ int len = 0, value = 0;
if (icol >= cols) { if (icol >= cols) {
stmt->errornumber = STMT_INVALID_COLUMN_NUMBER_ERROR; 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); SC_log_error(func, "", stmt);
return SQL_ERROR; return SQL_ERROR;
} }
...@@ -442,7 +442,7 @@ int len = 0, value = 0; ...@@ -442,7 +442,7 @@ int len = 0, value = 0;
if (icol >= cols) { if (icol >= cols) {
stmt->errornumber = STMT_INVALID_COLUMN_NUMBER_ERROR; 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); SC_log_error(func, "", stmt);
return SQL_ERROR; return SQL_ERROR;
} }
......
...@@ -404,7 +404,8 @@ mylog("recycle statement: self= %u\n", self); ...@@ -404,7 +404,8 @@ mylog("recycle statement: self= %u\n", self);
conn = SC_get_conn(self); conn = SC_get_conn(self);
if ( ! CC_is_in_autocommit(conn) && CC_is_in_trans(conn)) { 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); CC_set_no_trans(conn);
} }
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment