in the shell.c source file ,have a function .read file, and I wanna use it to 
my c++ code, when I hava a sql script file,such as :

create table test (id integer primary key, value text);
insert into test (id, value) values(1, 'eenie');
insert into test (id, value) values(2, 'meenie');
insert into test (value) values('miny');
insert into test (value) values('mo');

now I wanna use the shell.c function to run the script, but I don't know how to 
use c++ code to  achieve the target.
I only found on line in shell.c:

".read FILENAME         Execute SQL in FILENAME\n" in 
"static char zHelp[]"

I suggest it use callback.

static int _is_complete(char *zSql, int nSql){
  int rc;
  if( zSql==0 ) return 1;
  zSql[nSql] = ';';
  zSql[nSql+1] = 0;
  rc = sqlite3_complete(zSql);
  zSql[nSql] = 0;
  return rc;
}
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to