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

Method raise

src/jrd/btr.cpp:277–343  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

275// IndexErrorContext class
276
277void IndexErrorContext::raise(thread_db* tdbb, idx_e result, Record* record)
278{
279 fb_assert(result != idx_e_ok);
280
281 if (result == idx_e_conversion || result == idx_e_interrupt)
282 ERR_punt();
283
284 const MetaName& relationName = isLocationDefined ? m_location.relation->rel_name : m_relation->rel_name;
285 const USHORT indexId = isLocationDefined ? m_location.indexId : m_index->idx_id;
286
287 MetaName indexName(m_indexName), constraintName;
288
289 if (indexName.isEmpty())
290 MET_lookup_index(tdbb, indexName, relationName, indexId + 1);
291
292 if (indexName.hasData())
293 MET_lookup_cnstrt_for_index(tdbb, constraintName, indexName);
294 else
295 indexName = "***unknown***";
296
297 const bool haveConstraint = constraintName.hasData();
298
299 if (!haveConstraint)
300 constraintName = "***unknown***";
301
302 switch (result)
303 {
304 case idx_e_keytoobig:
305 ERR_post_nothrow(Arg::Gds(isc_imp_exc) <<
306 Arg::Gds(isc_keytoobig) << Arg::Str(indexName));
307 break;
308
309 case idx_e_foreign_target_doesnt_exist:
310 ERR_post_nothrow(Arg::Gds(isc_foreign_key) <<
311 Arg::Str(constraintName) << Arg::Str(relationName) <<
312 Arg::Gds(isc_foreign_key_target_doesnt_exist));
313 break;
314
315 case idx_e_foreign_references_present:
316 ERR_post_nothrow(Arg::Gds(isc_foreign_key) <<
317 Arg::Str(constraintName) << Arg::Str(relationName) <<
318 Arg::Gds(isc_foreign_key_references_present));
319 break;
320
321 case idx_e_duplicate:
322 if (haveConstraint)
323 {
324 ERR_post_nothrow(Arg::Gds(isc_unique_key_violation) <<
325 Arg::Str(constraintName) << Arg::Str(relationName));
326 }
327 else
328 ERR_post_nothrow(Arg::Gds(isc_no_dup) << Arg::Str(indexName));
329 break;
330
331 default:
332 fb_assert(false);
333 }
334

Callers 15

INET_analyzeFunction · 0.45
select_multiFunction · 0.45
inet_gen_errorFunction · 0.45
raiseExceptionMethod · 0.45
resetClntMethod · 0.45
checkResponseMethod · 0.45
initCompressionMethod · 0.45
handle_errorFunction · 0.45
putSegmentMethod · 0.45
addMethod · 0.45
addBlobMethod · 0.45
appendBlobDataMethod · 0.45

Calls 7

ERR_puntFunction · 0.85
ERR_post_nothrowFunction · 0.85
GdsClass · 0.85
StrClass · 0.85
print_keyFunction · 0.85
isEmptyMethod · 0.45
hasDataMethod · 0.45

Tested by

no test coverage detected