Hello,
I want to compile the simple demo example for version 3 from the documentation
with version 2.8.15. I use 2.8.15, because my embedded sqlite in php works with
2.8.x.
I changed all functions sqlite3... to sqlite... .
If I compile, I get these eroor messages:
sq.c: In function `main':
sq.c:22: Warnung: passing arg 2 of `sqlite_open' makes integer from pointer
without a cast
sq.c:22: error: too few arguments to function `sqlite_open'
sq.c:22: Warnung: assignment makes integer from pointer without a cast
sq.c:34:2: Warnung: no newline at end of file
Have I to change something else?
I appreciate any help.
Thanks,
Daniel
#include <stdio.h>
#include <sqlite.h>
static int callback(void *NotUsed, int argc, char **argv, char **azColName){
int i;
for(i=0; i<argc; i++){
printf("%s = %s\n", azColName[i], argv[i] ? argv[i] : "NULL");
}
printf("\n");
return 0;
}
int main(int argc, char **argv){
sqlite *db;
char *zErrMsg = 0;
int rc;
if( argc!=3 ){
fprintf(stderr, "Usage: %s DATABASE SQL-STATEMENT\n", argv[0]);
exit(1);
}
rc = sqlite_open(argv[1], &db);
if( rc ){
fprintf(stderr, "Can't open database: %s\n", sqlite_errmsg(db));
sqlite_close(db);
exit(1);
}
rc = sqlite_exec(db, argv[2], callback, 0, &zErrMsg);
if( rc!=SQLITE_OK ){
fprintf(stderr, "SQL error: %s\n", zErrMsg);
}
sqlite_close(db);
return 0;
}