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

Function iscArrayLookupBoundsImpl

src/yvalve/array.cpp:145–190  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

143
144
145void iscArrayLookupBoundsImpl(Why::YAttachment* attachment,
146 Why::YTransaction* transaction, const SCHAR* relationName, const SCHAR* fieldName, ISC_ARRAY_DESC* desc)
147{
148 LocalStatus status;
149 CheckStatusWrapper statusWrapper(&status);
150
151 MetaString globalField;
152 iscArrayLookupDescImpl(attachment, transaction, relationName, fieldName, desc, &globalField);
153
154 ISC_ARRAY_BOUND* tail = desc->array_desc_bounds;
155
156 constexpr auto sql = R"""(
157 select fd.rdb$lower_bound,
158 fd.rdb$upper_bound
159 from rdb$field_dimensions fd
160 where fd.rdb$field_name = ?
161 order by fd.rdb$dimension
162 )""";
163
164 FB_MESSAGE(InputMessage, CheckStatusWrapper,
165 (FB_VARCHAR(MAX_SQL_IDENTIFIER_LEN), fieldName)
166 ) inputMessage(&statusWrapper, MasterInterfacePtr());
167 inputMessage.clear();
168
169 FB_MESSAGE(OutputMessage, CheckStatusWrapper,
170 (FB_INTEGER, lowerBound)
171 (FB_INTEGER, upperBound)
172 ) outputMessage(&statusWrapper, MasterInterfacePtr());
173
174 inputMessage->fieldNameNull = FB_FALSE;
175 inputMessage->fieldName.set(globalField.c_str());
176
177 auto resultSet = makeNoIncRef(attachment->openCursor(&statusWrapper, transaction, 0, sql,
178 SQL_DIALECT_CURRENT, inputMessage.getMetadata(), inputMessage.getData(),
179 outputMessage.getMetadata(), nullptr, 0));
180 status.check();
181
182 while (resultSet->fetchNext(&statusWrapper, outputMessage.getData()) == IStatus::RESULT_OK)
183 {
184 tail->array_bound_lower = outputMessage->lowerBoundNull ? 0 : outputMessage->lowerBound;
185 tail->array_bound_upper = outputMessage->upperBoundNull ? 0 : outputMessage->upperBound;
186 ++tail;
187 }
188
189 status.check();
190}
191
192
193void iscArrayLookupDescImpl(Why::YAttachment* attachment,

Callers 1

Calls 11

iscArrayLookupDescImplFunction · 0.85
MasterInterfacePtrClass · 0.85
makeNoIncRefFunction · 0.85
clearMethod · 0.45
setMethod · 0.45
c_strMethod · 0.45
openCursorMethod · 0.45
getMetadataMethod · 0.45
getDataMethod · 0.45
checkMethod · 0.45
fetchNextMethod · 0.45

Tested by

no test coverage detected