Skip to content

Commit

Permalink
[sqlite] fix some more misuses
Browse files Browse the repository at this point in the history
  • Loading branch information
tstack committed Oct 25, 2024
1 parent 321c0c9 commit 3d8be48
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 8 deletions.
14 changes: 7 additions & 7 deletions src/extension-functions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2672,13 +2672,13 @@ common_extension_functions(struct FuncDef** basic_funcs,

/* Aggregate functions */
static struct FuncDefAgg aAggs[] = {
{"stdev", 1, 0, varianceStep, stdevFinalize},
{"stddev", 1, 0, varianceStep, stdevFinalize},
{"variance", 1, 0, varianceStep, varianceFinalize},
{"mode", 1, 0, modeStep, modeFinalize},
{"median", 1, 0, modeStep, medianFinalize},
{"lower_quartile", 1, 0, modeStep, lower_quartileFinalize},
{"upper_quartile", 1, 0, modeStep, upper_quartileFinalize},
{"stdev", 1, SQLITE_UTF8, 0, varianceStep, stdevFinalize},
{"stddev", 1, SQLITE_UTF8, 0, varianceStep, stdevFinalize},
{"variance", 1, SQLITE_UTF8, 0, varianceStep, varianceFinalize},
{"mode", 1, SQLITE_UTF8, 0, modeStep, modeFinalize},
{"median", 1, SQLITE_UTF8, 0, modeStep, medianFinalize},
{"lower_quartile", 1, SQLITE_UTF8, 0, modeStep, lower_quartileFinalize},
{"upper_quartile", 1, SQLITE_UTF8, 0, modeStep, upper_quartileFinalize},

{nullptr},
};
Expand Down
2 changes: 2 additions & 0 deletions src/json-extension-functions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -860,6 +860,7 @@ json_extension_functions(struct FuncDef** basic_funcs,
{
"json_group_object",
-1,
SQLITE_UTF8 | SQLITE_DETERMINISTIC | SQLITE_RESULT_SUBTYPE,
0,
sql_json_group_object_step,
sql_json_group_object_final,
Expand All @@ -885,6 +886,7 @@ json_extension_functions(struct FuncDef** basic_funcs,
{
"json_group_array",
-1,
SQLITE_UTF8 | SQLITE_DETERMINISTIC | SQLITE_RESULT_SUBTYPE,
0,
sql_json_group_array_step,
sql_json_group_array_final,
Expand Down
2 changes: 1 addition & 1 deletion src/sqlite-extension-func.cc
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ register_sqlite_funcs(sqlite3* db, sqlite_registration_func_t* reg_funcs)
sqlite3_create_function(db,
agg_funcs[i].zName,
agg_funcs[i].nArg,
SQLITE_UTF8,
agg_funcs[i].eTextRep,
(void*) &agg_funcs[i],
nullptr,
agg_funcs[i].xStep,
Expand Down
1 change: 1 addition & 0 deletions src/sqlite-extension-func.hh
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ struct FuncDef {
struct FuncDefAgg {
const char* zName{nullptr};
signed char nArg{0};
int eTextRep{0};
uint8_t needCollSeq{0};
void (*xStep)(sqlite3_context*, int, sqlite3_value**){nullptr};
void (*xFinalize)(sqlite3_context*){nullptr};
Expand Down
2 changes: 2 additions & 0 deletions src/string-extension-functions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1284,6 +1284,7 @@ string_extension_functions(struct FuncDef** basic_funcs,
{
"group_spooky_hash",
-1,
SQLITE_UTF8,
0,
sql_spooky_hash_step,
sql_spooky_hash_final,
Expand All @@ -1303,6 +1304,7 @@ string_extension_functions(struct FuncDef** basic_funcs,
{
"sparkline",
-1,
SQLITE_UTF8,
0,
sparkline_step,
sparkline_final,
Expand Down

0 comments on commit 3d8be48

Please sign in to comment.