Have you checked to ensure that you database handle is correct? Your function inherits it as user data, but is it corrupted?

[EMAIL PROTECTED] wrote:


 I'm getting "Library routine called out of sequence" when I try to execute an 
insertion inside an aggregate that I have created myself. Here's a sample c program:

#include <sqlite3.h>
#include <stdio.h>

void MyAggregateFuncStep(sqlite3_context* context,int argc,sqlite3_value** 
argv) {
//  Do nothing
}

void MyAggregateFuncFinal(sqlite3_context* context) {
  sqlite3 *db;
  char *e;
  db=sqlite3_user_data(context);
  sqlite3_exec(db,"insert into t2 values(0);",NULL,NULL,&e);
  if (e) printf("MyAggregateFuncFinal: %s\n",e);
  sqlite3_result_null(context);
}

main() {
  sqlite3 *db;
  char *e;
  sqlite3_open(NULL,&db);
  sqlite3_create_function(db,"MyAggregateFunc",1,SQLITE_ANY,db,NULL,
                          MyAggregateFuncStep,MyAggregateFuncFinal);
  sqlite3_exec(db,"create table t1(a integer);\
                   create table t2(a integer);\
                   insert into t1 values(0);\
                   select MyAggregateFunc(a) from t1;",NULL,NULL,&e);
  if (e) printf("main: %s\n",e);
};


There seems to be no problem with scalar functions.

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------



-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to