MCPcopy Create free account
hub / github.com/GaijinEntertainment/daScript / sqlite3_decimal_init

Function sqlite3_decimal_init

modules/dasSQLITE/sqlite/shell.c:3054–3092  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3052
3053#endif
3054int sqlite3_decimal_init(
3055 sqlite3 *db,
3056 char **pzErrMsg,
3057 const sqlite3_api_routines *pApi
3058){
3059 int rc = SQLITE_OK;
3060 static const struct {
3061 const char *zFuncName;
3062 int nArg;
3063 void (*xFunc)(sqlite3_context*,int,sqlite3_value**);
3064 } aFunc[] = {
3065 { "decimal", 1, decimalFunc },
3066 { "decimal_cmp", 2, decimalCmpFunc },
3067 { "decimal_add", 2, decimalAddFunc },
3068 { "decimal_sub", 2, decimalSubFunc },
3069 { "decimal_mul", 2, decimalMulFunc },
3070 };
3071 unsigned int i;
3072 (void)pzErrMsg; /* Unused parameter */
3073
3074 SQLITE_EXTENSION_INIT2(pApi);
3075
3076 for(i=0; i<(int)(sizeof(aFunc)/sizeof(aFunc[0])) && rc==SQLITE_OK; i++){
3077 rc = sqlite3_create_function(db, aFunc[i].zFuncName, aFunc[i].nArg,
3078 SQLITE_UTF8|SQLITE_INNOCUOUS|SQLITE_DETERMINISTIC,
3079 0, aFunc[i].xFunc, 0, 0);
3080 }
3081 if( rc==SQLITE_OK ){
3082 rc = sqlite3_create_window_function(db, "decimal_sum", 1,
3083 SQLITE_UTF8|SQLITE_INNOCUOUS|SQLITE_DETERMINISTIC, 0,
3084 decimalSumStep, decimalSumFinalize,
3085 decimalSumValue, decimalSumInverse, 0);
3086 }
3087 if( rc==SQLITE_OK ){
3088 rc = sqlite3_create_collation(db, "decimal", SQLITE_UTF8,
3089 0, decimalCollFunc);
3090 }
3091 return rc;
3092}
3093
3094/************************* End ../ext/misc/decimal.c ********************/
3095#undef sqlite3_base_init

Callers 1

open_dbFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected