#if 0
gcc -s -O2 -o ./sqltest1 sqltest1.c sqlite3.o -ldl -lpthread
exit
#endif

/*
  Test with the command:
    ./sqltest1 2 'create table vt(a integer primary key,b,c) without rowid;'
  It segfaults. If the first argument is 3 or 4 it also segfaults.
*/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "sqlite3.h"

static int count=-1;
static sqlite3*db;

static int xAuth(void*aux,int act,const char*p3,const char*p4,const 
char*p5,const char*p6) {
  fprintf(stderr,"%d: %d %s %s %s %s\n",count,act,p3,p4,p5,p6);
  return count--?SQLITE_OK:SQLITE_DENY;
}

int main(int argc,char**argv) {
  if(argc!=3) return 1;
  if(sqlite3_open(":memory:",&db)) return 1;
  count=strtol(argv[1],0,0);
  sqlite3_set_authorizer(db,xAuth,0);
  printf("%d\n",sqlite3_exec(db,argv[2],0,0,0));
  return 0;
}
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to