| 1158 | |
| 1159 | |
| 1160 | USHORT INTL_string_to_key(thread_db* tdbb, |
| 1161 | USHORT idxType, |
| 1162 | const dsc* pString, |
| 1163 | DSC* pByte, |
| 1164 | USHORT key_type) |
| 1165 | { |
| 1166 | /************************************** |
| 1167 | * |
| 1168 | * I N T L _ s t r i n g _ t o _ k e y |
| 1169 | * |
| 1170 | ************************************** |
| 1171 | * |
| 1172 | * Functional description |
| 1173 | * Given an input string, convert it to a byte string |
| 1174 | * that will collate naturally (byte order). |
| 1175 | * |
| 1176 | * Return the length of the resulting byte string. |
| 1177 | * |
| 1178 | **************************************/ |
| 1179 | |
| 1180 | SET_TDBB(tdbb); |
| 1181 | |
| 1182 | fb_assert(idxType >= idx_first_intl_string || idxType == idx_string || |
| 1183 | idxType == idx_byte_array || idxType == idx_metadata); |
| 1184 | fb_assert(pString != NULL); |
| 1185 | fb_assert(pByte != NULL); |
| 1186 | fb_assert(pString->dsc_address != NULL); |
| 1187 | fb_assert(pByte->dsc_address != NULL); |
| 1188 | fb_assert(pByte->dsc_dtype == dtype_text); |
| 1189 | |
| 1190 | UCHAR pad_char; |
| 1191 | USHORT ttype; |
| 1192 | |
| 1193 | switch (idxType) |
| 1194 | { |
| 1195 | case idx_string: |
| 1196 | pad_char = ' '; |
| 1197 | ttype = ttype_none; |
| 1198 | break; |
| 1199 | case idx_byte_array: |
| 1200 | pad_char = 0; |
| 1201 | ttype = ttype_binary; |
| 1202 | break; |
| 1203 | case idx_metadata: |
| 1204 | pad_char = ' '; |
| 1205 | ttype = ttype_metadata; |
| 1206 | break; |
| 1207 | default: |
| 1208 | pad_char = 0; |
| 1209 | ttype = INTL_INDEX_TO_TEXT(idxType); |
| 1210 | break; |
| 1211 | } |
| 1212 | |
| 1213 | // Make a string into the proper type of text |
| 1214 | |
| 1215 | MoveBuffer temp; |
| 1216 | UCHAR* src; |
| 1217 | USHORT len = MOV_make_string2(tdbb, pString, ttype, &src, temp); |
no test coverage detected