SQLite is a relational database management system which is embedded into the end program.
Data type
INTEGER | Integer 64bit |
REAL | Floating point 64bit |
TEXT | Variable-length string (UTF-8/16) |
BLOB | Variable-length binary data |
SQL sample code
SELECT 'Hello,' || 'world';
SELECT "IN" FROM "WHERE";
REPLACE INTO page (title,contents) VALUES(?,?);
Sample code on C
#include <stdio.h>
#include <stdlib.h>
#include <sqlite3.h>
int main(int argc,char **argv)
{
sqlite3 *db;
if (sqlite3_open("test.db", &db) != SQLITE_OK){
fprintf(stderr, "cannot open test.db\n");
exit(1);
}
sqlite3_stmt *st;
if (sqlite3_prepare_v2(db, "SELECT name FROM book WHERE price>?", -1, &st, NULL) != SQLITE_OK) {
fprintf(stderr, "%s\n", sqlite3_errmsg(db));
exit(1);
}
sqlite3_bind_int(st, 0, 100);
while (sqlite3_step(st) == SQLITE_ROW) {
printf("%s\n", sqlite3_column_text(st, 0));
}
sqlite3_finalize(st);
sqlite3_close(db);
return 0;
}