From 1117e9ea650a600f395ef44a7b792a5b9434d6c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20St=C3=B6r?= Date: Thu, 15 Feb 2018 23:37:11 +0100 Subject: [PATCH] Add tiny SQLite example --- docs/en/modules/sqlite3.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/docs/en/modules/sqlite3.md b/docs/en/modules/sqlite3.md index 30076eb0..a18f382e 100644 --- a/docs/en/modules/sqlite3.md +++ b/docs/en/modules/sqlite3.md @@ -12,3 +12,21 @@ For instruction on how to use this module or further documentation, please, refe This module is a stripped down version of SQLite, with every possible OMIT_\* configuration enable. The enabled OMIT_\* directives are available in the module's [Makefile](../../../app/sqlite3/Makefile). The SQLite3 module vfs layer integration with NodeMCU was developed by me. + +**Simple example** + +```lua +db = sqlite3.open_memory() + +db:exec[[ + CREATE TABLE test (id INTEGER PRIMARY KEY, content); + + INSERT INTO test VALUES (NULL, 'Hello, World'); + INSERT INTO test VALUES (NULL, 'Hello, Lua'); + INSERT INTO test VALUES (NULL, 'Hello, Sqlite3') +]] + +for row in db:nrows("SELECT * FROM test") do + print(row.id, row.content) +end +``` \ No newline at end of file