From 816f1ab962d74feeea2cf21ad75a90addd0ed92e Mon Sep 17 00:00:00 2001 From: Alexander Popov Date: Sat, 11 Jun 2022 02:14:49 +0300 Subject: [PATCH] add sqlite3 C examples --- ~/C/README.md | 9 ++++++++ ~/C/sqlite3_create.c | 52 +++++++++++++++++++++++++++++++++++++++++ ~/C/sqlite3_delete.c | 51 ++++++++++++++++++++++++++++++++++++++++ ~/C/sqlite3_insert.c | 55 ++++++++++++++++++++++++++++++++++++++++++++ ~/C/sqlite3_select.c | 50 ++++++++++++++++++++++++++++++++++++++++ ~/C/sqlite3_update.c | 51 ++++++++++++++++++++++++++++++++++++++++ 6 files changed, 268 insertions(+) create mode 100644 ~/C/README.md create mode 100644 ~/C/sqlite3_create.c create mode 100644 ~/C/sqlite3_delete.c create mode 100644 ~/C/sqlite3_insert.c create mode 100644 ~/C/sqlite3_select.c create mode 100644 ~/C/sqlite3_update.c diff --git a/~/C/README.md b/~/C/README.md new file mode 100644 index 0000000..32e8cbc --- /dev/null +++ b/~/C/README.md @@ -0,0 +1,9 @@ +# C + +## SQLite 3 + +- [CREATE TABLE](sqlite3_create.c) +- [INSERT INTO](sqlite3_insert.c) +- [SELECT](sqlite3_select.c) +- [UPDATE](sqlite3_update.c) +- [DELETE](sqlite3_delete.c) diff --git a/~/C/sqlite3_create.c b/~/C/sqlite3_create.c new file mode 100644 index 0000000..df137a1 --- /dev/null +++ b/~/C/sqlite3_create.c @@ -0,0 +1,52 @@ +#include +#include +#include + +static int callback(void *NotUsed, int argc, char **argv, char **azColName) { + int i; + for(i = 0; i +#include +#include + +static int callback(void *data, int argc, char **argv, char **azColName) { + int i; + fprintf(stderr, "%s: ", (const char*)data); + + for (i = 0; i +#include +#include + +static int callback(void *NotUsed, int argc, char **argv, char **azColName) { + int i; + for (i = 0; i +#include +#include + +static int callback(void *data, int argc, char **argv, char **azColName) { + int i; + fprintf(stderr, "%s: ", (const char*)data); + + for (i = 0; i +#include +#include + +static int callback(void *data, int argc, char **argv, char **azColName) { + int i; + fprintf(stderr, "%s: ", (const char*)data); + + for(i = 0; i