MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / lookupCharset

Method lookupCharset

src/jrd/intl.cpp:184–236  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

182
183
184CharSetContainer* CharSetContainer::lookupCharset(thread_db* tdbb, USHORT ttype)
185{
186/**************************************
187 *
188 * l o o k u p C h a r s e t
189 *
190 **************************************
191 *
192 * Functional description
193 *
194 * Lookup a character set descriptor.
195 *
196 * First, search the appropriate vector that hangs
197 * off the dbb. If not found, then call the lower
198 * level lookup routine to allocate it, or punt
199 * if we don't know about the charset.
200 *
201 * Returns:
202 * *charset
203 * <never> - if error
204 *
205 **************************************/
206 CharSetContainer* cs = NULL;
207
208 SET_TDBB(tdbb);
209 Jrd::Attachment* attachment = tdbb->getAttachment();
210 fb_assert(attachment);
211
212 USHORT id = TTYPE_TO_CHARSET(ttype);
213 if (id == CS_dynamic)
214 id = tdbb->getCharSet();
215
216 if (id >= attachment->att_charsets.getCount())
217 attachment->att_charsets.resize(id + 10);
218 else
219 cs = attachment->att_charsets[id];
220
221 // allocate a new character set object if we couldn't find one.
222 if (!cs)
223 {
224 SubtypeInfo info;
225
226 if (lookupInternalCharSet(id, &info) || MET_get_char_coll_subtype_info(tdbb, id, &info))
227 {
228 attachment->att_charsets[id] = cs =
229 FB_NEW_POOL(*attachment->att_pool) CharSetContainer(*attachment->att_pool, id, &info);
230 }
231 else
232 ERR_post(Arg::Gds(isc_text_subtype) << Arg::Num(ttype));
233 }
234
235 return cs;
236}
237
238
239// Lookup a system character set without looking in the database.

Callers

nothing calls this directly

Calls 9

SET_TDBBFunction · 0.85
GdsClass · 0.85
NumClass · 0.85
CharSetContainerClass · 0.70
ERR_postFunction · 0.70
getAttachmentMethod · 0.45
getCharSetMethod · 0.45
getCountMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected