MCPcopy Create free account
hub / github.com/apache/cloudberry / valueTruth

Function valueTruth

src/bin/pgbench/pgbench.c:1843–1861  ·  view source on GitHub ↗

* Return true or false from an expression for conditional purposes. * Non zero numerical values are true, zero and NULL are false. */

Source from the content-addressed store, hash-verified

1841 * Non zero numerical values are true, zero and NULL are false.
1842 */
1843static bool
1844valueTruth(PgBenchValue *pval)
1845{
1846 switch (pval->type)
1847 {
1848 case PGBT_NULL:
1849 return false;
1850 case PGBT_BOOLEAN:
1851 return pval->u.bval;
1852 case PGBT_INT:
1853 return pval->u.ival != 0;
1854 case PGBT_DOUBLE:
1855 return pval->u.dval != 0.0;
1856 default:
1857 /* internal error, unexpected type */
1858 Assert(0);
1859 return false;
1860 }
1861}
1862
1863/* get a value as an int, tell if there is a problem */
1864static bool

Callers 2

evalLazyFuncFunction · 0.85
executeMetaCommandFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected