** SQL Function: decimal_cmp(X, Y) ** ** Return negative, zero, or positive if X is less then, equal to, or ** greater than Y. */
| 4792 | ** greater than Y. |
| 4793 | */ |
| 4794 | static 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); |
| 4811 | cmp_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 |
nothing calls this directly
no test coverage detected