8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 15:23:02 +01:00

Macro cleaning

This commit is contained in:
brodsom 2004-05-12 00:02:37 +00:00
parent 8e024477a8
commit b30a0b8799
27 changed files with 422 additions and 259 deletions

View File

@ -1496,9 +1496,9 @@ static void gen_descriptor( dsql_req* request, const dsc* desc, bool texttype)
case dtype_text: case dtype_text:
if (request->req_dbb->dbb_flags & DBB_v3) if (request->req_dbb->dbb_flags & DBB_v3)
stuff(request, blr_text); stuff(request, blr_text);
else if (texttype || desc->dsc_ttype == ttype_binary) { else if (texttype || desc->dsc_sub_type == ttype_binary) {
stuff(request, blr_text2); stuff(request, blr_text2);
stuff_word(request, desc->dsc_ttype); stuff_word(request, desc->dsc_sub_type);
} }
else { else {
stuff(request, blr_text2); // automatic transliteration stuff(request, blr_text2); // automatic transliteration
@ -1511,9 +1511,9 @@ static void gen_descriptor( dsql_req* request, const dsc* desc, bool texttype)
case dtype_varying: case dtype_varying:
if (request->req_dbb->dbb_flags & DBB_v3) if (request->req_dbb->dbb_flags & DBB_v3)
stuff(request, blr_varying); stuff(request, blr_varying);
else if (texttype || desc->dsc_ttype == ttype_binary) { else if (texttype || desc->dsc_sub_type == ttype_binary) {
stuff(request, blr_varying2); stuff(request, blr_varying2);
stuff_word(request, desc->dsc_ttype); stuff_word(request, desc->dsc_sub_type);
} }
else { else {
stuff(request, blr_varying2); // automatic transliteration stuff(request, blr_varying2); // automatic transliteration
@ -2492,7 +2492,7 @@ static void gen_select( dsql_req* request, dsql_nod* rse)
MAKE_parameter(request->req_receive, false, false, 0); MAKE_parameter(request->req_receive, false, false, 0);
parameter->par_dbkey_ctx = context; parameter->par_dbkey_ctx = context;
parameter->par_desc.dsc_dtype = dtype_text; parameter->par_desc.dsc_dtype = dtype_text;
parameter->par_desc.dsc_ttype = ttype_binary; parameter->par_desc.dsc_sub_type = ttype_binary;
parameter->par_desc.dsc_length = parameter->par_desc.dsc_length =
relation->rel_dbkey_length; relation->rel_dbkey_length;
@ -2504,7 +2504,7 @@ static void gen_select( dsql_req* request, dsql_nod* rse)
false, 0); false, 0);
parameter->par_rec_version_ctx = context; parameter->par_rec_version_ctx = context;
parameter->par_desc.dsc_dtype = dtype_text; parameter->par_desc.dsc_dtype = dtype_text;
parameter->par_desc.dsc_ttype = ttype_binary; parameter->par_desc.dsc_sub_type = ttype_binary;
parameter->par_desc.dsc_length = parameter->par_desc.dsc_length =
relation->rel_dbkey_length / 2; relation->rel_dbkey_length / 2;
} }

View File

@ -119,7 +119,7 @@ dsql_nod* MAKE_constant(dsql_str* constant, dsql_constant_type numeric_flag)
node->nod_desc.dsc_sub_type = 0; node->nod_desc.dsc_sub_type = 0;
node->nod_desc.dsc_length = sizeof(double); node->nod_desc.dsc_length = sizeof(double);
node->nod_desc.dsc_address = (UCHAR*) constant->str_data; node->nod_desc.dsc_address = (UCHAR*) constant->str_data;
node->nod_desc.dsc_ttype = ttype_ascii; node->nod_desc.dsc_sub_type = ttype_ascii;
node->nod_arg[0] = (dsql_nod*) constant; node->nod_arg[0] = (dsql_nod*) constant;
break; break;
@ -189,7 +189,7 @@ dsql_nod* MAKE_constant(dsql_str* constant, dsql_constant_type numeric_flag)
tmp.dsc_dtype = dtype_text; tmp.dsc_dtype = dtype_text;
tmp.dsc_scale = 0; tmp.dsc_scale = 0;
tmp.dsc_flags = 0; tmp.dsc_flags = 0;
tmp.dsc_ttype = ttype_ascii; tmp.dsc_sub_type = ttype_ascii;
tmp.dsc_length = static_cast<USHORT>(constant->str_length); tmp.dsc_length = static_cast<USHORT>(constant->str_length);
tmp.dsc_address = (UCHAR*) constant->str_data; tmp.dsc_address = (UCHAR*) constant->str_data;
@ -209,7 +209,7 @@ dsql_nod* MAKE_constant(dsql_str* constant, dsql_constant_type numeric_flag)
node->nod_desc.dsc_length = node->nod_desc.dsc_length =
static_cast<USHORT>(constant->str_length); static_cast<USHORT>(constant->str_length);
node->nod_desc.dsc_address = (UCHAR*) constant->str_data; node->nod_desc.dsc_address = (UCHAR*) constant->str_data;
node->nod_desc.dsc_ttype = ttype_dynamic; node->nod_desc.dsc_sub_type = ttype_dynamic;
// carry a pointer to the constant to resolve character set in pass1 // carry a pointer to the constant to resolve character set in pass1
node->nod_arg[0] = (dsql_nod*) constant; node->nod_arg[0] = (dsql_nod*) constant;
break; break;
@ -245,7 +245,7 @@ dsql_nod* MAKE_str_constant(dsql_str* constant, SSHORT character_set)
node->nod_desc.dsc_scale = 0; node->nod_desc.dsc_scale = 0;
node->nod_desc.dsc_length = static_cast<USHORT>(constant->str_length); node->nod_desc.dsc_length = static_cast<USHORT>(constant->str_length);
node->nod_desc.dsc_address = (UCHAR*) constant->str_data; node->nod_desc.dsc_address = (UCHAR*) constant->str_data;
node->nod_desc.dsc_ttype = character_set; node->nod_desc.dsc_sub_type = character_set;
// carry a pointer to the constant to resolve character set in pass1 // carry a pointer to the constant to resolve character set in pass1
node->nod_arg[0] = (dsql_nod*) constant; node->nod_arg[0] = (dsql_nod*) constant;
@ -383,9 +383,9 @@ void MAKE_desc(dsc* desc, dsql_nod* node)
desc->dsc_scale = 0; desc->dsc_scale = 0;
desc->dsc_dtype = dtype_varying; desc->dsc_dtype = dtype_varying;
if (desc1.dsc_dtype <= dtype_any_text) if (desc1.dsc_dtype <= dtype_any_text)
desc->dsc_ttype = desc1.dsc_ttype; desc->dsc_sub_type = desc1.dsc_sub_type;
else else
desc->dsc_ttype = ttype_ascii; desc->dsc_sub_type = ttype_ascii;
ULONG length = sizeof(USHORT) + ULONG length = sizeof(USHORT) +
DSC_string_length(&desc1) + DSC_string_length(&desc2); DSC_string_length(&desc1) + DSC_string_length(&desc2);
if (length > MAX_SSHORT) { if (length > MAX_SSHORT) {
@ -422,7 +422,7 @@ void MAKE_desc(dsc* desc, dsql_nod* node)
dsql_nod* for_node = node->nod_arg[e_substr_length]; dsql_nod* for_node = node->nod_arg[e_substr_length];
fb_assert (for_node->nod_desc.dsc_dtype == dtype_long); fb_assert (for_node->nod_desc.dsc_dtype == dtype_long);
// Migrate the charset from the blob to the string. // Migrate the charset from the blob to the string.
desc->dsc_ttype = desc1.dsc_scale; desc->dsc_sub_type = desc1.dsc_scale;
const SLONG len = *(SLONG *) for_node->nod_desc.dsc_address; const SLONG len = *(SLONG *) for_node->nod_desc.dsc_address;
/* For now, our substring() doesn't handle MBCS blobs, /* For now, our substring() doesn't handle MBCS blobs,
neither at the DSQL layer nor at the JRD layer. */ neither at the DSQL layer nor at the JRD layer. */
@ -439,7 +439,7 @@ void MAKE_desc(dsc* desc, dsql_nod* node)
} }
} }
else { else {
desc->dsc_ttype = ttype_ascii; desc->dsc_sub_type = ttype_ascii;
desc->dsc_length = sizeof (USHORT) + DSC_string_length (&desc1); desc->dsc_length = sizeof (USHORT) + DSC_string_length (&desc1);
} }
desc->dsc_flags = desc1.dsc_flags & DSC_nullable; desc->dsc_flags = desc1.dsc_flags & DSC_nullable;
@ -912,7 +912,7 @@ void MAKE_desc(dsc* desc, dsql_nod* node)
desc->dsc_dtype = dtype_text; desc->dsc_dtype = dtype_text;
desc->dsc_length = relation->rel_dbkey_length; desc->dsc_length = relation->rel_dbkey_length;
desc->dsc_flags = 0; desc->dsc_flags = 0;
desc->dsc_ttype = ttype_binary; desc->dsc_sub_type = ttype_binary;
} }
else { else {
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) - 607, ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) - 607,
@ -932,10 +932,10 @@ void MAKE_desc(dsc* desc, dsql_nod* node)
desc->dsc_flags = DSC_nullable; desc->dsc_flags = DSC_nullable;
if (desc->dsc_dtype <= dtype_any_text) { if (desc->dsc_dtype <= dtype_any_text) {
desc->dsc_ttype = userFunc->udf_character_set_id; desc->dsc_sub_type = userFunc->udf_character_set_id;
} }
else { else {
desc->dsc_ttype = userFunc->udf_sub_type; desc->dsc_sub_type = userFunc->udf_sub_type;
} }
return; return;
} }
@ -982,7 +982,7 @@ void MAKE_desc(dsc* desc, dsql_nod* node)
desc->dsc_dtype = dtype_varying; desc->dsc_dtype = dtype_varying;
desc->dsc_scale = 0; desc->dsc_scale = 0;
desc->dsc_flags = 0; desc->dsc_flags = 0;
desc->dsc_ttype = ttype_dynamic; desc->dsc_sub_type = ttype_dynamic;
desc->dsc_length = USERNAME_LENGTH + sizeof(USHORT); desc->dsc_length = USERNAME_LENGTH + sizeof(USHORT);
return; return;
@ -1060,7 +1060,7 @@ void MAKE_desc(dsc* desc, dsql_nod* node)
desc->dsc_dtype = dtype_text; desc->dsc_dtype = dtype_text;
desc->dsc_length = 1; desc->dsc_length = 1;
desc->dsc_scale = 0; desc->dsc_scale = 0;
desc->dsc_ttype = 0; desc->dsc_sub_type = 0;
desc->dsc_flags = DSC_nullable; desc->dsc_flags = DSC_nullable;
return; return;
@ -1277,11 +1277,11 @@ void MAKE_desc_from_list(dsc* desc, dsql_nod* node, const TEXT* expression_name)
// //
// At least give any first charset other then ASCII/NONE precedence // At least give any first charset other then ASCII/NONE precedence
if (!any_text) { if (!any_text) {
ttype = desc1.dsc_ttype; ttype = desc1.dsc_sub_type;
} }
else { else {
if ((ttype == ttype_none) || (ttype == ttype_ascii)) { if ((ttype == ttype_none) || (ttype == ttype_ascii)) {
ttype = desc1.dsc_ttype; ttype = desc1.dsc_sub_type;
} }
} }
any_text = true; any_text = true;
@ -1370,7 +1370,7 @@ void MAKE_desc_from_list(dsc* desc, dsql_nod* node, const TEXT* expression_name)
else { else {
desc->dsc_dtype = dtype_text; desc->dsc_dtype = dtype_text;
} }
desc->dsc_ttype = ttype; // same as dsc_subtype desc->dsc_sub_type = ttype; // same as dsc_subtype
desc->dsc_length = maxtextlength; desc->dsc_length = maxtextlength;
desc->dsc_scale = 0; desc->dsc_scale = 0;
return; return;

View File

@ -1030,7 +1030,7 @@ dsql_udf* METD_get_function(dsql_req* request, const dsql_str* name)
if (!X.RDB$CHARACTER_SET_ID.NULL) { if (!X.RDB$CHARACTER_SET_ID.NULL) {
if (d->dsc_dtype != dtype_blob) { if (d->dsc_dtype != dtype_blob) {
d->dsc_ttype = X.RDB$CHARACTER_SET_ID; d->dsc_sub_type = X.RDB$CHARACTER_SET_ID;
} }
else { else {
d->dsc_scale = X.RDB$CHARACTER_SET_ID; d->dsc_scale = X.RDB$CHARACTER_SET_ID;

View File

@ -3004,7 +3004,7 @@ static void pass1_blob( dsql_req* request, dsql_nod* input)
dsql_par* parameter = MAKE_parameter(blob->blb_segment_msg, true, true, 0); dsql_par* parameter = MAKE_parameter(blob->blb_segment_msg, true, true, 0);
blob->blb_segment = parameter; blob->blb_segment = parameter;
parameter->par_desc.dsc_dtype = dtype_text; parameter->par_desc.dsc_dtype = dtype_text;
parameter->par_desc.dsc_ttype = ttype_binary; parameter->par_desc.dsc_sub_type = ttype_binary;
parameter->par_desc.dsc_length = parameter->par_desc.dsc_length =
((dsql_fld*) field->nod_arg[e_fld_field])->fld_seg_length; ((dsql_fld*) field->nod_arg[e_fld_field])->fld_seg_length;
DEV_BLKCHK(field->nod_arg[e_fld_field], dsql_type_fld); DEV_BLKCHK(field->nod_arg[e_fld_field], dsql_type_fld);
@ -7088,7 +7088,7 @@ static bool set_parameter_type(dsql_nod* in_node, dsql_nod* node, bool force_var
parameter->par_desc.dsc_length = LIKE_PARAM_LEN + sizeof(USHORT); parameter->par_desc.dsc_length = LIKE_PARAM_LEN + sizeof(USHORT);
parameter->par_desc.dsc_sub_type = 0; parameter->par_desc.dsc_sub_type = 0;
parameter->par_desc.dsc_scale = 0; parameter->par_desc.dsc_scale = 0;
parameter->par_desc.dsc_ttype = ttype_dynamic; parameter->par_desc.dsc_sub_type = ttype_dynamic;
} }
} }
return true; return true;

View File

@ -1242,7 +1242,7 @@ static void add_global_field( DUDLEY_FLD field)
field->fld_length = desc.dsc_length; field->fld_length = desc.dsc_length;
if (DTYPE_IS_TEXT(make_dtype(desc.dsc_dtype))) { if (DTYPE_IS_TEXT(make_dtype(desc.dsc_dtype))) {
field->fld_scale = 0; field->fld_scale = 0;
field->fld_sub_type = desc.dsc_ttype; field->fld_sub_type = desc.dsc_sub_type;
field->fld_has_sub_type = TRUE; field->fld_has_sub_type = TRUE;
} }
else { else {
@ -3169,10 +3169,10 @@ static void make_desc( DUDLEY_NOD node, DSC * desc)
dtype = make_dtype(desc1.dsc_dtype); dtype = make_dtype(desc1.dsc_dtype);
if (dtype > dtype_any_text) { if (dtype > dtype_any_text) {
desc1.dsc_length = string_length(dtype); desc1.dsc_length = string_length(dtype);
desc->dsc_ttype = ttype_ascii; desc->dsc_sub_type = ttype_ascii;
} }
else else
desc->dsc_ttype = desc1.dsc_ttype; desc->dsc_sub_type = desc1.dsc_sub_type;
dtype = make_dtype(desc2.dsc_dtype); dtype = make_dtype(desc2.dsc_dtype);
if (dtype > dtype_any_text) if (dtype > dtype_any_text)
desc2.dsc_length = string_length(dtype); desc2.dsc_length = string_length(dtype);
@ -3188,7 +3188,7 @@ static void make_desc( DUDLEY_NOD node, DSC * desc)
desc->dsc_scale = field->fld_scale; desc->dsc_scale = field->fld_scale;
desc->dsc_sub_type = 0; desc->dsc_sub_type = 0;
if (DTYPE_IS_TEXT(make_dtype(desc->dsc_dtype))) if (DTYPE_IS_TEXT(make_dtype(desc->dsc_dtype)))
desc->dsc_ttype = field->fld_sub_type; desc->dsc_sub_type = field->fld_sub_type;
return; return;
case nod_literal: case nod_literal:
@ -3260,7 +3260,7 @@ static void make_desc( DUDLEY_NOD node, DSC * desc)
desc->dsc_scale = arg->funcarg_scale; desc->dsc_scale = arg->funcarg_scale;
desc->dsc_sub_type = 0; desc->dsc_sub_type = 0;
if (DTYPE_IS_TEXT(make_dtype(desc->dsc_dtype))) if (DTYPE_IS_TEXT(make_dtype(desc->dsc_dtype)))
desc->dsc_ttype = arg->funcarg_sub_type; desc->dsc_sub_type = arg->funcarg_sub_type;
return; return;
case nod_fid: case nod_fid:

View File

@ -394,7 +394,7 @@ static CON make_numeric_constant( TEXT * string, USHORT length)
length++; length++;
constant = (CON) DDL_alloc(sizeof(con) + length); constant = (CON) DDL_alloc(sizeof(con) + length);
constant->con_desc.dsc_dtype = dtype_text; constant->con_desc.dsc_dtype = dtype_text;
constant->con_desc.dsc_ttype = ttype_ascii; constant->con_desc.dsc_sub_type = ttype_ascii;
constant->con_desc.dsc_length = length; constant->con_desc.dsc_length = length;
constant->con_desc.dsc_address = constant->con_data; constant->con_desc.dsc_address = constant->con_data;
q = (TEXT *) constant->con_desc.dsc_address; q = (TEXT *) constant->con_desc.dsc_address;
@ -670,7 +670,7 @@ static CON parse_literal(void)
l -= 2; l -= 2;
constant = (CON) DDL_alloc(sizeof(con) + l); constant = (CON) DDL_alloc(sizeof(con) + l);
constant->con_desc.dsc_dtype = dtype_text; constant->con_desc.dsc_dtype = dtype_text;
constant->con_desc.dsc_ttype = ttype_ascii; constant->con_desc.dsc_sub_type = ttype_ascii;
p = (TEXT *) constant->con_data; p = (TEXT *) constant->con_data;
constant->con_desc.dsc_address = (UCHAR*) p; constant->con_desc.dsc_address = (UCHAR*) p;
if (constant->con_desc.dsc_length = l) if (constant->con_desc.dsc_length = l)

View File

@ -350,8 +350,8 @@ FBUDF_API paramdsc* sNullIf(paramdsc* v, paramdsc* v2, paramdsc* rc)
if (len < 0 || len2 < 0) // good luck with the result, we can't do more. if (len < 0 || len2 < 0) // good luck with the result, we can't do more.
return v; return v;
if (len == len2 && (!len || !memcmp(sv, sv2, len)) && if (len == len2 && (!len || !memcmp(sv, sv2, len)) &&
(v->dsc_ttype == v2->dsc_ttype || (v->dsc_sub_type == v2->dsc_sub_type ||
!v->dsc_ttype || !v2->dsc_ttype)) !v->dsc_sub_type || !v2->dsc_sub_type))
{ {
return internal::setnull(rc); return internal::setnull(rc);
} }

View File

@ -33,7 +33,7 @@
* *
*/ */
/* /*
$Id: blb.cpp,v 1.74 2004-05-09 05:47:57 robocop Exp $ $Id: blb.cpp,v 1.75 2004-05-12 00:02:05 brodsom Exp $
*/ */
#include "firebird.h" #include "firebird.h"
@ -991,7 +991,7 @@ void BLB_move_from_string(thread_db* tdbb, const dsc* from_desc, dsc* to_desc, j
calculates charset internally and assigns it to fields inside blb struct. calculates charset internally and assigns it to fields inside blb struct.
I really need to call BLB_create2 and provide more parameters. I really need to call BLB_create2 and provide more parameters.
This macro is useless here as it doesn't cater for blob fields because This macro is useless here as it doesn't cater for blob fields because
desc.dsc_ttype is desc.dsc_sub_type but blobs use dsc_scale for the charset desc.dsc_sub_type is desc.dsc_sub_type but blobs use dsc_scale for the charset
and dsc_sub_type for blob sub_types, IE text. and dsc_sub_type for blob sub_types, IE text.
INTL_ASSIGN_TTYPE (&blob_desc, ttype); INTL_ASSIGN_TTYPE (&blob_desc, ttype);
*/ */

View File

@ -1941,7 +1941,7 @@ static void compress(thread_db* tdbb,
to.dsc_flags = 0; to.dsc_flags = 0;
to.dsc_sub_type = 0; to.dsc_sub_type = 0;
to.dsc_scale = 0; to.dsc_scale = 0;
to.dsc_ttype = ttype_sort_key; to.dsc_sub_type = ttype_sort_key;
to.dsc_length = sizeof(temp1); to.dsc_length = sizeof(temp1);
ptr = to.dsc_address = temp1; ptr = to.dsc_address = temp1;
length = INTL_string_to_key(tdbb, itype, desc, &to, fuzzy); length = INTL_string_to_key(tdbb, itype, desc, &to, fuzzy);
@ -2515,7 +2515,7 @@ static DSC *eval(thread_db* tdbb, jrd_nod* node, DSC * temp, bool *isNull)
temp->dsc_sub_type = 0; temp->dsc_sub_type = 0;
temp->dsc_scale = 0; temp->dsc_scale = 0;
temp->dsc_length = 1; temp->dsc_length = 1;
temp->dsc_ttype = ttype_ascii; temp->dsc_sub_type = ttype_ascii;
temp->dsc_address = (UCHAR*) " "; temp->dsc_address = (UCHAR*) " ";
return temp; return temp;

View File

@ -103,12 +103,19 @@ rel_MAX} RIDS;
* contexts where it makes sense. This macro checks a descriptor to * contexts where it makes sense. This macro checks a descriptor to
* see if it is something that *could* represent a date value * see if it is something that *could* represent a date value
*/ */
#define COULD_BE_DATE(d) ((DTYPE_IS_DATE((d).dsc_dtype)) || ((d).dsc_dtype <= dtype_any_text)) inline bool COULD_BE_DATE(dsc desc) {
return ((DTYPE_IS_DATE(desc.dsc_dtype)) || (desc.dsc_dtype <= dtype_any_text));
}
//#define COULD_BE_DATE(d) ((DTYPE_IS_DATE((d).dsc_dtype)) || ((d).dsc_dtype <= dtype_any_text))
/* One of d1,d2 is time, the other is date */ /* One of d1,d2 is time, the other is date */
#define IS_DATE_AND_TIME(d1,d2) \ inline bool IS_DATE_AND_TIME(dsc d1, dsc d2){
((((d1).dsc_dtype==dtype_sql_time)&&((d2).dsc_dtype==dtype_sql_date)) || \ return (((d1.dsc_dtype==dtype_sql_time)&&(d2.dsc_dtype==dtype_sql_date)) ||
(((d2).dsc_dtype==dtype_sql_time)&&((d1).dsc_dtype==dtype_sql_date))) ((d2.dsc_dtype==dtype_sql_time)&&(d1.dsc_dtype==dtype_sql_date)));
}
//#define IS_DATE_AND_TIME(d1,d2)
// ((((d1).dsc_dtype==dtype_sql_time)&&((d2).dsc_dtype==dtype_sql_date)) ||
// (((d2).dsc_dtype==dtype_sql_time)&&((d1).dsc_dtype==dtype_sql_date)))
// size of req_rpb[0] // size of req_rpb[0]
const size_t REQ_TAIL = sizeof (Jrd::jrd_req::blk_repeat_type); const size_t REQ_TAIL = sizeof (Jrd::jrd_req::blk_repeat_type);
@ -948,7 +955,7 @@ void CMP_get_desc(thread_db* tdbb, CompilerScratch* csb, jrd_nod* node, DSC * de
#ifdef PC_ENGINE #ifdef PC_ENGINE
case nod_begin_range: case nod_begin_range:
desc->dsc_dtype = dtype_text; desc->dsc_dtype = dtype_text;
desc->dsc_ttype = ttype_ascii; desc->dsc_sub_type = ttype_ascii;
desc->dsc_scale = 0; desc->dsc_scale = 0;
desc->dsc_length = RANGE_NAME_LENGTH; desc->dsc_length = RANGE_NAME_LENGTH;
desc->dsc_flags = 0; desc->dsc_flags = 0;
@ -1619,18 +1626,18 @@ void CMP_get_desc(thread_db* tdbb, CompilerScratch* csb, jrd_nod* node, DSC * de
ULONG rc_len; ULONG rc_len;
if (desc1.dsc_dtype <= dtype_varying) { if (desc1.dsc_dtype <= dtype_varying) {
rc_len = DSC_string_length(&desc1); rc_len = DSC_string_length(&desc1);
desc->dsc_ttype = desc1.dsc_ttype; desc->dsc_sub_type = desc1.dsc_sub_type;
} }
else { else {
rc_len = DSC_convert_to_text_length(desc1.dsc_dtype); rc_len = DSC_convert_to_text_length(desc1.dsc_dtype);
desc->dsc_ttype = ttype_ascii; desc->dsc_sub_type = ttype_ascii;
} }
if (desc2.dsc_dtype <= dtype_varying) { if (desc2.dsc_dtype <= dtype_varying) {
rc_len += DSC_string_length (&desc2); rc_len += DSC_string_length (&desc2);
if (((desc->dsc_ttype == CS_ASCII) || (desc->dsc_ttype == CS_NONE)) && if (((desc->dsc_sub_type == CS_ASCII) || (desc->dsc_sub_type == CS_NONE)) &&
(desc2.dsc_ttype != CS_NONE)) (desc2.dsc_sub_type != CS_NONE))
{ {
desc->dsc_ttype = desc2.dsc_ttype; desc->dsc_sub_type = desc2.dsc_sub_type;
} }
} }
else { else {
@ -1651,7 +1658,7 @@ void CMP_get_desc(thread_db* tdbb, CompilerScratch* csb, jrd_nod* node, DSC * de
if (desc->dsc_dtype > dtype_varying) { if (desc->dsc_dtype > dtype_varying) {
desc->dsc_length = DSC_convert_to_text_length(desc->dsc_dtype); desc->dsc_length = DSC_convert_to_text_length(desc->dsc_dtype);
desc->dsc_dtype = dtype_text; desc->dsc_dtype = dtype_text;
desc->dsc_ttype = ttype_ascii; desc->dsc_sub_type = ttype_ascii;
desc->dsc_scale = 0; desc->dsc_scale = 0;
desc->dsc_flags = 0; desc->dsc_flags = 0;
} }
@ -1659,7 +1666,7 @@ void CMP_get_desc(thread_db* tdbb, CompilerScratch* csb, jrd_nod* node, DSC * de
case nod_dbkey: case nod_dbkey:
desc->dsc_dtype = dtype_text; desc->dsc_dtype = dtype_text;
desc->dsc_ttype = ttype_binary; desc->dsc_sub_type = ttype_binary;
desc->dsc_length = 8; desc->dsc_length = 8;
desc->dsc_scale = 0; desc->dsc_scale = 0;
desc->dsc_flags = 0; desc->dsc_flags = 0;
@ -1667,7 +1674,7 @@ void CMP_get_desc(thread_db* tdbb, CompilerScratch* csb, jrd_nod* node, DSC * de
case nod_rec_version: case nod_rec_version:
desc->dsc_dtype = dtype_text; desc->dsc_dtype = dtype_text;
desc->dsc_ttype = ttype_binary; desc->dsc_sub_type = ttype_binary;
desc->dsc_length = 4; desc->dsc_length = 4;
desc->dsc_scale = 0; desc->dsc_scale = 0;
desc->dsc_flags = 0; desc->dsc_flags = 0;
@ -1700,7 +1707,7 @@ void CMP_get_desc(thread_db* tdbb, CompilerScratch* csb, jrd_nod* node, DSC * de
case nod_user_name: case nod_user_name:
case nod_current_role: case nod_current_role:
desc->dsc_dtype = dtype_text; desc->dsc_dtype = dtype_text;
desc->dsc_ttype = ttype_metadata; desc->dsc_sub_type = ttype_metadata;
desc->dsc_length = USERNAME_LENGTH; desc->dsc_length = USERNAME_LENGTH;
desc->dsc_scale = 0; desc->dsc_scale = 0;
desc->dsc_flags = 0; desc->dsc_flags = 0;
@ -1800,7 +1807,7 @@ void CMP_get_desc(thread_db* tdbb, CompilerScratch* csb, jrd_nod* node, DSC * de
rc_len = sl2; rc_len = sl2;
} }
desc->dsc_dtype = dtype_varying; desc->dsc_dtype = dtype_varying;
desc->dsc_ttype = desc->dsc_scale; desc->dsc_sub_type = desc->dsc_scale;
desc->dsc_scale = 0; desc->dsc_scale = 0;
desc->dsc_length = static_cast<USHORT>(rc_len) + sizeof(USHORT); desc->dsc_length = static_cast<USHORT>(rc_len) + sizeof(USHORT);
} }
@ -1844,7 +1851,7 @@ void CMP_get_desc(thread_db* tdbb, CompilerScratch* csb, jrd_nod* node, DSC * de
case nod_bookmark: case nod_bookmark:
desc->dsc_dtype = dtype_text; desc->dsc_dtype = dtype_text;
desc->dsc_ttype = ttype_binary; desc->dsc_sub_type = ttype_binary;
desc->dsc_length = 0; desc->dsc_length = 0;
desc->dsc_scale = 0; desc->dsc_scale = 0;
desc->dsc_flags = 0; desc->dsc_flags = 0;
@ -5711,7 +5718,7 @@ static void process_map(thread_db* tdbb, CompilerScratch* csb, jrd_nod* map,
desc->dsc_dtype = dtype_varying; desc->dsc_dtype = dtype_varying;
desc->dsc_length = desc->dsc_length =
DSC_convert_to_text_length(max) + sizeof(USHORT); DSC_convert_to_text_length(max) + sizeof(USHORT);
desc->dsc_ttype = ttype_ascii; desc->dsc_sub_type = ttype_ascii;
desc->dsc_scale = 0; desc->dsc_scale = 0;
desc->dsc_flags = 0; desc->dsc_flags = 0;
} }

View File

@ -41,8 +41,6 @@
#include "../jrd/jrd_time.h" #include "../jrd/jrd_time.h"
#ifndef REQUESTER #ifndef REQUESTER
#include "../jrd/jrd.h" #include "../jrd/jrd.h"
#else
#include "../jrd/common.h"
#endif #endif
#include "../jrd/req.h" #include "../jrd/req.h"
#include "../jrd/val.h" #include "../jrd/val.h"
@ -687,7 +685,7 @@ UCHAR CVT_get_numeric(const UCHAR* string,
MOVE_CLEAR(&desc, sizeof(desc)); MOVE_CLEAR(&desc, sizeof(desc));
desc.dsc_dtype = dtype_text; desc.dsc_dtype = dtype_text;
desc.dsc_ttype = ttype_ascii; desc.dsc_sub_type = ttype_ascii;
desc.dsc_length = length; desc.dsc_length = length;
desc.dsc_address = const_cast<UCHAR*>(string); desc.dsc_address = const_cast<UCHAR*>(string);
// The above line allows the assignment, but "string" is treated as const // The above line allows the assignment, but "string" is treated as const
@ -1902,7 +1900,7 @@ static void datetime_to_text(const dsc* from, dsc* to, FPTR_ERROR err)
MOVE_CLEAR(&desc, sizeof(desc)); MOVE_CLEAR(&desc, sizeof(desc));
desc.dsc_address = (UCHAR *) temp; desc.dsc_address = (UCHAR *) temp;
desc.dsc_dtype = dtype_text; desc.dsc_dtype = dtype_text;
desc.dsc_ttype = ttype_ascii; desc.dsc_sub_type = ttype_ascii;
desc.dsc_length = (p - temp); desc.dsc_length = (p - temp);
if (from->dsc_dtype == dtype_timestamp && version4) { if (from->dsc_dtype == dtype_timestamp && version4) {
/* Prior to BLR Version5, when a timestamp is converted to a string it /* Prior to BLR Version5, when a timestamp is converted to a string it
@ -1946,7 +1944,7 @@ static SSHORT decompose(const char* string,
dsc errd; dsc errd;
MOVE_CLEAR(&errd, sizeof(errd)); MOVE_CLEAR(&errd, sizeof(errd));
errd.dsc_dtype = dtype_text; errd.dsc_dtype = dtype_text;
errd.dsc_ttype = ttype_ascii; errd.dsc_sub_type = ttype_ascii;
errd.dsc_length = length; errd.dsc_length = length;
errd.dsc_address = reinterpret_cast<UCHAR*>(const_cast<char*>(string)); errd.dsc_address = reinterpret_cast<UCHAR*>(const_cast<char*>(string));
@ -2185,7 +2183,7 @@ static void float_to_text(const dsc* from, dsc* to, FPTR_ERROR err)
dsc intermediate; dsc intermediate;
intermediate.dsc_dtype = dtype_text; intermediate.dsc_dtype = dtype_text;
intermediate.dsc_ttype = ttype_ascii; intermediate.dsc_sub_type = ttype_ascii;
/* CVC: If you think this is dangerous, replace the "else" with a call to /* CVC: If you think this is dangerous, replace the "else" with a call to
MEMMOVE(temp, temp + 1, chars_printed) or something cleverer. MEMMOVE(temp, temp + 1, chars_printed) or something cleverer.
Paranoid assumption: Paranoid assumption:

View File

@ -707,7 +707,7 @@ SSHORT CVT2_blob_compare(const dsc* arg1, const dsc* arg2, FPTR_ERROR err)
else else
ttype1 = ttype_none; ttype1 = ttype_none;
if (arg2->dsc_dtype <= dtype_varying) if (arg2->dsc_dtype <= dtype_varying)
ttype2 = arg2->dsc_ttype; ttype2 = arg2->dsc_sub_type;
else else
ttype2 = ttype_none; ttype2 = ttype_none;

View File

@ -4407,7 +4407,7 @@ static bool validate_text_type(thread_db* tdbb, ISC_STATUS* status,
**************************************/ **************************************/
if ((DTYPE_IS_TEXT (tfb->tfb_desc.dsc_dtype) && if ((DTYPE_IS_TEXT (tfb->tfb_desc.dsc_dtype) &&
!INTL_defined_type(tdbb, status, tfb->tfb_desc.dsc_ttype)) !INTL_defined_type(tdbb, status, tfb->tfb_desc.dsc_sub_type))
|| ||
(tfb->tfb_desc.dsc_dtype == dtype_blob && (tfb->tfb_desc.dsc_dtype == dtype_blob &&
tfb->tfb_desc.dsc_sub_type == isc_blob_text && tfb->tfb_desc.dsc_sub_type == isc_blob_text &&

View File

@ -56,8 +56,15 @@ typedef struct dsc
} DSC; } DSC;
#define DSC_GET_CHARSET(dsc) (((dsc)->dsc_ttype) & 0x00FF) inline SSHORT DSC_GET_CHARSET(const dsc* desc){
#define DSC_GET_COLLATE(dsc) (((dsc)->dsc_ttype) >> 8) return (desc->dsc_sub_type & 0x00FF);
}
//#define DSC_GET_CHARSET(dsc) (((dsc)->dsc_sub_type) & 0x00FF)
inline SSHORT DSC_GET_COLLATE(const dsc* desc){
return (desc->dsc_sub_type >> 8);
}
//#define DSC_GET_COLLATE(dsc) (((dsc)->dsc_sub_type) >> 8)
typedef struct alt_dsc { typedef struct alt_dsc {
SLONG dsc_combined_type; SLONG dsc_combined_type;
@ -65,81 +72,126 @@ typedef struct alt_dsc {
USHORT dsc_flags; /* Not currently used */ USHORT dsc_flags; /* Not currently used */
} ALT_DSC; } ALT_DSC;
#define DSC_EQUIV(d1,d2) ((((ALT_DSC*) d1)->dsc_combined_type == ((ALT_DSC*) d2)->dsc_combined_type) && \ inline bool DSC_EQUIV(const dsc* d1, const dsc* d2){
((DSC_GET_CHARSET (d1) == DSC_GET_CHARSET (d2)) || d1->dsc_dtype > dtype_any_text)) return ((((ALT_DSC*) d1)->dsc_combined_type == ((ALT_DSC*) d2)->dsc_combined_type) &&
((DSC_GET_CHARSET (d1) == DSC_GET_CHARSET (d2)) || d1->dsc_dtype > dtype_varying));
}
//#define DSC_EQUIV(d1,d2) ((((ALT_DSC*) d1)->dsc_combined_type == ((ALT_DSC*) d2)->dsc_combined_type) &&
// ((DSC_GET_CHARSET (d1) == DSC_GET_CHARSET (d2)) || d1->dsc_dtype > dtype_any_text))
/* In DSC_*_result tables, DTYPE_CANNOT means that the two operands /* In DSC_*_result tables, DTYPE_CANNOT means that the two operands
cannot participate together in the requested operation. */ cannot participate together in the requested operation. */
#define DTYPE_CANNOT 127 const UCHAR DTYPE_CANNOT = 127;
/* Historical alias definition */ /* Historical alias definition */
#define dtype_date dtype_timestamp const UCHAR dtype_date = dtype_timestamp;
#define dtype_aligned dtype_varying const UCHAR dtype_aligned = dtype_varying;
#define dtype_any_text dtype_varying const UCHAR dtype_any_text = dtype_varying;
#define dtype_min_comp dtype_packed const UCHAR dtype_min_comp = dtype_packed;
#define dtype_max_comp dtype_d_float const UCHAR dtype_max_comp = dtype_d_float;
/* NOTE: For types <= dtype_any_text the dsc_sub_type field defines /* NOTE: For types <= dtype_any_text the dsc_sub_type field defines
the text type */ the text type */
#define TEXT_LEN(d) ((d->dsc_dtype == dtype_text) ? d->dsc_length : (d->dsc_dtype == dtype_cstring) ? d->dsc_length - 1 : d->dsc_length - sizeof(USHORT)) inline USHORT TEXT_LEN(const dsc* desc){
return ((desc->dsc_dtype == dtype_text) ? desc->dsc_length
: (desc->dsc_dtype == dtype_cstring) ? desc->dsc_length - 1 : desc->dsc_length - sizeof(USHORT));
}
//#define TEXT_LEN(d) ((d->dsc_dtype == dtype_text) ? d->dsc_length : (d->dsc_dtype == dtype_cstring) ? d->dsc_length - 1 : d->dsc_length - sizeof(USHORT))
/* Text Sub types, distinct from character sets & collations */ /* Text Sub types, distinct from character sets & collations */
#define dsc_text_type_none 0 /* Normal text */ const SSHORT dsc_text_type_none = 0; /* Normal text */
#define dsc_text_type_fixed 1 /* strings can contain null bytes */ const SSHORT dsc_text_type_fixed = 1; /* strings can contain null bytes */
#define dsc_text_type_metadata 3 /* string represents system metadata */ const SSHORT dsc_text_type_metadata = 3; /* string represents system metadata */
/* Exact numeric subtypes: with ODS >= 10, these apply when dtype /* Exact numeric subtypes: with ODS >= 10, these apply when dtype
is short, long, or quad. */ is short, long, or quad. */
#define dsc_num_type_none 0 /* defined as SMALLINT or INTEGER */ const SSHORT dsc_num_type_none = 0; /* defined as SMALLINT or INTEGER */
#define dsc_num_type_numeric 1 /* defined as NUMERIC(n,m) */ const SSHORT dsc_num_type_numeric = 1; /* defined as NUMERIC(n,m) */
#define dsc_num_type_decimal 2 /* defined as DECIMAL(n,m) */ const SSHORT dsc_num_type_decimal = 2; /* defined as DECIMAL(n,m) */
/* Date type information */ /* Date type information */
#define DTYPE_IS_TEXT(d) (((d) >= dtype_text) && ((d) <= dtype_varying)) inline bool DTYPE_IS_TEXT(UCHAR d){
#define DTYPE_IS_DATE(t) (((t) >= dtype_sql_date) && ((t) <= dtype_timestamp)) return (((d) >= dtype_text) && ((d) <= dtype_varying));
}
//#define DTYPE_IS_DATE(d) (((d) >= dtype_text) && ((d) <= dtype_varying))
inline bool DTYPE_IS_DATE(UCHAR t){
return (((t) >= dtype_sql_date) && ((t) <= dtype_timestamp));
}
//#define DTYPE_IS_DATE(t) (((t) >= dtype_sql_date) && ((t) <= dtype_timestamp))
/* DTYPE_IS_BLOB includes both BLOB and ARRAY since array's are implemented over blobs. */ /* DTYPE_IS_BLOB includes both BLOB and ARRAY since array's are implemented over blobs. */
#define DTYPE_IS_BLOB(d) (((d) == dtype_blob) || ((d) == dtype_array)) inline bool DTYPE_IS_BLOB(UCHAR d){
return (((d) == dtype_blob) || ((d) == dtype_array));
}
//#define DTYPE_IS_BLOB(d) (((d) == dtype_blob) || ((d) == dtype_array))
/* Exact numeric? */ /* Exact numeric? */
inline bool DTYPE_IS_EXACT(UCHAR d){
return (((d) == dtype_int64) || ((d) == dtype_long) || ((d) == dtype_short));
}
#define DTYPE_IS_EXACT(d) (((d) == dtype_int64) || \ //#define DTYPE_IS_EXACT(d) (((d) == dtype_int64) ||
((d) == dtype_long) || \ // ((d) == dtype_long) ||
((d) == dtype_short)) // ((d) == dtype_short))
#ifdef VMS #ifdef VMS
#define DTYPE_IS_APPROX(d) (((d) == dtype_double) || \ inline bool DTYPE_IS_APPROX(UCHAR d){
((d) == dtype_real) || \ return (((d) == dtype_double) || ((d) == dtype_real) || ((d) == dtype_d_float));
((d) == dtype_d_float)) }
//#define DTYPE_IS_APPROX(d) (((d) == dtype_double) ||
// ((d) == dtype_real) ||
// ((d) == dtype_d_float))
#else #else
#define DTYPE_IS_APPROX(d) (((d) == dtype_double) || \ inline bool DTYPE_IS_APPROX(UCHAR d){
((d) == dtype_real)) return (((d) == dtype_double) || ((d) == dtype_real));
}
//#define DTYPE_IS_APPROX(d) (((d) == dtype_double) ||
// ((d) == dtype_real))
#endif #endif
#define DTYPE_IS_NUMERIC(d) ((((d) >= dtype_byte) && \
((d) <= dtype_d_float)) || \
((d) == dtype_int64))
#define NUMERIC_SCALE(desc) ((DTYPE_IS_TEXT((desc).dsc_dtype)) ? 0 : (desc).dsc_scale) inline bool DTYPE_IS_NUMERIC(UCHAR d){
return ((((d) >= dtype_byte) && ((d) <= dtype_d_float)) || ((d) == dtype_int64));
}
//#define DTYPE_IS_NUMERIC(d) ((((d) >= dtype_byte) &&
// ((d) <= dtype_d_float)) ||
// ((d) == dtype_int64))
inline SCHAR NUMERIC_SCALE(dsc desc){
return ((DTYPE_IS_TEXT((desc).dsc_dtype)) ? 0 : (desc).dsc_scale);
}
//#define NUMERIC_SCALE(desc) ((DTYPE_IS_TEXT((desc).dsc_dtype)) ? 0 : (desc).dsc_scale)
/* Macros defining what operations are legal on data types */ /* Macros defining what operations are legal on data types */
#define DTYPE_CAN_NEGATE(d) DTYPE_IS_NUMERIC(d) inline bool DTYPE_CAN_NEGATE(UCHAR d){
#define DTYPE_CAN_AVERAGE(d) DTYPE_IS_NUMERIC(d) return DTYPE_IS_NUMERIC(d);
#define DTYPE_CAN_DIVIDE(d) DTYPE_IS_NUMERIC(d) }
#define DTYPE_CAN_MULTIPLY(d) DTYPE_IS_NUMERIC(d) //#define DTYPE_CAN_NEGATE(d) DTYPE_IS_NUMERIC(d)
inline bool DTYPE_CAN_AVERAGE(UCHAR d){
return DTYPE_IS_NUMERIC(d);
}
//#define DTYPE_CAN_AVERAGE(d) DTYPE_IS_NUMERIC(d)
inline bool DTYPE_CAN_DIVIDE(UCHAR d){
return DTYPE_IS_NUMERIC(d);
}
//#define DTYPE_CAN_DIVIDE(d) DTYPE_IS_NUMERIC(d)
inline bool DTYPE_CAN_MULTIPLY(UCHAR d){
return DTYPE_IS_NUMERIC(d);
}
//#define DTYPE_CAN_MULTIPLY(d) DTYPE_IS_NUMERIC(d)
#define ISC_TIME_SECONDS_PRECISION 10000L
#define ISC_TIME_SECONDS_PRECISION_SCALE (-4)
#endif /* JRD_DSC_H */ #endif /* JRD_DSC_H */

View File

@ -181,15 +181,15 @@ const dsc::dtype_t DTYPE_TYPE_MAX = 20;
// In DSC_*_result tables, DTYPE_CANNOT means that the two operands // In DSC_*_result tables, DTYPE_CANNOT means that the two operands
// cannot participate together in the requested operation. // cannot participate together in the requested operation.
#define DTYPE_CANNOT 127 const UCHAR DTYPE_CANNOT = 127;
// Historical alias definition // Historical alias definition
#define dtype_date dtype_timestamp const UCHAR dtype_date = dtype_timestamp;
#define dtype_aligned dtype_varying const UCHAR dtype_aligned = dtype_varying;
#define dtype_any_text dtype_varying const UCHAR dtype_any_text = dtype_varying;
#define dtype_min_comp dtype_packed const UCHAR dtype_min_comp = dtype_packed;
#define dtype_max_comp dtype_d_float const UCHAR dtype_max_comp = dtype_d_float;
// values for dsc_flags // values for dsc_flags
@ -223,10 +223,6 @@ inline bool dsc::isEmpty() const
// Overload text typing information into the dsc_sub_type field. // Overload text typing information into the dsc_sub_type field.
// See intl.h for definitions of text types // See intl.h for definitions of text types
#ifndef dsc_ttype
#define dsc_ttype dsc_sub_type
#endif
inline dsc::sub_type_t dsc::getTextType() const inline dsc::sub_type_t dsc::getTextType() const
{ {
if (isText()) if (isText())
@ -237,8 +233,8 @@ inline dsc::sub_type_t dsc::getTextType() const
} }
#define DSC_GET_CHARSET(dsc) (((dsc)->dsc_ttype) & 0x00FF) //#define DSC_GET_CHARSET(dsc) (((dsc)->dsc_sub_type) & 0x00FF)
#define DSC_GET_COLLATE(dsc) (((dsc)->dsc_ttype) >> 8) //#define DSC_GET_COLLATE(dsc) (((dsc)->dsc_sub_type) >> 8)
inline dsc::sub_type_t dsc::getCharset() const inline dsc::sub_type_t dsc::getCharset() const
{ {
@ -268,8 +264,8 @@ struct alt_dsc
}; };
#define DSC_EQUIV(d1,d2) ((((alt_dsc*) d1)->dsc_combined_type == ((alt_dsc*) d2)->dsc_combined_type) && \ //#define DSC_EQUIV(d1,d2) ((((alt_dsc*) d1)->dsc_combined_type == ((alt_dsc*) d2)->dsc_combined_type) &&
((DSC_GET_CHARSET (d1) == DSC_GET_CHARSET (d2)) || d1->dsc_dtype > dtype_any_text)) // ((DSC_GET_CHARSET (d1) == DSC_GET_CHARSET (d2)) || d1->dsc_dtype > dtype_any_text))
inline bool dsc::isDscEquiv(const dsc* d2) const inline bool dsc::isDscEquiv(const dsc* d2) const
{ {
@ -285,7 +281,7 @@ inline bool dsc::isDscEquiv(const dsc* d2) const
// NOTE: For types <= dtype_any_text the dsc_sub_type field defines // NOTE: For types <= dtype_any_text the dsc_sub_type field defines
// the text type // the text type
#define TEXT_LEN(d) ((d->dsc_dtype == dtype_text) ? d->dsc_length : (d->dsc_dtype == dtype_cstring) ? d->dsc_length - 1 : d->dsc_length - sizeof(USHORT)) //#define TEXT_LEN(d) ((d->dsc_dtype == dtype_text) ? d->dsc_length : (d->dsc_dtype == dtype_cstring) ? d->dsc_length - 1 : d->dsc_length - sizeof(USHORT))
// Don't use validate=true if you have a cstring with MBCS because it // Don't use validate=true if you have a cstring with MBCS because it
// may detect prematurely a null terminator in a multi-byte character. // may detect prematurely a null terminator in a multi-byte character.
@ -347,8 +343,8 @@ const dsc::sub_type_t dsc_num_type_decimal = 2; // defined as DECIMAL(n,m)
// Date type information // Date type information
#define DTYPE_IS_TEXT(d) (((d) >= dtype_text) && ((d) <= dtype_varying)) //#define DTYPE_IS_TEXT(d) (((d) >= dtype_text) && ((d) <= dtype_varying))
#define DTYPE_IS_DATE(t) (((t) >= dtype_sql_date) && ((t) <= dtype_timestamp)) //#define DTYPE_IS_DATE(t) (((t) >= dtype_sql_date) && ((t) <= dtype_timestamp))
inline bool dsc::isText() const inline bool dsc::isText() const
{ {
@ -362,7 +358,7 @@ inline bool dsc::isDate() const
// DTYPE_IS_BLOB includes both BLOB and ARRAY since array's are implemented over blobs. // DTYPE_IS_BLOB includes both BLOB and ARRAY since array's are implemented over blobs.
#define DTYPE_IS_BLOB(d) (((d) == dtype_blob) || ((d) == dtype_array)) //#define DTYPE_IS_BLOB(d) (((d) == dtype_blob) || ((d) == dtype_array))
inline bool dsc::isBlob() const inline bool dsc::isBlob() const
{ {
@ -399,9 +395,9 @@ inline bool dsc::isUserDefinedBlob() const
// Exact numeric? // Exact numeric?
#define DTYPE_IS_EXACT(d) (((d) == dtype_int64) || \ //#define DTYPE_IS_EXACT(d) (((d) == dtype_int64) ||
((d) == dtype_long) || \ // ((d) == dtype_long) ||
((d) == dtype_short)) // ((d) == dtype_short))
inline bool dsc::isExact() const inline bool dsc::isExact() const
{ {
@ -429,12 +425,12 @@ inline bool dsc::isSqlDecimal() const
// Floating point types? // Floating point types?
#ifdef VMS #ifdef VMS
#define DTYPE_IS_APPROX(d) (((d) == dtype_double) || \ //#define DTYPE_IS_APPROX(d) (((d) == dtype_double) ||
((d) == dtype_real) || \ // ((d) == dtype_real) ||
((d) == dtype_d_float)) // ((d) == dtype_d_float))
#else #else
#define DTYPE_IS_APPROX(d) (((d) == dtype_double) || \ //#define DTYPE_IS_APPROX(d) (((d) == dtype_double) ||
((d) == dtype_real)) // ((d) == dtype_real))
#endif #endif
inline bool dsc::isApprox() const inline bool dsc::isApprox() const
@ -455,9 +451,9 @@ inline bool dsc::isApprox() const
// Beware, this is not SQL numeric(p, s), but a test for number data types // Beware, this is not SQL numeric(p, s), but a test for number data types
// Strangely, the original macro doesn't test for VMS even though // Strangely, the original macro doesn't test for VMS even though
// the dtype_d_float follows dtype_double. // the dtype_d_float follows dtype_double.
#define DTYPE_IS_NUMERIC(d) ((((d) >= dtype_byte) && \ //#define DTYPE_IS_NUMERIC(d) ((((d) >= dtype_byte) &&
((d) <= dtype_d_float)) || \ // ((d) <= dtype_d_float)) ||
((d) == dtype_int64)) // ((d) == dtype_int64))
// To avoid confusion, the new function was renamed. // To avoid confusion, the new function was renamed.
inline bool dsc::isANumber() const inline bool dsc::isANumber() const
@ -473,7 +469,7 @@ inline bool dsc::isANumber() const
// Dubious function's check. // Dubious function's check.
#define NUMERIC_SCALE(desc) ((DTYPE_IS_TEXT((desc).dsc_dtype)) ? 0 : (desc).dsc_scale) //#define NUMERIC_SCALE(desc) ((DTYPE_IS_TEXT((desc).dsc_dtype)) ? 0 : (desc).dsc_scale)
inline dsc::scale_t numeric_scale(const dsc& desc) inline dsc::scale_t numeric_scale(const dsc& desc)
{ {
@ -482,10 +478,10 @@ inline dsc::scale_t numeric_scale(const dsc& desc)
// Macros defining what operations are legal on data types // Macros defining what operations are legal on data types
#define DTYPE_CAN_NEGATE(d) DTYPE_IS_NUMERIC(d) //#define DTYPE_CAN_NEGATE(d) DTYPE_IS_NUMERIC(d)
#define DTYPE_CAN_AVERAGE(d) DTYPE_IS_NUMERIC(d) //#define DTYPE_CAN_AVERAGE(d) DTYPE_IS_NUMERIC(d)
#define DTYPE_CAN_DIVIDE(d) DTYPE_IS_NUMERIC(d) //#define DTYPE_CAN_DIVIDE(d) DTYPE_IS_NUMERIC(d)
#define DTYPE_CAN_MULTIPLY(d) DTYPE_IS_NUMERIC(d) //#define DTYPE_CAN_MULTIPLY(d) DTYPE_IS_NUMERIC(d)
inline bool dsc::canNegate() const {return isANumber();} inline bool dsc::canNegate() const {return isANumber();}
inline bool dsc::canAverage() const {return isANumber();} inline bool dsc::canAverage() const {return isANumber();}

View File

@ -40,13 +40,6 @@
from metadata primarily to flag from metadata primarily to flag
SQLDA (in DSQL) */ SQLDA (in DSQL) */
// Overload text typing information into the dsc_sub_type field.
// See intl.h for definitions of text types
#ifndef dsc_ttype
#define dsc_ttype dsc_sub_type
#endif
// Data types // Data types
// WARNING: if you add another manifest constant to this group, then you // WARNING: if you add another manifest constant to this group, then you
@ -79,6 +72,9 @@
#define dtype_int64 19 #define dtype_int64 19
#define DTYPE_TYPE_MAX 20 #define DTYPE_TYPE_MAX 20
//
#define ISC_TIME_SECONDS_PRECISION 10000L
#define ISC_TIME_SECONDS_PRECISION_SCALE (-4)
#endif /* JRD_DSC_PUB_H */ #endif /* JRD_DSC_PUB_H */

View File

@ -19,7 +19,7 @@
* *
* All Rights Reserved. * All Rights Reserved.
* Contributor(s): ______________________________________. * Contributor(s): ______________________________________.
* $Id: evl.cpp,v 1.85 2004-05-09 05:47:58 robocop Exp $ * $Id: evl.cpp,v 1.86 2004-05-12 00:02:06 brodsom Exp $
*/ */
/* /*
@ -1371,7 +1371,7 @@ bool EVL_field(jrd_rel* relation, Record* record, USHORT id, dsc* desc)
desc->dsc_length = 1; desc->dsc_length = 1;
desc->dsc_sub_type = 0; desc->dsc_sub_type = 0;
desc->dsc_scale = 0; desc->dsc_scale = 0;
desc->dsc_ttype = ttype_ascii; desc->dsc_sub_type = ttype_ascii;
desc->dsc_address = (UCHAR *) " "; desc->dsc_address = (UCHAR *) " ";
return false; return false;
} }
@ -1383,7 +1383,7 @@ bool EVL_field(jrd_rel* relation, Record* record, USHORT id, dsc* desc)
desc->dsc_length = 1; desc->dsc_length = 1;
desc->dsc_sub_type = 0; desc->dsc_sub_type = 0;
desc->dsc_scale = 0; desc->dsc_scale = 0;
desc->dsc_ttype = ttype_ascii; desc->dsc_sub_type = ttype_ascii;
desc->dsc_address = (UCHAR *) " "; desc->dsc_address = (UCHAR *) " ";
return false; return false;
} }
@ -2128,27 +2128,6 @@ USHORT EVL_mb_sleuth_merge(thread_db* tdbb,
return ret_val; return ret_val;
} }
//
// Definitions and macros for evl_like
//
#define SLEUTH_insensitive 1
#define COND_UPPER(obj, c) ((flags & SLEUTH_insensitive) ? (obj).to_upper(c) : (c))
static const char GDML_MATCH_ONE = '?';
static const char GDML_MATCH_ANY = '*';
static const char GDML_QUOTE = '@';
static const char GDML_NOT = '~';
static const char GDML_RANGE = '-';
static const char GDML_CLASS_START = '[';
static const char GDML_CLASS_END = ']';
static const char GDML_SUBSTITUTE = '=';
static const char GDML_FLAG_SET = '+';
static const char GDML_FLAG_CLEAR = '-';
static const char GDML_COMMA = ',';
static const char GDML_LPAREN = '(';
static const char GDML_RPAREN = ')';
/************************************** /**************************************
* *
* E V L _ n c _ m a t c h e s * E V L _ n c _ m a t c h e s
@ -2161,29 +2140,91 @@ static const char GDML_RPAREN = ')';
* *
************************************** **************************************
*/ */
#define LIKENAME EVL_nc_like
#define LIKETYPE UCHAR
#define MATCHESNAME EVL_nc_matches
#define MATCHESTYPE UCHAR
#define SLEUTHNAME EVL_nc_sleuth_check
#define SLEUTH_MERGE_NAME EVL_nc_sleuth_merge
#define SLEUTH_AUX nc_sleuth_check
#define SLEUTH_CLASS_NAME nc_sleuth_class
#define SLEUTHTYPE UCHAR
#define EVL_LIKE_INCLUDED_BY_EVL_CPP
#include "../jrd/evl_like.cpp" #include "../jrd/evl_like.cpp"
#undef EVL_LIKE_INCLUDED_BY_EVL_CPP
#undef LIKENAME //#define LIKENAME EVL_nc_like
#undef LIKETYPE //#define LIKETYPE UCHAR
#undef MATCHESNAME //#define MATCHESNAME EVL_nc_matches
#undef MATCHESTYPE //#define MATCHESTYPE UCHAR
#undef SLEUTHNAME //#define SLEUTHNAME EVL_nc_sleuth_check
#undef SLEUTH_MERGE_NAME //#define SLEUTH_MERGE_NAME EVL_nc_sleuth_merge
#undef SLEUTH_AUX //#define SLEUTH_AUX nc_sleuth_check
#undef SLEUTH_CLASS_NAME //#define SLEUTH_CLASS_NAME nc_sleuth_class
#undef SLEUTHTYPE //#define SLEUTHTYPE UCHAR
//
//#define EVL_LIKE_INCLUDED_BY_EVL_CPP
//#include "../jrd/evl_like.cpp"
//#undef EVL_LIKE_INCLUDED_BY_EVL_CPP
//
//#undef LIKENAME
//#undef LIKETYPE
//#undef MATCHESNAME
//#undef MATCHESTYPE
//#undef SLEUTHNAME
//#undef SLEUTH_MERGE_NAME
//#undef SLEUTH_AUX
//#undef SLEUTH_CLASS_NAME
//#undef SLEUTHTYPE
typedef UCHAR MATCHESTYPE1;
typedef UCHAR SLEUTHTYPE1;
bool EVL_nc_matches(
thread_db* tdbb,
TextType obj,
const MATCHESTYPE1* p1,
SSHORT l1_bytes,
const MATCHESTYPE1* p2,
SSHORT l2_bytes)
{
return MATCHESNAME(tdbb, obj, p1, l1_bytes, p2, l2_bytes);
}
bool EVL_nc_sleuth_check(
thread_db* tdbb_dummy,
TextType obj,
USHORT flags,
const SLEUTHTYPE1* search,
USHORT search_len,
const SLEUTHTYPE1* match,
USHORT match_len)
{
return SLEUTHNAME(tdbb_dummy, obj, flags, search, search_len, match, match_len);
}
USHORT EVL_nc_sleuth_merge(
thread_db* tdbb_dummy,
TextType obj,
const SLEUTHTYPE1* match,
USHORT match_bytes,
const SLEUTHTYPE1* control,
USHORT control_bytes,
SLEUTHTYPE1* combined,
USHORT combined_bytes)
{
return SLEUTH_MERGE_NAME(tdbb_dummy, obj, match, match_bytes, control, control_bytes, combined, combined_bytes);
}
bool nc_sleuth_check(
TextType obj,
USHORT flags,
const SLEUTHTYPE1* search,
const SLEUTHTYPE1* end_search,
const SLEUTHTYPE1* match,
const SLEUTHTYPE1* end_match)
{
return SLEUTH_AUX(obj, flags, search, end_search, match, end_match);
}
static bool nc_sleuth_class(
TextType obj,
USHORT flags,
const SLEUTHTYPE1* char_class,
const SLEUTHTYPE1* const end_class,
SLEUTHTYPE1 character)
{
return SLEUTH_CLASS_NAME(obj, flags, char_class, end_class, character);
}
/************************************** /**************************************
@ -2198,29 +2239,91 @@ static const char GDML_RPAREN = ')';
* *
************************************** **************************************
*/ */
#define LIKENAME EVL_wc_like
#define LIKETYPE UCS2_CHAR
#define MATCHESNAME EVL_wc_matches
#define MATCHESTYPE UCS2_CHAR
#define SLEUTHNAME EVL_wc_sleuth_check
#define SLEUTH_MERGE_NAME EVL_wc_sleuth_merge
#define SLEUTH_AUX wc_sleuth_check
#define SLEUTH_CLASS_NAME wc_sleuth_class
#define SLEUTHTYPE UCS2_CHAR
#define EVL_LIKE_INCLUDED_BY_EVL_CPP //#define LIKENAME EVL_wc_like
#include "../jrd/evl_like.cpp" //#define LIKETYPE UCS2_CHAR
#undef EVL_LIKE_INCLUDED_BY_EVL_CPP //#define MATCHESNAME EVL_wc_matches
//#define MATCHESTYPE UCS2_CHAR
//#define SLEUTHNAME EVL_wc_sleuth_check
//#define SLEUTH_MERGE_NAME EVL_wc_sleuth_merge
//#define SLEUTH_AUX wc_sleuth_check
//#define SLEUTH_CLASS_NAME wc_sleuth_class
//#define SLEUTHTYPE UCS2_CHAR
//
//#define EVL_LIKE_INCLUDED_BY_EVL_CPP
//#include "../jrd/evl_like.cpp"
//#undef EVL_LIKE_INCLUDED_BY_EVL_CPP
//
//#undef LIKENAME
//#undef LIKETYPE
//#undef MATCHESNAME
//#undef MATCHESTYPE
//#undef SLEUTHNAME
//#undef SLEUTH_MERGE_NAME
//#undef SLEUTH_AUX
//#undef SLEUTH_CLASS_NAME
//#undef SLEUTHTYPE
typedef UCS2_CHAR MATCHESTYPE2;
typedef UCS2_CHAR SLEUTHTYPE2;
bool EVL_wc_matches(
thread_db* tdbb,
TextType obj,
const MATCHESTYPE2* p1,
SSHORT l1_bytes,
const MATCHESTYPE2* p2,
SSHORT l2_bytes)
{
return MATCHESNAME(tdbb, obj, p1, l1_bytes, p2, l2_bytes);
}
bool EVL_wc_sleuth_check(
thread_db* tdbb_dummy,
TextType obj,
USHORT flags,
const SLEUTHTYPE2* search,
USHORT search_len,
const SLEUTHTYPE2* match,
USHORT match_len)
{
return SLEUTHNAME(tdbb_dummy, obj, flags, search, search_len, match, match_len);
}
USHORT EVL_wc_sleuth_merge(
thread_db* tdbb_dummy,
TextType obj,
const SLEUTHTYPE2* match,
USHORT match_bytes,
const SLEUTHTYPE2* control,
USHORT control_bytes,
SLEUTHTYPE2* combined,
USHORT combined_bytes)
{
return SLEUTH_MERGE_NAME(tdbb_dummy, obj, match, match_bytes, control, control_bytes, combined, combined_bytes);
}
bool wc_sleuth_check(
TextType obj,
USHORT flags,
const SLEUTHTYPE2* search,
const SLEUTHTYPE2* end_search,
const SLEUTHTYPE2* match,
const SLEUTHTYPE2* end_match)
{
return SLEUTH_AUX(obj, flags, search, end_search, match, end_match);
}
bool wc_sleuth_class(
TextType obj,
USHORT flags,
const SLEUTHTYPE2* char_class,
const SLEUTHTYPE2* const end_class,
SLEUTHTYPE2 character)
{
return SLEUTH_CLASS_NAME(obj, flags, char_class, end_class, character);
}
#undef LIKENAME
#undef LIKETYPE
#undef MATCHESNAME
#undef MATCHESTYPE
#undef SLEUTHNAME
#undef SLEUTH_MERGE_NAME
#undef SLEUTH_AUX
#undef SLEUTH_CLASS_NAME
#undef SLEUTHTYPE
static dsc* add(const dsc* desc, const jrd_nod* node, impure_value* value) static dsc* add(const dsc* desc, const jrd_nod* node, impure_value* value)
{ {
@ -3260,7 +3363,7 @@ static dsc* dbkey(thread_db* tdbb, const jrd_nod* node, impure_value* impure)
impure->vlu_desc.dsc_address = (UCHAR *) impure->vlu_misc.vlu_dbkey; impure->vlu_desc.dsc_address = (UCHAR *) impure->vlu_misc.vlu_dbkey;
impure->vlu_desc.dsc_dtype = dtype_text; impure->vlu_desc.dsc_dtype = dtype_text;
impure->vlu_desc.dsc_length = 8; impure->vlu_desc.dsc_length = 8;
impure->vlu_desc.dsc_ttype = ttype_binary; impure->vlu_desc.dsc_sub_type = ttype_binary;
return &impure->vlu_desc; return &impure->vlu_desc;
} }
@ -4298,7 +4401,7 @@ static dsc* record_version(thread_db* tdbb, const jrd_nod* node, impure_value* i
impure->vlu_desc.dsc_address = (UCHAR *) & impure->vlu_misc.vlu_long; impure->vlu_desc.dsc_address = (UCHAR *) & impure->vlu_misc.vlu_long;
impure->vlu_desc.dsc_dtype = dtype_text; impure->vlu_desc.dsc_dtype = dtype_text;
impure->vlu_desc.dsc_length = 4; impure->vlu_desc.dsc_length = 4;
impure->vlu_desc.dsc_ttype = ttype_binary; impure->vlu_desc.dsc_sub_type = ttype_binary;
return &impure->vlu_desc; return &impure->vlu_desc;
} }
@ -4884,9 +4987,9 @@ static dsc* substring(
but it's resolved by INTL_obj_lookup() to UNICODE_FSS in the cases I observed. Here I cannot but it's resolved by INTL_obj_lookup() to UNICODE_FSS in the cases I observed. Here I cannot
distinguish between user calls and system calls. Unlike the original ASCII substring(), distinguish between user calls and system calls. Unlike the original ASCII substring(),
this one will get correctly the amount of UNICODE characters requested. */ this one will get correctly the amount of UNICODE characters requested. */
else if (desc.dsc_ttype == ttype_ascii || desc.dsc_ttype == ttype_none else if (desc.dsc_sub_type == ttype_ascii || desc.dsc_sub_type == ttype_none
|| ttype == ttype_binary || ttype == ttype_binary
/*|| desc.dsc_ttype == ttype_metadata) */) /*|| desc.dsc_sub_type == ttype_metadata) */)
{ {
/* Redundant. /* Redundant.
if (offset >= desc.dsc_length) if (offset >= desc.dsc_length)
@ -4977,8 +5080,8 @@ static dsc* upcase(thread_db* tdbb, const dsc* value, impure_value* impure)
INTL_ASSIGN_TTYPE(&desc, ttype); INTL_ASSIGN_TTYPE(&desc, ttype);
EVL_make_value(tdbb, &desc, impure); EVL_make_value(tdbb, &desc, impure);
if ((desc.dsc_ttype == ttype_ascii) || if ((desc.dsc_sub_type == ttype_ascii) ||
(desc.dsc_ttype == ttype_none) || (desc.dsc_ttype == ttype_metadata)) (desc.dsc_sub_type == ttype_none) || (desc.dsc_sub_type == ttype_metadata))
{ {
UCHAR* p = impure->vlu_desc.dsc_address; UCHAR* p = impure->vlu_desc.dsc_address;
for (const UCHAR* const end = p + impure->vlu_desc.dsc_length; for (const UCHAR* const end = p + impure->vlu_desc.dsc_length;

View File

@ -1,9 +1,3 @@
#ifndef EVL_LIKE_INCLUDED_BY_EVL_CPP
#pragma message ("Do not compile this file stand-alone. It gets included by evl.cpp!")
#else // EVL_LIKE_INCLUDED_BY_EVL_CPP
/* /*
* PROGRAM: JRD Access Method * PROGRAM: JRD Access Method
* MODULE: evl_like.cpp * MODULE: evl_like.cpp
@ -27,7 +21,25 @@
* Contributor(s): ______________________________________. * Contributor(s): ______________________________________.
*/ */
#define SLEUTH_insensitive 1
#define COND_UPPER(obj, c) ((flags & SLEUTH_insensitive) ? (obj).to_upper(c) : (c))
static const char GDML_MATCH_ONE = '?';
static const char GDML_MATCH_ANY = '*';
static const char GDML_QUOTE = '@';
static const char GDML_NOT = '~';
static const char GDML_RANGE = '-';
static const char GDML_CLASS_START = '[';
static const char GDML_CLASS_END = ']';
static const char GDML_SUBSTITUTE = '=';
static const char GDML_FLAG_SET = '+';
static const char GDML_FLAG_CLEAR = '-';
static const char GDML_COMMA = ',';
static const char GDML_LPAREN = '(';
static const char GDML_RPAREN = ')';
template <class MATCHESTYPE>
bool MATCHESNAME(thread_db* tdbb, bool MATCHESNAME(thread_db* tdbb,
TextType obj, TextType obj,
const MATCHESTYPE* p1, const MATCHESTYPE* p1,
@ -93,6 +105,7 @@ bool MATCHESNAME(thread_db* tdbb,
} }
template <class SLEUTHTYPE>
bool SLEUTHNAME(thread_db* tdbb_dummy, bool SLEUTHNAME(thread_db* tdbb_dummy,
TextType obj, TextType obj,
USHORT flags, USHORT flags,
@ -122,6 +135,7 @@ bool SLEUTHNAME(thread_db* tdbb_dummy,
} }
template <class SLEUTHTYPE>
USHORT SLEUTH_MERGE_NAME(thread_db* tdbb_dummy, USHORT SLEUTH_MERGE_NAME(thread_db* tdbb_dummy,
TextType obj, TextType obj,
const SLEUTHTYPE* match, const SLEUTHTYPE* match,
@ -246,6 +260,7 @@ USHORT SLEUTH_MERGE_NAME(thread_db* tdbb_dummy,
} }
template <class SLEUTHTYPE>
static bool SLEUTH_AUX( static bool SLEUTH_AUX(
TextType obj, TextType obj,
USHORT flags, USHORT flags,
@ -372,6 +387,7 @@ static bool SLEUTH_AUX(
} }
template <class SLEUTHTYPE>
static bool SLEUTH_CLASS_NAME( static bool SLEUTH_CLASS_NAME(
TextType obj, TextType obj,
USHORT flags, USHORT flags,
@ -420,7 +436,3 @@ static bool SLEUTH_CLASS_NAME(
return !result; return !result;
} }
#endif // EVL_LIKE_INCLUDED_BY_EVL_CPP

View File

@ -294,7 +294,7 @@ ISC_STATUS filter_format(USHORT action, BlobControl* control)
} }
TEXT temp1[64], temp2[64]; TEXT temp1[64], temp2[64];
if ((desc.dsc_dtype <= dtype_any_text) && (desc.dsc_ttype != 0)) { if ((desc.dsc_dtype <= dtype_any_text) && (desc.dsc_sub_type != 0)) {
sprintf(temp2, p, value); sprintf(temp2, p, value);
sprintf(temp1, "%s, sub-type %d", temp2, INTL_TTYPE(&desc)); sprintf(temp1, "%s, sub-type %d", temp2, INTL_TTYPE(&desc));
} }

View File

@ -338,7 +338,7 @@ static void define_default_class(
desc.dsc_dtype = dtype_text; desc.dsc_dtype = dtype_text;
desc.dsc_sub_type = 0; desc.dsc_sub_type = 0;
desc.dsc_scale = 0; desc.dsc_scale = 0;
desc.dsc_ttype = ttype_metadata; desc.dsc_sub_type = ttype_metadata;
desc.dsc_address = (UCHAR *) relation_name; desc.dsc_address = (UCHAR *) relation_name;
desc.dsc_length = strlen((char*)desc.dsc_address); desc.dsc_length = strlen((char*)desc.dsc_address);
DFW_post_work(dbb->dbb_sys_trans, dfw_scan_relation, &desc, 0); DFW_post_work(dbb->dbb_sys_trans, dfw_scan_relation, &desc, 0);
@ -714,7 +714,7 @@ static void purge_default_class( TEXT * object_name, SSHORT obj_type)
desc.dsc_dtype = dtype_text; desc.dsc_dtype = dtype_text;
desc.dsc_sub_type = 0; desc.dsc_sub_type = 0;
desc.dsc_scale = 0; desc.dsc_scale = 0;
desc.dsc_ttype = ttype_metadata; desc.dsc_sub_type = ttype_metadata;
desc.dsc_address = (UCHAR *) object_name; desc.dsc_address = (UCHAR *) object_name;
desc.dsc_length = strlen((char*)desc.dsc_address); desc.dsc_length = strlen((char*)desc.dsc_address);
DFW_post_work(dbb->dbb_sys_trans, dfw_scan_relation, &desc, 0); DFW_post_work(dbb->dbb_sys_trans, dfw_scan_relation, &desc, 0);
@ -967,7 +967,7 @@ TEXT * relation_name, TEXT * owner, USHORT public_priv, ULONG * length_ptr)
desc.dsc_dtype = dtype_text; desc.dsc_dtype = dtype_text;
desc.dsc_sub_type = 0; desc.dsc_sub_type = 0;
desc.dsc_scale = 0; desc.dsc_scale = 0;
desc.dsc_ttype = ttype_metadata; desc.dsc_sub_type = ttype_metadata;
desc.dsc_address = (UCHAR *) relation_name; desc.dsc_address = (UCHAR *) relation_name;
desc.dsc_length = strlen((char*)desc.dsc_address); desc.dsc_length = strlen((char*)desc.dsc_address);
DFW_post_work(dbb->dbb_sys_trans, dfw_update_format, &desc, 0); DFW_post_work(dbb->dbb_sys_trans, dfw_update_format, &desc, 0);

View File

@ -33,7 +33,7 @@
* *
*/ */
/* /*
$Id: ibase.h,v 1.76 2004-05-07 11:07:12 brodsom Exp $ $Id: ibase.h,v 1.77 2004-05-12 00:02:07 brodsom Exp $
*/ */
#ifndef JRD_IBASE_H #ifndef JRD_IBASE_H
@ -102,8 +102,9 @@ typedef struct
#define ISC_TIMESTAMP_DEFINED #define ISC_TIMESTAMP_DEFINED
#endif /* ISC_TIMESTAMP_DEFINED */ #endif /* ISC_TIMESTAMP_DEFINED */
#define ISC_TIME_SECONDS_PRECISION 10000L //Included in dsc.h
#define ISC_TIME_SECONDS_PRECISION_SCALE (-4) //#define ISC_TIME_SECONDS_PRECISION 10000L
//#define ISC_TIME_SECONDS_PRECISION_SCALE (-4)
/*******************************************************************/ /*******************************************************************/
/* Blob id structure */ /* Blob id structure */

View File

@ -1189,7 +1189,7 @@ int INTL_data_or_binary(const dsc* pText)
* *
**************************************/ **************************************/
return (INTL_data(pText) || (pText->dsc_ttype == ttype_binary)); return (INTL_data(pText) || (pText->dsc_sub_type == ttype_binary));
} }
@ -1396,7 +1396,7 @@ void INTL_pad_spaces(thread_db* tdbb, DSC * type, UCHAR * string, USHORT length)
fb_assert(IS_TEXT(type)); fb_assert(IS_TEXT(type));
fb_assert(string != NULL); fb_assert(string != NULL);
const USHORT charset = INTL_charset(tdbb, type->dsc_ttype, NULL); const USHORT charset = INTL_charset(tdbb, type->dsc_sub_type, NULL);
pad_spaces(tdbb, charset, string, length); pad_spaces(tdbb, charset, string, length);
} }

View File

@ -84,13 +84,13 @@
/* Define tests for international data */ /* Define tests for international data */
#define INTL_TTYPE(desc) ((desc)->dsc_ttype) #define INTL_TTYPE(desc) ((desc)->dsc_sub_type)
#define INTL_ASSIGN_TTYPE(desc, value) ((desc)->dsc_ttype = (SSHORT)(value)) #define INTL_ASSIGN_TTYPE(desc, value) ((desc)->dsc_sub_type = (SSHORT)(value))
#define INTERNAL_TTYPE(d) (((USHORT)((d)->dsc_ttype)) <= ttype_last_internal) #define INTERNAL_TTYPE(d) (((USHORT)((d)->dsc_sub_type)) <= ttype_last_internal)
#define IS_INTL_DATA(d) ((d)->dsc_dtype <= dtype_any_text && \ #define IS_INTL_DATA(d) ((d)->dsc_dtype <= dtype_any_text && \
(((USHORT)((d)->dsc_ttype)) > ttype_last_internal)) (((USHORT)((d)->dsc_sub_type)) > ttype_last_internal))
#define INTL_TEXT_TYPE(desc) ((DTYPE_IS_TEXT((desc).dsc_dtype)) ? INTL_TTYPE (&(desc)) : ttype_ascii) #define INTL_TEXT_TYPE(desc) ((DTYPE_IS_TEXT((desc).dsc_dtype)) ? INTL_TTYPE (&(desc)) : ttype_ascii)
@ -104,7 +104,7 @@
* 2) As a CHARACTER_SET_ID (when collation isn't relevent, like UDF parms) * 2) As a CHARACTER_SET_ID (when collation isn't relevent, like UDF parms)
* 3) As an index type - (btr.h) * 3) As an index type - (btr.h)
* 4) As a driver ID (used to lookup the code which implements the locale) * 4) As a driver ID (used to lookup the code which implements the locale)
* This is also known as dsc_ttype (aka text subtype). * This is also known as dsc_sub_type (aka text subtype).
* *
* In Descriptors (DSC) the data is encoded as: * In Descriptors (DSC) the data is encoded as:
* dsc_charset overloaded into dsc_scale * dsc_charset overloaded into dsc_scale

View File

@ -5267,7 +5267,7 @@ static RecordSource* gen_sort(thread_db* tdbb,
if (sort_key->skd_dtype == SKD_varying || if (sort_key->skd_dtype == SKD_varying ||
sort_key->skd_dtype == SKD_cstring) sort_key->skd_dtype == SKD_cstring)
{ {
if (desc->dsc_ttype == ttype_binary) if (desc->dsc_sub_type == ttype_binary)
sort_key->skd_flags |= SKD_binary; sort_key->skd_flags |= SKD_binary;
} }
sort_key->skd_length = desc->dsc_length; sort_key->skd_length = desc->dsc_length;

View File

@ -79,7 +79,7 @@ class jrd_file : public pool_alloc_rpt<SCHAR, type_fil>
#ifdef WIN_NT #ifdef WIN_NT
#ifdef SUPERSERVER_V2 #ifdef SUPERSERVER_V2
#define MAX_FILE_IO 32 /* Maximum "allocated" overlapped I/O events */ const int MAX_FILE_IO = 32; /* Maximum "allocated" overlapped I/O events */
#endif #endif
class jrd_file : public pool_alloc_rpt<SCHAR, type_fil> class jrd_file : public pool_alloc_rpt<SCHAR, type_fil>
@ -105,17 +105,17 @@ class jrd_file : public pool_alloc_rpt<SCHAR, type_fil>
#endif #endif
#define FIL_force_write 1 const USHORT FIL_force_write = 1;
#define FIL_force_write_init 2 const USHORT FIL_force_write_init = 2;
/* Physical IO trace events */ /* Physical IO trace events */
#define trace_create 1 const SSHORT trace_create = 1;
#define trace_open 2 const SSHORT trace_open = 2;
#define trace_page_size 3 const SSHORT trace_page_size = 3;
#define trace_read 4 const SSHORT trace_read = 4;
#define trace_write 5 const SSHORT trace_write = 5;
#define trace_close 6 const SSHORT trace_close = 6;
// Physical I/O status block, used only in SS v2 for Win32 // Physical I/O status block, used only in SS v2 for Win32
@ -129,9 +129,10 @@ struct phys_io_blk {
SLONG piob_io_event[8]; /* Event to signal I/O completion */ SLONG piob_io_event[8]; /* Event to signal I/O completion */
}; };
#define PIOB_error 1 /* I/O error occurred */ // piob_flags
#define PIOB_success 2 /* I/O successfully completed */ const UCHAR PIOB_error = 1; /* I/O error occurred */
#define PIOB_pending 4 /* Asynchronous I/O not yet completed */ const UCHAR PIOB_success = 2; /* I/O successfully completed */
const UCHAR PIOB_pending = 4; /* Asynchronous I/O not yet completed */
} //namespace Jrd } //namespace Jrd

View File

@ -416,7 +416,7 @@ DSC *RNG_begin(jrd_nod* node, impure_value* impure)
impure->vlu_desc.dsc_dtype = dtype_text; impure->vlu_desc.dsc_dtype = dtype_text;
impure->vlu_desc.dsc_scale = 0; impure->vlu_desc.dsc_scale = 0;
impure->vlu_desc.dsc_ttype = ttype_ascii; impure->vlu_desc.dsc_sub_type = ttype_ascii;
impure->vlu_desc.dsc_address = refresh_range->rng_event; impure->vlu_desc.dsc_address = refresh_range->rng_event;
impure->vlu_desc.dsc_length = refresh_range->rng_event_length; impure->vlu_desc.dsc_length = refresh_range->rng_event_length;

View File

@ -35,15 +35,12 @@
#include "../jrd/dsc.h" #include "../jrd/dsc.h"
#define FLAG_BYTES(n) (((n + BITS_PER_LONG) & ~((ULONG)BITS_PER_LONG - 1)) >> 3) #define FLAG_BYTES(n) (((n + BITS_PER_LONG) & ~((ULONG)BITS_PER_LONG - 1)) >> 3)
#ifndef VMS const UCHAR DEFAULT_DOUBLE = dtype_double;
#define DEFAULT_DOUBLE dtype_double
#else
#define DEFAULT_DOUBLE dtype_double #ifdef VMS
#define SPECIAL_DOUBLE dtype_d_float const UCHAR DEFAULT_DOUBLE = dtype_d_float;
#define CNVT_TO_DFLT(x) MTH$CVT_D_G (x) #define CNVT_TO_DFLT(x) MTH$CVT_D_G (x)
#define CNVT_FROM_DFLT(x) MTH$CVT_G_D (x) #define CNVT_FROM_DFLT(x) MTH$CVT_G_D (x)