c++ - Step error in sqlite3_create_function_v2 -
i'm using sqlite3_create_function_v2 define ngram function.
in case step used xfunc pointer, works charm, signature step , xfunc same.
sqlite3_create_function_v2(this->connection, "ngram", 3, sqlite_any, null, sqliteextension::stepextendngram, null, null, null);
when try use step step compiles when execute command ngram fails in prepare statement.
sqlite3_create_function_v2(this->connection, "ngram", 3, sqlite_any, null, null, sqliteextension::stepextendngram, sqliteextension::finalextendngram, null);
the sqliteextension code, test ngram not yet implemented
void sqliteextension::stepextendngram(sqlite3_context *ctx, int narg, sqlite3_value ** val){ //3 params std::cout << "p1 " << sqlite3_value_text(val[0]) << " p2 " << sqlite3_value_text(val[1]) << std::endl; sqlite3_result_int(ctx, atoi((const char*) sqlite3_value_text(val[0]))); } void sqliteextension::finalextendngram(sqlite3_context *ctx){ }
sql call select * tbl_lista ngram(id, "asd", 3) > 1
the first parameter column, second text compare each column, third n param
i "solved" problem. not problem, step/finaize agregate functions need run trough lines return 1 data on finalize. ngram each line, approach dont works.
Comments
Post a Comment