esp-idf-sql-client

SQL database access example for esp-idf

Stars
7

esp-idf-sql-client

SQL database access example for esp-idf. You can access MySQL/PostgreSQL on the server over the network. Use this as PHP script of WEB server.

Using MySQL

Install php-crud-api according to the following: https://github.com/nopnop2002/esp-idf-sql-client/tree/master/mysql

Using PostgreSQL

Install php-crud-api according to the following: https://github.com/nopnop2002/esp-idf-sql-client/tree/master/pgsql

Software requirements

ESP-IDF V5.x.

Installation

git clone https://github.com/nopnop2002/esp-idf-sql-client
cd esp-idf-sql-client/
idf.py menuconfig
idf.py flash monitor

Configuration

You have to set this config value with menuconfig.

  • CONFIG_ESP_WIFI_SSID
    SSID of your wifi.
  • CONFIG_ESP_WIFI_PASSWORD
    PASSWORD of your wifi.
  • CONFIG_ESP_MAXIMUM_RETRY
    Maximum number of retries when connecting to wifi.
  • CONFIG_ESP_WEB_SERVER_IP
    IP or mDNS of your WEB Server.
  • CONFIG_ESP_WEB_SERVER_PORT
    Port number of your WEB Server.
  • CONFIG_ESP_PHP_PATH
    Path of PHP Script,

Read all data

I (7369) HTTP: -----------------------------------------
I (7379) HTTP: 1        1       1       blog started
I (7379) HTTP: 2        1       2       It works!
I (7379) HTTP: -----------------------------------------

Read by ID

I (18249) HTTP: -----------------------------------------
I (18249) HTTP: 2       1       2       It works!
I (18249) HTTP: -----------------------------------------

Create new record

I (26519) HTTP: -----------------------------------------
I (26519) HTTP: 3       1       3       Hello World
I (26529) HTTP: -----------------------------------------

Update a new record

I (37739) HTTP: -----------------------------------------
I (37749) HTTP: 3       1       3       Hello Japan
I (37749) HTTP: -----------------------------------------

Delete a new record

I (47959) HTTP: -----------------------------------------
I (47959) HTTP: 1       1       1       blog started
I (47969) HTTP: 2       1       2       It works!
I (47969) HTTP: -----------------------------------------