Skip to content
This repository has been archived by the owner on Jan 29, 2023. It is now read-only.

Commit

Permalink
v1.6.0 to fix memory leak bugs, etc.
Browse files Browse the repository at this point in the history
### Release v1.6.0

1. Fix memory leak bugs. Check [memory leak on 'server_version' #17](#17) and [memory leak on MySQL_Connection.MySQL_Packet.buffer #18](#18)
2. Optimize library code by using `reference-passing` instead of `value-passing`
3. Update RP2040 Ethernet-related examples to use the same SS/CS pin GP17 for [ArduinoCore-mbed mbed_rp2040 core](https://github.com/arduino/ArduinoCore-mbed) as [arduino-pico rp2040 core](https://github.com/earlephilhower/arduino-pico)
4. Update `Packages' Patches`
  • Loading branch information
khoih-prog committed Mar 11, 2022
1 parent 143a292 commit 4866106
Show file tree
Hide file tree
Showing 20 changed files with 328 additions and 1,064 deletions.
10 changes: 5 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ If you don't find anything, please [open a new issue](https://github.com/khoih-p

Please ensure to specify the following:

* Arduino IDE version (e.g. 1.8.16) or Platform.io version
* Board Core Version (e.g. Arduino SAMDUE core v1.6.12, ESP8266 core v3.0.2, ArduinoCore-mbed v2.6.1, etc.)
* Arduino IDE version (e.g. 1.8.19) or Platform.io version
* Board Core Version (e.g. Arduino SAMDUE core v1.6.12, ESP32 core v2.0.2, ESP8266 core v3.0.2, ArduinoCore-mbed v2.7.2, etc.)
* Contextual information (e.g. what you were trying to achieve)
* Simplest possible steps to reproduce
* Anything that might be relevant in your opinion, such as:
Expand All @@ -26,11 +26,11 @@ Please ensure to specify the following:
### Example

```
Arduino IDE version: 1.8.16
Arduino IDE version: 1.8.19
RASPBERRY_PI_PICO board
ArduinoCore-mbed v2.6.1
ArduinoCore-mbed v2.7.2
OS: Ubuntu 20.04 LTS
Linux xy-Inspiron-3593 5.4.0-91-generic #102-Ubuntu SMP Fri Nov 5 16:31:28 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Linux xy-Inspiron-3593 5.13.0-35-generic #40~20.04.1-Ubuntu SMP Mon Mar 7 09:18:32 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Context:
I encountered a crash while trying to use the Timer Interrupt.
Expand Down
939 changes: 117 additions & 822 deletions README.md

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
## Table of Contents

* [Changelog](#changelog)
* [Release v1.6.0](#release-v160)
* [Release v1.5.2](#release-v152)
* [Release v1.5.1](#release-v151)
* [Major Release v1.5.0](#major-release-v150)
Expand All @@ -30,6 +31,13 @@

## Changelog

### Release v1.6.0

1. Fix memory leak bugs. Check [memory leak on 'server_version' #17](https://github.com/khoih-prog/MySQL_MariaDB_Generic/issues/17) and [memory leak on MySQL_Connection.MySQL_Packet.buffer #18](https://github.com/khoih-prog/MySQL_MariaDB_Generic/issues/18)
2. Optimize library code by using `reference-passing` instead of `value-passing`
3. Update RP2040 Ethernet-related examples to use the same SS/CS pin GP17 for [ArduinoCore-mbed mbed_rp2040 core](https://github.com/arduino/ArduinoCore-mbed) as [arduino-pico rp2040 core](https://github.com/earlephilhower/arduino-pico)
4. Update `Packages' Patches`

### Release v1.5.2

1. Auto detect ESP32 core version.
Expand Down
33 changes: 33 additions & 0 deletions keywords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ _state KEYWORD1
# MySQL_Generic_Connection
##############################

SQL_IPAddressToString KEYWORD2
connect KEYWORD2
connectNonBlocking KEYWORD2
connected KEYWORD2
Expand Down Expand Up @@ -85,3 +86,35 @@ READ_COLS KEYWORD3
NOT_CONNECTED KEYWORD3
sha1InitState KEYWORD3

#######################################
# Constants (LITERAL1)
#######################################

MYSQL_GENERIC_VERSION LITERAL1
MYSQL_MARIADB_GENERIC_VERSION LITERAL1
MYSQL_MARIADB_GENERIC_VERSION_MAJOR LITERAL1
MYSQL_MARIADB_GENERIC_VERSION_MINOR LITERAL1
MYSQL_MARIADB_GENERIC_VERSION_PATCH LITERAL1
MYSQL_MARIADB_GENERIC_VERSION_INT LITERAL1

MYSQL_OK_PACKET LITERAL1
MYSQL_EOF_PACKET LITERAL1
MYSQL_ERROR_PACKET LITERAL1

MAX_TRANSMISSION_UNIT LITERAL1

MYSQL_DATA_TIMEOUT LITERAL1
MYSQL_WAIT_INTERVAL LITERAL1

HASH_LENGTH LITERAL1
BLOCK_LENGTH LITERAL1

MYSQL_SHA1_K0 LITERAL1
MYSQL_SHA1_K20 LITERAL1
MYSQL_SHA1_K40 LITERAL1
MYSQL_SHA1_K60 LITERAL1

HMAC_IPAD LITERAL1
HMAC_OPAD LITERAL1


14 changes: 8 additions & 6 deletions library.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "MySQL_MariaDB_Generic",
"version": "1.5.2",
"version": "1.6.0",
"keywords": "Communication, Database, Storage, MySQL, MariaDB, wt32-eth01, Teensy, SAMD, nRF52, W5x00, Ethernet, wifi, wifinina, lan8720, rp2040, nano-33-iot, nano-rp2040-connect, QNEthernet, native-ethernet, Portenta-H7, SAM DUE, ENC28J60, rpi-pico, Arduino, AVR",
"description": "Connects to MySQL or MariaDB using ESP8266/ESP32, WT32_ETH01 (ESP32 + LAN8720A), nRF52, SAMD21/SAMD51, STM32F/L/H/G/WB/MP1, Teensy, SAM DUE, Mega, RP2040-based boards, Portenta_H7, etc. with W5x00, ENC28J60 Ethernet, Teensy 4.1 NativeEthernet/QNEthernet, WiFiNINA modules/shields or Portenta_H7 WiFi/Ethernet. W5x00 can use Ethernet, EthernetLarge, Ethernet2 or Ethernet3 library. ENC28J60 can use either EthernetENC or UIPEthernet Library. Now accepting server's hostname, besides IPAddress",
"authors": [
Expand Down Expand Up @@ -34,7 +34,7 @@
{
"owner": "khoih-prog",
"name": "WiFiNINA_Generic",
"version": "^1.8.14-1",
"version": "^1.8.14-3",
"platforms": ["*"]
},
{
Expand All @@ -46,7 +46,7 @@
{
"owner": "khoih-prog",
"name": "ESP8266_AT_WebServer",
"version": "^1.4.0",
"version": "^1.5.3",
"platforms": ["*"]
},
{
Expand All @@ -70,13 +70,13 @@
{
"owner": "jandrassy",
"name": "EthernetENC",
"version": ">=2.0.1",
"version": ">=2.0.2",
"platforms": ["*"]
},
{
"owner": "jandrassy",
"name": "WiFiEspAT",
"version": ">=1.3.1",
"version": ">=1.3.2",
"platforms": ["*"]
},
{
Expand Down Expand Up @@ -104,8 +104,10 @@
"platforms": ["*"]
},
{
"owner": "ssilverman",
"name": "QNEthernet",
"version": "https://github.com/ssilverman/QNEthernet"
"version": ">=0.13.0",
"platforms": ["teensy"]
}
],
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=MySQL_MariaDB_Generic
version=1.5.2
version=1.6.0
author=Dr. Charles Bell <chuck.bell@oracle.com>, Khoi Hoang <khoih.prog@gmail.com>
maintainer=Khoi Hoang <khoih.prog@gmail.com>
sentence=Connects to MySQL or MariaDB using ESP8266/ESP32, WT32_ETH01 (ESP32 + LAN8720A), nRF52, SAMD21/SAMD51, STM32F/L/H/G/WB/MP1, Teensy, SAM DUE, Mega, RP2040-based boards, Portenta_H7, etc. with W5x00, ENC28J60 Ethernet, Teensy 4.1 NativeEthernet/QNEthernet, WiFiNINA modules/shields or Portenta_H7 WiFi/Ethernet. W5x00 can use Ethernet, EthernetLarge, Ethernet2 or Ethernet3 library. ENC28J60 can use either EthernetENC or UIPEthernet Library.
Expand Down
44 changes: 22 additions & 22 deletions platformio/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -51,34 +51,34 @@ lib_compat_mode = strict

lib_deps =
; PlatformIO 4.x
WiFiNINA_Generic@~1.8.13
WebServer_WT32_ETH01@~1.2.0
Ethernet@~2.0.0
EthernetLarge@~2.0.0
Ethernet2@~1.0.4
Ethernet3@~1.5.5
EthernetENC@~2.0.0
UIPEthernet@~2.0.8
WiFiEspAT@~1.3.1
ESP8266_AT_WebServer@~1.4.0
https://github.com/ssilverman/QNEthernet
; WiFiNINA_Generic@~1.8.14-3
; WebServer_WT32_ETH01@~1.4.1
; Ethernet@~2.0.0
; EthernetLarge@~2.0.0
; Ethernet2@~1.0.4
; Ethernet3@~1.5.5
; EthernetENC@~2.0.0
; UIPEthernet@~2.0.8
; WiFiEspAT@~1.3.2
; ESP8266_AT_WebServer@~1.5.3
; QNEthernet@>=0.13.0
; STM32duino STM32Ethernet@~1.2.0
; STM32duino LwIP@~2.1.2
;
; PlatformIO 5.x
; khoih-prog/WiFiNINA_Generic@~1.8.13
; khoih-prog/WebServer_WT32_ETH01@~1.2.0
; PaulStoffregen/Ethernet@~2.0.0
; PaulStoffregen/EthernetLarge@~2.0.0
; adafruit/Ethernet2@~1.0.4
; sstaub/Ethernet3@~1.5.5
; jandrassy/EthernetENC@~2.0.0
; UIPEthernet/UIPEthernet@~2.0.8
; jandrassy/WiFiEspAT@~1.3.1
; khoih-prog/ESP8266_AT_WebServer@~1.4.0
khoih-prog/WiFiNINA_Generic@~1.8.14-3
khoih-prog/WebServer_WT32_ETH01@~1.4.1
PaulStoffregen/Ethernet@~2.0.0
PaulStoffregen/EthernetLarge@~2.0.0
adafruit/Ethernet2@~1.0.4
sstaub/Ethernet3@~1.5.5
jandrassy/EthernetENC@~2.0.0
UIPEthernet/UIPEthernet@~2.0.8
jandrassy/WiFiEspAT@~1.3.2
khoih-prog/ESP8266_AT_WebServer@~1.5.3
; stm32duino/STM32duino LwIP@~2.1.2
; stm32duino/STM32duino STM32Ethernet@~1.2.0
; https://github.com/ssilverman/QNEthernet
ssilverman/QNEthernet@>=0.13.0


build_flags =
Expand Down
3 changes: 2 additions & 1 deletion src/MySQL_Generic.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
Built by Khoi Hoang https://github.com/khoih-prog/MySQL_MariaDB_Generic
Licensed under MIT license
Version: 1.5.2
Version: 1.6.0
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -28,6 +28,7 @@
1.5.0 K Hoang 17/09/2021 Add support to Portenta_H7, using either WiFi or Vision-shield Ethernet
1.5.1 K Hoang 10/10/2021 Update `platform.ini` and `library.json`
1.5.2 K Hoang 01/12/2021 Auto detect ESP32 core for LittleFS. Fix bug in examples for WT32_ETH01
1.6.0 K Hoang 10/03/2022 Fix memory leak bug. Optimize code.
**********************************************************************************************************************************/

#ifndef MYSQL_GENERIC_H
Expand Down
21 changes: 16 additions & 5 deletions src/MySQL_Generic_Connection.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
Built by Khoi Hoang https://github.com/khoih-prog/MySQL_MariaDB_Generic
Licensed under MIT license
Version: 1.5.2
Version: 1.6.0
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -28,6 +28,7 @@
1.5.0 K Hoang 17/09/2021 Add support to Portenta_H7, using either WiFi or Vision-shield Ethernet
1.5.1 K Hoang 10/10/2021 Update `platform.ini` and `library.json`
1.5.2 K Hoang 01/12/2021 Auto detect ESP32 core for LittleFS. Fix bug in examples for WT32_ETH01
1.6.0 K Hoang 10/03/2022 Fix memory leak bug. Optimize code.
**********************************************************************************************************************************/

/*********************************************************************************************************************************
Expand Down Expand Up @@ -64,14 +65,24 @@ class MySQL_Connection : public MySQL_Packet
public:
MySQL_Connection(Client *client_instance) : MySQL_Packet(client_instance) {}

bool connect(IPAddress server, int port, char *user, char *password, char *db = NULL);
virtual ~MySQL_Connection()
{
if (server_version)
{
MYSQL_LOGDEBUG("Free server_version");

free(server_version);
}
};

bool connect(const IPAddress& server, const uint16_t& port, char *user, char *password, char *db = NULL);

Connection_Result connectNonBlocking(IPAddress server, int port, char *user, char *password, char *db = NULL);
Connection_Result connectNonBlocking(const IPAddress& server, const uint16_t& port, char *user, char *password, char *db = NULL);

// KH, add to use hostname. from v1.4.0
bool connect(const char *hostname, int port, char *user, char *password, char *db = NULL);
bool connect(const char *hostname, const uint16_t& port, char *user, char *password, char *db = NULL);

Connection_Result connectNonBlocking(const char *hostname, int port, char *user, char *password, char *db = NULL);
Connection_Result connectNonBlocking(const char *hostname, const uint16_t& port, char *user, char *password, char *db = NULL);
////////

int connected()
Expand Down
Loading

0 comments on commit 4866106

Please sign in to comment.