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

Method save

src/common/StatusHolder.h:75–114  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

73 }
74
75 void save(unsigned int length, const ISC_STATUS* status, bool warningMode) throw()
76 {
77 try
78 {
79 char* oldBuffer = this->prepareForNewValue();
80 ISC_STATUS* b = this->getBuffer(length + 1);
81 unsigned newLen = makeDynamicStrings(length, b, status);
82 delete[] oldBuffer;
83
84 fb_assert(newLen <= length);
85
86 // Sanity check
87 if (newLen < 2)
88 fb_utils::init_status(this->getBuffer(3));
89 else
90 this->resize(newLen + 1);
91 }
92 catch (const BadAlloc&)
93 {
94 if (!warningMode)
95 {
96 // do not use stuff here to avoid endless cycle
97 this->shrink(3);
98 ISC_STATUS* s = this->getBuffer(3); // Should not throw - see assert() in ctor
99 fb_utils::statusBadAlloc(s);
100 }
101 else
102 {
103 this->clear();
104 }
105 }
106 catch (const Exception&)
107 {
108 fb_assert(false);
109
110 this->shrink(3);
111 ISC_STATUS* s = this->getBuffer(3); // Should not throw - see assert() in ctor
112 fb_utils::statusUnknown(s);
113 }
114 }
115
116 ISC_STATUS save(const ISC_STATUS* status, bool warningMode = false) throw()
117 {

Callers 4

setErrorsMethod · 0.45
setErrors2Method · 0.45
setWarningsMethod · 0.45
setWarnings2Method · 0.45

Calls 10

prepareForNewValueMethod · 0.95
clearMethod · 0.95
makeDynamicStringsFunction · 0.85
init_statusFunction · 0.85
statusBadAllocFunction · 0.85
statusUnknownFunction · 0.85
statusLengthFunction · 0.85
getBufferMethod · 0.45
resizeMethod · 0.45
shrinkMethod · 0.45

Tested by

no test coverage detected