From 888174719ed725cebf20efcabb548e398dd59f6f Mon Sep 17 00:00:00 2001 From: asfernandes Date: Wed, 8 Jun 2005 02:09:46 +0000 Subject: [PATCH] Misc. --- src/jrd/dyn_def.epp | 10 ++++++++-- src/jrd/intl.cpp | 6 +++--- src/jrd/met.epp | 6 +++--- src/jrd/met_proto.h | 2 +- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/jrd/dyn_def.epp b/src/jrd/dyn_def.epp index 70f00fc12b..79cb024aa2 100644 --- a/src/jrd/dyn_def.epp +++ b/src/jrd/dyn_def.epp @@ -262,6 +262,11 @@ void DYN_define_collation( Global* gbl, const UCHAR** ptr) break; } + // ASF: Our DDL strings is very weak. + // I've added isc_dyn_coll_specific_attributes_charset to pass the character set of a string. + // It may be the connection charset or some charset specified with INTRODUCER. + // Better approach is to pass DYN strings (including delimited identifiers) with the + // charset and reading it converting to CS_METADATA. case isc_dyn_coll_specific_attributes_charset: specific_attributes_charset = DYN_get_number(ptr); break; @@ -273,7 +278,7 @@ void DYN_define_collation( Global* gbl, const UCHAR** ptr) isc_bpb_target_type, 1, isc_blob_text, isc_bpb_target_interp, 1, 0}; bpb[6] = specific_attributes_charset; // from charset - bpb[12] = CS_UNICODE_FSS; // to charset + bpb[12] = CS_METADATA; // to charset X.RDB$SPECIFIC_ATTRIBUTES.NULL = FALSE; DYN_put_text_blob(gbl, ptr, &X.RDB$SPECIFIC_ATTRIBUTES, sizeof(bpb), bpb); @@ -294,6 +299,7 @@ void DYN_define_collation( Global* gbl, const UCHAR** ptr) strcpy(X.RDB$COLLATION_NAME, collation_name.c_str()); X.RDB$COLLATION_ATTRIBUTES = (info.attributes | attributes_on) & (~attributes_off); + // If isc_dyn_coll_specific_attributes is not provided, then inherit from the base collation if (X.RDB$SPECIFIC_ATTRIBUTES.NULL && info.specificAttributes.getCount() != 0) { X.RDB$SPECIFIC_ATTRIBUTES.NULL = FALSE; @@ -313,7 +319,7 @@ void DYN_define_collation( Global* gbl, const UCHAR** ptr) else info.baseCollationName = X.RDB$BASE_COLLATION_NAME; info.attributes = X.RDB$COLLATION_ATTRIBUTES; - info.ignore_attributes = false; + info.ignoreAttributes = false; if (!IntlManager::collationInstalled(info.baseCollationName, info.charsetName)) { diff --git a/src/jrd/intl.cpp b/src/jrd/intl.cpp index 154efa72d0..ea80ddd76f 100644 --- a/src/jrd/intl.cpp +++ b/src/jrd/intl.cpp @@ -657,14 +657,14 @@ TextType* CharSetContainer::lookupCollation(thread_db* tdbb, USHORT tt_id) { CharSet* charset = INTL_charset_lookup(tdbb, TTYPE_TO_CHARSET(tt_id), NULL); - if (TTYPE_TO_CHARSET(tt_id) != CS_UNICODE_FSS) + if (TTYPE_TO_CHARSET(tt_id) != CS_METADATA) { Firebird::HalfStaticArray specificAttributes; ULONG size = info.specificAttributes.getCount() * charset->maxBytesPerChar(); size = INTL_convert_bytes(tdbb, TTYPE_TO_CHARSET(tt_id), specificAttributes.getBuffer(size), size, - CS_UNICODE_FSS, info.specificAttributes.begin(), + CS_METADATA, info.specificAttributes.begin(), info.specificAttributes.getCount(), ERR_post); specificAttributes.shrink(size); info.specificAttributes = specificAttributes; @@ -773,7 +773,7 @@ static INTL_BOOL lookup_texttype(texttype* tt, const SubtypeInfo* info) { return IntlManager::lookupCollation(info->baseCollationName, info->charsetName, info->attributes, info->specificAttributes.begin(), - info->specificAttributes.getCount(), info->ignore_attributes, tt); + info->specificAttributes.getCount(), info->ignoreAttributes, tt); } diff --git a/src/jrd/met.epp b/src/jrd/met.epp index 3313680839..bd87e5acea 100644 --- a/src/jrd/met.epp +++ b/src/jrd/met.epp @@ -1015,7 +1015,7 @@ bool MET_get_char_coll_subtype_info(thread_db* tdbb, SSHORT id, SubtypeInfo* inf } info->attributes = (USHORT)CL.RDB$COLLATION_ATTRIBUTES; - info->ignore_attributes = CL.RDB$COLLATION_ATTRIBUTES.NULL; + info->ignoreAttributes = CL.RDB$COLLATION_ATTRIBUTES.NULL; END_FOR; } else @@ -1037,8 +1037,8 @@ bool MET_get_char_coll_subtype_info(thread_db* tdbb, SSHORT id, SubtypeInfo* inf info->baseCollationName = info->collationName; info->specificAttributes.clear(); - info->attributes = (USHORT)CL.RDB$COLLATION_ATTRIBUTES; - info->ignore_attributes = true; + info->attributes = 0; + info->ignoreAttributes = true; END_FOR; } diff --git a/src/jrd/met_proto.h b/src/jrd/met_proto.h index 6169d73fa0..2f46600293 100644 --- a/src/jrd/met_proto.h +++ b/src/jrd/met_proto.h @@ -49,7 +49,7 @@ struct SubtypeInfo Firebird::string collationName; Firebird::string baseCollationName; USHORT attributes; - bool ignore_attributes; + bool ignoreAttributes; Firebird::HalfStaticArray specificAttributes; };