8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-24 12:03:02 +01:00
This commit is contained in:
robocop 2006-05-04 02:57:26 +00:00
parent c66c73a0cc
commit 136cab1caf
5 changed files with 26 additions and 22 deletions

View File

@ -4597,11 +4597,10 @@ static dsql_req* prepare(
const TEXT* string,
USHORT client_dialect, USHORT parser_version)
{
ISC_STATUS_ARRAY local_status;
tsql* tdsql = DSQL_get_thread_data();
MOVE_CLEAR(local_status, sizeof(ISC_STATUS) * ISC_STATUS_LENGTH);
ISC_STATUS_ARRAY local_status;
MOVE_CLEAR(local_status, sizeof(local_status));
if (client_dialect > SQL_DIALECT_CURRENT)
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) - 901,

View File

@ -267,8 +267,6 @@ bool ERRD_post_warning(ISC_STATUS status, ...)
**/
void ERRD_post(ISC_STATUS status, ...)
{
int warning_indx = 0;
ISC_STATUS* status_vector = ((tsql*) DSQL_get_thread_data())->tsql_status;
// stuff the status into temp buffer
@ -277,7 +275,7 @@ void ERRD_post(ISC_STATUS status, ...)
STUFF_STATUS(tmp_status, status);
// calculate length of the status
int tmp_status_len = 0;
int tmp_status_len = 0, warning_indx = 0;
PARSE_STATUS(tmp_status, tmp_status_len, warning_indx);
fb_assert(warning_indx == 0);

View File

@ -454,17 +454,16 @@ static void internal_post(ISC_STATUS status, va_list args)
* Used in ERR_post and ERR_post_nothrow
*
**************************************/
ISC_STATUS_ARRAY tmp_status, warning_status;
int i, tmp_status_len = 0, status_len = 0, err_status_len = 0;
int warning_count = 0, warning_indx = 0;
ISC_STATUS* status_vector = ((thread_db*) JRD_get_thread_data())->tdbb_status_vector;
/* stuff the status into temp buffer */
ISC_STATUS_ARRAY tmp_status;
MOVE_CLEAR(tmp_status, sizeof(tmp_status));
STUFF_STATUS_function(tmp_status, status, args);
/* calculate length of the status */
int tmp_status_len = 0, warning_indx = 0;
PARSE_STATUS(tmp_status, tmp_status_len, warning_indx);
fb_assert(warning_indx == 0);
@ -478,11 +477,13 @@ static void internal_post(ISC_STATUS status, va_list args)
return;
}
int status_len = 0;
PARSE_STATUS(status_vector, status_len, warning_indx);
if (status_len)
--status_len;
/* check for duplicated error code */
int i;
for (i = 0; i < ISC_STATUS_LENGTH; i++) {
if (status_vector[i] == isc_arg_end && i == status_len)
break; /* end of argument list */
@ -502,9 +503,12 @@ static void internal_post(ISC_STATUS status, va_list args)
}
/* if the status_vector has only warnings then adjust err_status_len */
if ((err_status_len = i) == 2 && warning_indx)
int err_status_len = i;
if (err_status_len == 2 && warning_indx)
err_status_len = 0;
ISC_STATUS_ARRAY warning_status;
int warning_count = 0;
if (warning_indx) {
/* copy current warning(s) to a temp buffer */
MOVE_CLEAR(warning_status, sizeof(warning_status));

View File

@ -1241,11 +1241,6 @@ static IDX_E check_partner_index(
* record appears in the partner index.
*
**************************************/
index_desc partner_idx;
index_insertion insertion;
temporary_key key;
IndexRetrieval retrieval;
SET_TDBB(tdbb);
IDX_E result = idx_e_ok;
@ -1257,6 +1252,7 @@ static IDX_E check_partner_index(
/* get the description of the partner index */
index_desc partner_idx;
if (!BTR_description(tdbb, partner_relation, root, &partner_idx, index_id))
BUGCHECK(175); /* msg 175 partner index description not found */
@ -1284,6 +1280,7 @@ static IDX_E check_partner_index(
// unique index, because a comparison is done on both keys.
index_desc tmpIndex = *idx;
tmpIndex.idx_flags |= idx_unique;
temporary_key key;
result = BTR_key(tdbb, relation, record, &tmpIndex, &key, 0, fuzzy);
CCH_RELEASE(tdbb, &window);
@ -1293,6 +1290,7 @@ static IDX_E check_partner_index(
/* fill out a retrieval block for the purpose of
generating a bitmap of duplicate records */
IndexRetrieval retrieval;
MOVE_CLEAR(&retrieval, sizeof(IndexRetrieval));
//retrieval.blk_type = type_irb;
retrieval.irb_index = partner_idx.idx_id;
@ -1317,6 +1315,7 @@ static IDX_E check_partner_index(
/* if there is a bitmap, it means duplicates were found */
if (bitmap) {
index_insertion insertion;
insertion.iib_descriptor = &partner_idx;
insertion.iib_relation = partner_relation;
insertion.iib_number.setValue(BOF_NUMBER);

View File

@ -65,9 +65,7 @@ void CMD_UTIL_put_svc_status(ISC_STATUS* svc_status,
*
**************************************/
ISC_STATUS_ARRAY tmp_status, warning_status;
int i, tmp_status_len = 0, status_len = 0, err_status_len = 0;
int warning_count = 0, warning_indx = 0;
ISC_STATUS_ARRAY tmp_status;
bool duplicate = false;
/* stuff the status into temp buffer */
@ -76,7 +74,7 @@ void CMD_UTIL_put_svc_status(ISC_STATUS* svc_status,
ISC_STATUS *status = tmp_status;
*status++ = isc_arg_gds;
*status++ = ENCODE_ISC_MSG(errcode, facility);
tmp_status_len = 3;
int tmp_status_len = 3;
if (arg1) {
SVC_STATUS_ARG(status, arg1_t, arg1);
@ -108,11 +106,13 @@ void CMD_UTIL_put_svc_status(ISC_STATUS* svc_status,
MOVE_FASTER(tmp_status, svc_status, sizeof(ISC_STATUS) * tmp_status_len);
}
else {
int status_len = 0, warning_indx = 0;
PARSE_STATUS(svc_status, status_len, warning_indx);
if (status_len)
--status_len;
/* check for duplicated error code */
int i;
for (i = 0; i < ISC_STATUS_LENGTH; i++) {
if (svc_status[i] == isc_arg_end && i == status_len)
break; /* end of argument list */
@ -124,7 +124,8 @@ void CMD_UTIL_put_svc_status(ISC_STATUS* svc_status,
svc_status[i - 1] != isc_arg_warning &&
i + tmp_status_len - 2 < ISC_STATUS_LENGTH &&
(memcmp(&svc_status[i], &tmp_status[1],
sizeof(ISC_STATUS) * (tmp_status_len - 2)) == 0)) {
sizeof(ISC_STATUS) * (tmp_status_len - 2)) == 0))
{
/* duplicate found */
duplicate = true;
break;
@ -132,9 +133,12 @@ void CMD_UTIL_put_svc_status(ISC_STATUS* svc_status,
}
if (!duplicate) {
/* if the status_vector has only warnings then adjust err_status_len */
if ((err_status_len = i) == 2 && warning_indx)
int err_status_len = i;
if (err_status_len == 2 && warning_indx)
err_status_len = 0;
ISC_STATUS_ARRAY warning_status;
int warning_count = 0;
if (warning_indx) {
/* copy current warning(s) to a temp buffer */
MOVE_CLEAR(warning_status, sizeof(warning_status));