* Return true or false from an expression for conditional purposes. * Non zero numerical values are true, zero and NULL are false. */
| 1841 | * Non zero numerical values are true, zero and NULL are false. |
| 1842 | */ |
| 1843 | static bool |
| 1844 | valueTruth(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 */ |
| 1864 | static bool |
no outgoing calls
no test coverage detected