Hi George,
Thanks for the link (http://www.codeproject.com/KB/database/CppSQLite.aspx) that you gave me, it really help me to start progamming in C++. Ok, read the code in http://www.sqlite.org/quickstart.html, but it looks like no SEE implementation. #include <stdio.h> #include <sqlite3.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){ sqlite3 *db; char *zErrMsg = 0; int rc; if( argc!=3 ){ fprintf(stderr, "Usage: %s DATABASE SQL-STATEMENT\n", argv[0]); exit(1); } rc = sqlite3_open(argv[1], &db); if( rc ){ fprintf(stderr, "Can't open database: %s\n", sqlite3_errmsg(db)); sqlite3_close(db); exit(1); } rc = sqlite3_exec(db, argv[2], callback, 0, &zErrMsg); if( rc!=SQLITE_OK ){ fprintf(stderr, "SQL error: %s\n", zErrMsg); sqlite3_free(zErrMsg); } sqlite3_close(db); return 0; } Ok, Since The SEE includes two new APIs: int sqlite3_key( sqlite3 *db, /* The connection from sqlite3_open() */ const void *pKey, /* The key */ int nKey /* Number of bytes in the key */ ); int sqlite_rekey( sqlite *db, /* Database to be rekeyed */ const void *pKey, int nKey /* The new key */ ); So, if I want to connect/open database have to call sqlite3_key() before sqlite3_open(argv[1], &db) function : ..... sqlite3_key(db,..,...); rc = sqlite3_open(argv[1], &db); if( rc ){ fprintf(stderr, "Can't open database: %s\n", sqlite3_errmsg(db)); sqlite3_close(db); exit(1); } ..... Am I right ? Andi On 10/4/09, George Hartzell <hartz...@alerce.com> wrote: > Simon Slavin writes: > > On 4 Oct 2009, at 3:08am, Andi Suhandi wrote: > > > > > Since SQLite support C++, I have to ask these questions > > > > You could ask somewhere else. > > > > SQLite supports C. It does not support C++, it just doesn't violate > > it. There is nothing in SQLite that takes any advantage of anything > > the '++' adds: SQLite does not use C++ internally, and it has no > > special interface for C++ apart from the one for C. > > > > If people want to invent languages which are a superset of C, that's > > fine, but we can't be expected to be familiar with every language > > that's a superset of C. There are too many of them. > > > > From your earlier post: > > > > > Are there anyone can give simple sample code in Visual C++ > > > > > > 74,100 web pages have something to say about it, according to Google. > > Start with one of those. If you have sample code that isn't working, > > post a minimal extract here, tell us how it fails, and we'll try to > > figure out what's wrong. > > I'm new to the sqlite list, not sure what the tone is supposed to be. > I thought I'd make a helpful comment. > > I don't know the wiki well, there are at least some minimal examples > here: > > http://www.sqlite.org/quickstart.html > > If you look around the wiki you might find more. > > If you google 'sqlite c sample' it'll get you a bunch of links that > you might find helpful. Here are two that I found on the first page > of hits that didn't seem insane. > > http://freshmeat.net/articles/sqlite-tutorial > http://www.codeproject.com/KB/database/CppSQLite.aspx > > I think that you'll generally find the Internet more helpful if you > ask specific questions and do your homework first. Otherwise people > will just flame at you. > > g. > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > -- Andi Suhandi Software Engineer PT. Informatika Lintasnusa www.informatika.co.id _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users