MCPcopy Create free account
hub / github.com/audacity/audacity / decimalCmpFunc

Function decimalCmpFunc

lib-src/sqlite/shell.c:4794–4814  ·  view source on GitHub ↗

** SQL Function: decimal_cmp(X, Y) ** ** Return negative, zero, or positive if X is less then, equal to, or ** greater than Y. */

Source from the content-addressed store, hash-verified

4792** greater than Y.
4793*/
4794static void decimalCmpFunc(
4795 sqlite3_context *context,
4796 int argc,
4797 sqlite3_value **argv
4798){
4799 Decimal *pA = 0, *pB = 0;
4800 int rc;
4801
4802 UNUSED_PARAMETER(argc);
4803 pA = decimal_new(context, argv[0], 0, 0);
4804 if( pA==0 || pA->isNull ) goto cmp_done;
4805 pB = decimal_new(context, argv[1], 0, 0);
4806 if( pB==0 || pB->isNull ) goto cmp_done;
4807 rc = decimal_cmp(pA, pB);
4808 if( rc<0 ) rc = -1;
4809 else if( rc>0 ) rc = +1;
4810 sqlite3_result_int(context, rc);
4811cmp_done:
4812 decimal_free(pA);
4813 decimal_free(pB);
4814}
4815
4816/*
4817** Expand the Decimal so that it has a least nDigit digits and nFrac

Callers

nothing calls this directly

Calls 3

decimal_newFunction · 0.85
decimal_cmpFunction · 0.85
decimal_freeFunction · 0.85

Tested by

no test coverage detected