forked from KolibriOS/kolibrios
Added libsqlite3:
Attention! The port is not currently working! SQLITE VFS must be adapted! (The commit was made so as not to lose progress) git-svn-id: svn://kolibrios.org@8760 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
40
contrib/sdk/sources/sqlite3/shell/test.c
Normal file
40
contrib/sdk/sources/sqlite3/shell/test.c
Normal file
@@ -0,0 +1,40 @@
|
||||
#include <sqlite3.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main(void) {
|
||||
|
||||
sqlite3 *db;
|
||||
sqlite3_stmt *res;
|
||||
|
||||
int rc = sqlite3_open(":memory:", &db);
|
||||
|
||||
if (rc != SQLITE_OK) {
|
||||
|
||||
fprintf(stderr, "Cannot open database: %s\n", sqlite3_errmsg(db));
|
||||
sqlite3_close(db);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
rc = sqlite3_prepare_v2(db, "SELECT SQLITE_VERSION()", -1, &res, 0);
|
||||
|
||||
if (rc != SQLITE_OK) {
|
||||
|
||||
fprintf(stderr, "Failed to fetch data: %s\n", sqlite3_errmsg(db));
|
||||
sqlite3_close(db);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
rc = sqlite3_step(res);
|
||||
|
||||
if (rc == SQLITE_ROW) {
|
||||
printf("%s\n", sqlite3_column_text(res, 0));
|
||||
}
|
||||
|
||||
sqlite3_finalize(res);
|
||||
sqlite3_close(db);
|
||||
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user