MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / getIntField

Function getIntField

src/Server/WebTerminalRequestHandler.cpp:282–292  ·  view source on GitHub ↗

Read a top-level integer field, clamped to [0, max_value]. Returns -1 if the key is missing. Throws on type mismatch.

Source from the content-addressed store, hash-verified

280/// Read a top-level integer field, clamped to [0, max_value]. Returns -1 if
281/// the key is missing. Throws on type mismatch.
282int getIntField(const Poco::JSON::Object::Ptr & object, const char * key, int max_value)
283{
284 if (!object->has(key))
285 return -1;
286 Int64 value = object->getValue<Int64>(key);
287 if (value < 0)
288 return -1;
289 if (value > max_value)
290 return max_value;
291 return static_cast<int>(value);
292}
293
294/// Parse a control message like {"type":"resize","cols":80,"rows":24}.
295bool parseResizeMessage(const String & json, int & cols, int & rows)

Callers 1

parseResizeMessageFunction · 0.85

Calls 1

hasMethod · 0.45

Tested by

no test coverage detected