"baxy77bax" <b...@hi.htnet.hr> wrote in
message news:21519820.p...@talk.nabble.com
> 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

sqlite3* db;
sqlite3_open("/path/to/xy", &db);

> 2. create a table xz

sqlite3_exec(db, "create table xz(n integer);", NULL, NULL, NULL);

> 3. index a table (create index r1 on ...)

sqlite3_exec(db, "create index r1 on xz(n);", NULL, NULL, NULL);

> 4. insert data that c program is producing into that table

sqlite3_stmt* insert_stmt;
sqlite3_prepare(db, "insert into xz(n) values (?);", -1, &insert_stmt, 
NULL);
sqlite3_bind_int(insert_stmt, 1, 42);
sqlite3_step(insert_stmt);
sqlite3_finalize(insert_stmt);

> 5. close database

sqlite3_close(db);

Igor Tandetnik 



_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to