void *sqlite3_user_data(sqlite3_context*);

This API function returns the user data pointer previously provided to the scalar or aggregate function associated with the given SQLite context. Specifically, this pointer is assigned to the arg member of the struct qdb_function object used to register the function. The scalar or aggregate function code can then call sqlite3_user_data() to access the user data.