hi ,
i'm a perl programmer who needs some examples (basic and complete and
functional) of c programming code that interface with sqlite. something like
:
1. connect to the database xy
2. create a table xz
3. index a table (create index r1 on ...)
4. insert data that c program is producing into that table
5. close database
my c is very very rusty, in fact i started with c and after 2 weeks turned
to perl
so a complete example of working c code would be more then helpful. some
thing like
#include <stdio.h>
#include <sqlite3.h>
main()
{
typedef struct sqlite sqlite;
#define SQLITE_OK 0 /* Successful result */
#define SQLITE_ERROR 1
char *db = "text";
sqlite *sqlite_open(const char *dbname, int mode, char **errmsg);
int sqlite_exec(
sqlite *db,
char *sql,
int (*xCallback)(void*,int,char**,char**),
void *pArg,
char **errmsg);
char *errmsg = "gr";
int ret = sqlite_exec(db,
"CREATE TABLE table1 ( \n"
" id INTEGER PRIMARY KEY, \n"
" first_name CHAR, \n"
" last_name CHAR, \n"
" email CHAR)", NULL, NULL, errmsg);
if (ret != SQLITE_OK)
{
fprintf(stderr, "SQL error: %s\n", errmsg);
}
sqlite_exec_printf(db,
"INSERT INTO table1 VALUES(1,eeee,rrrr,tttt')",
0, 0, 0, zString);
void sqlite_close(db);
}
but something that is actually working
thank you ,
r
--
View this message in context:
http://www.nabble.com/need-examples-of-sqlite-interface-for-c-tp21519820p21519820.html
Sent from the SQLite mailing list archive at Nabble.com.
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users