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

Function CVT_get_boolean

src/common/cvt.cpp:1343–1381  ·  view source on GitHub ↗

Get the value of a boolean descriptor.

Source from the content-addressed store, hash-verified

1341
1342// Get the value of a boolean descriptor.
1343bool CVT_get_boolean(const dsc* desc, ErrorFunction err)
1344{
1345 switch (desc->dsc_dtype)
1346 {
1347 case dtype_boolean:
1348 return *desc->dsc_address != '\0';
1349
1350 case dtype_varying:
1351 case dtype_cstring:
1352 case dtype_text:
1353 {
1354 VaryStr<TEMP_STR_LENGTH> buffer; // arbitrarily large
1355 const char* p = NULL;
1356 int len = CVT_make_string(desc, ttype_ascii, &p, &buffer, sizeof(buffer), 0, err);
1357
1358 // Remove heading and trailing spaces.
1359
1360 while (len > 0 && isspace((UCHAR) *p))
1361 {
1362 ++p;
1363 --len;
1364 }
1365
1366 while (len > 0 && isspace((UCHAR) p[len - 1]))
1367 --len;
1368
1369 if (len == 4 && fb_utils::strnicmp(p, "TRUE", len) == 0)
1370 return true;
1371 else if (len == 5 && fb_utils::strnicmp(p, "FALSE", len) == 0)
1372 return false;
1373
1374 // fall into
1375 }
1376
1377 default:
1378 CVT_conversion_error(desc, err);
1379 return false; // silence warning
1380 }
1381}
1382
1383
1384double CVT_get_double(const dsc* desc, DecimalStatus decSt, ErrorFunction err, bool* getNumericOverflow)

Callers 3

MOV_get_booleanFunction · 0.85
CVT2_compareFunction · 0.85
CVT_move_commonFunction · 0.85

Calls 3

CVT_make_stringFunction · 0.85
strnicmpFunction · 0.85
CVT_conversion_errorFunction · 0.85

Tested by

no test coverage detected