SQLite Tutorial
|
|
|
|
| Articles Reviews Structured Query Language | |
| Written by Mike Chirico | |
| Monday, 27 November 2006 | |
|
Page 8 of 12 C and C++ API Simple C Program #include The command to compile and run the program is shown below. Note the "-Wl,-R/usr/local/lib" options, which will be needed if you installed the sqlite3 source, since the path "/usr/local/lib" may not be listed in your "/etc/ld.so.conf" file. gcc -o simplesqlite3 simplesqlite3.c -Wall -W -O 2 -Wl,-R/usr/local/lib -lsqlite3 You either have to use the compile option above or add the directory where the sqlite3 library "libsqlite3.so" is installed to the file "/etc/ld.so.conf", then run ldconfig from the shell. I prefer to use the "-Wl,-R" option instead, but there are the steps.
There are really only three important statements, sqlite3_open(), which takes the name of the database and a database pointer, sqlite3_exec(), which executes the SQL commands in argv[2] and lists the callback function used to display the results, and sqlite3_close(), which closes the database connection. |
|
| Last Updated ( Sunday, 06 January 2008 ) | |
| < Prev | Next > |
|---|







