Examples¶
Complete programs in the examples folder of the repository. CI builds the board, ESP-IDF and desktop examples on every pull request.
Arduino¶
In the Arduino IDE, they're under File → Examples → tdslite once the library is installed. Written for an Arduino Uno with an Ethernet shield.
| Example | Shows |
|---|---|
| 01 - Initialize library | Every connection parameter, explained |
| 02 - CRUD with tdslite | Create, read, update and delete |
| 03 - Read rows from table | Reading a result set with a row callback |
| 04 - Read info/error messages | The info callback |
| 05 - Execute query with parameters | execute_rpc with bound parameters |
| 06 - Custom memory allocator functions | Your own malloc and free |
Boards¶
| Example | Board | Shows |
|---|---|---|
| esp_wifi | ESP32, ESP8266 | WiFiClient, parameterized inserts, reading rows back |
| esp_wifi_tls | ESP32, ESP8266 | WiFiClientSecure, TDS 8.0 strict mode |
| uno_wifi_r2 | Arduino Uno WiFi Rev. 2 | WiFiNINA, insert and select |
Projects¶
Complete projects for the ESP32 and the ESP8266, each with a sketch,
setup.sql and queries.sql. Their guides are under
Projects.
| Example | Libraries | Shows |
|---|---|---|
| mqtt_sql_bridge | PubSubClient | Storing MQTT messages; reading JSON payloads in SQL |
| weather_station | Adafruit BME280 | Deep sleep between readings; checks in a stored procedure |
| rfid_attendance | MFRC522 | A lookup and a log in one call; reading bit, nvarchar and NULL |
| energy_monitor | PZEM-004T-v30 | Readings every 10 seconds; consumption reports with window functions |
ESP-IDF¶
| Example | Shows |
|---|---|
| esp-idf/query | socket_driver over Wi-Fi or Ethernet, settings in menuconfig |
| esp-idf/query-tls | esp_tls_driver, an embedded CA certificate, SNTP for certificate dates |
CI builds both with ESP-IDF 5.3 and the latest ESP-IDF, for ESP32, ESP32-C3 and ESP32-S3, and runs an end-to-end test in QEMU.
Desktop¶
| Example | Shows |
|---|---|
| minimal-sql-shell | An interactive SQL shell over the Boost.ASIO backend, printing results as tables |
Build tdslite's CMake project (see
the contributing guide)
and run ./build/bin/tdslite.examples.minimal.