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

Method info

src/dsql/DsqlBatch.cpp:1022–1118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1020}
1021
1022void DsqlBatch::info(thread_db* tdbb, unsigned int itemsLength, const unsigned char* items,
1023 unsigned int bufferLength, unsigned char* buffer)
1024{
1025 // Sanity check
1026 if (bufferLength < 3) // bigger values will be processed by later code OK
1027 {
1028 if (bufferLength-- > 0)
1029 {
1030 *buffer++ = isc_info_truncated;
1031 if (bufferLength-- > 0)
1032 *buffer++ = isc_info_end;
1033 }
1034 return;
1035 }
1036
1037 ClumpletReader it(ClumpletReader::InfoItems, items, itemsLength);
1038 ClumpletWriter out(ClumpletReader::InfoResponse, bufferLength - 1); // place for isc_info_truncated / isc_info_end
1039 enum BufCloseState {BUF_OPEN, BUF_INTERNAL, BUF_END};
1040 BufCloseState closeOut = BUF_OPEN;
1041
1042 try
1043 {
1044 bool flInfoLength = false;
1045
1046 for (it.rewind(); !it.isEof(); it.moveNext())
1047 {
1048 UCHAR item = it.getClumpTag();
1049 if (item == isc_info_end)
1050 break;
1051
1052 switch(item)
1053 {
1054 case IBatch::INF_BUFFER_BYTES_SIZE:
1055 out.insertInt(item, m_messages.getCapacity());
1056 break;
1057 case IBatch::INF_DATA_BYTES_SIZE:
1058 out.insertInt(item, FB_ALIGN(m_messages.getSize(), m_alignment));
1059 break;
1060 case IBatch::INF_BLOBS_BYTES_SIZE:
1061 if (m_blobs.getSize())
1062 out.insertInt(item, m_blobs.getSize());
1063 break;
1064 case IBatch::INF_BLOB_ALIGNMENT:
1065 out.insertInt(item, BLOB_STREAM_ALIGN);
1066 break;
1067 case IBatch::INF_BLOB_HEADER:
1068 out.insertInt(item, SIZEOF_BLOB_HEAD);
1069 break;
1070 case isc_info_length:
1071 flInfoLength = true;
1072 break;
1073 default:
1074 out.insertInt(isc_info_error, isc_infunk);
1075 break;
1076 }
1077 }
1078
1079 // finalize writer

Callers 1

getInfoMethod · 0.45

Calls 12

FB_ALIGNFunction · 0.85
getClumpTagMethod · 0.80
hasOverflowMethod · 0.80
rewindMethod · 0.45
isEofMethod · 0.45
moveNextMethod · 0.45
insertIntMethod · 0.45
getCapacityMethod · 0.45
getSizeMethod · 0.45
insertTagMethod · 0.45
getBufferLengthMethod · 0.45
getBufferMethod · 0.45

Tested by

no test coverage detected