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

Commit 4866106

Browse files
authored
v1.6.0 to fix memory leak bugs, etc.
### 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`
1 parent 143a292 commit 4866106

20 files changed

+328
-1064
lines changed

CONTRIBUTING.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ If you don't find anything, please [open a new issue](https://github.com/khoih-p
1414

1515
Please ensure to specify the following:
1616

17-
* Arduino IDE version (e.g. 1.8.16) or Platform.io version
18-
* Board Core Version (e.g. Arduino SAMDUE core v1.6.12, ESP8266 core v3.0.2, ArduinoCore-mbed v2.6.1, etc.)
17+
* Arduino IDE version (e.g. 1.8.19) or Platform.io version
18+
* 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.)
1919
* Contextual information (e.g. what you were trying to achieve)
2020
* Simplest possible steps to reproduce
2121
* Anything that might be relevant in your opinion, such as:
@@ -26,11 +26,11 @@ Please ensure to specify the following:
2626
### Example
2727

2828
```
29-
Arduino IDE version: 1.8.16
29+
Arduino IDE version: 1.8.19
3030
RASPBERRY_PI_PICO board
31-
ArduinoCore-mbed v2.6.1
31+
ArduinoCore-mbed v2.7.2
3232
OS: Ubuntu 20.04 LTS
33-
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
33+
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
3434
3535
Context:
3636
I encountered a crash while trying to use the Timer Interrupt.

README.md

Lines changed: 117 additions & 822 deletions
Large diffs are not rendered by default.

changelog.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
## Table of Contents
1313

1414
* [Changelog](#changelog)
15+
* [Release v1.6.0](#release-v160)
1516
* [Release v1.5.2](#release-v152)
1617
* [Release v1.5.1](#release-v151)
1718
* [Major Release v1.5.0](#major-release-v150)
@@ -30,6 +31,13 @@
3031

3132
## Changelog
3233

34+
### Release v1.6.0
35+
36+
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)
37+
2. Optimize library code by using `reference-passing` instead of `value-passing`
38+
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)
39+
4. Update `Packages' Patches`
40+
3341
### Release v1.5.2
3442

3543
1. Auto detect ESP32 core version.

keywords.txt

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ _state KEYWORD1
2222
# MySQL_Generic_Connection
2323
##############################
2424

25+
SQL_IPAddressToString KEYWORD2
2526
connect KEYWORD2
2627
connectNonBlocking KEYWORD2
2728
connected KEYWORD2
@@ -85,3 +86,35 @@ READ_COLS KEYWORD3
8586
NOT_CONNECTED KEYWORD3
8687
sha1InitState KEYWORD3
8788

89+
#######################################
90+
# Constants (LITERAL1)
91+
#######################################
92+
93+
MYSQL_GENERIC_VERSION LITERAL1
94+
MYSQL_MARIADB_GENERIC_VERSION LITERAL1
95+
MYSQL_MARIADB_GENERIC_VERSION_MAJOR LITERAL1
96+
MYSQL_MARIADB_GENERIC_VERSION_MINOR LITERAL1
97+
MYSQL_MARIADB_GENERIC_VERSION_PATCH LITERAL1
98+
MYSQL_MARIADB_GENERIC_VERSION_INT LITERAL1
99+
100+
MYSQL_OK_PACKET LITERAL1
101+
MYSQL_EOF_PACKET LITERAL1
102+
MYSQL_ERROR_PACKET LITERAL1
103+
104+
MAX_TRANSMISSION_UNIT LITERAL1
105+
106+
MYSQL_DATA_TIMEOUT LITERAL1
107+
MYSQL_WAIT_INTERVAL LITERAL1
108+
109+
HASH_LENGTH LITERAL1
110+
BLOCK_LENGTH LITERAL1
111+
112+
MYSQL_SHA1_K0 LITERAL1
113+
MYSQL_SHA1_K20 LITERAL1
114+
MYSQL_SHA1_K40 LITERAL1
115+
MYSQL_SHA1_K60 LITERAL1
116+
117+
HMAC_IPAD LITERAL1
118+
HMAC_OPAD LITERAL1
119+
120+

library.json

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "MySQL_MariaDB_Generic",
3-
"version": "1.5.2",
3+
"version": "1.6.0",
44
"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",
55
"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",
66
"authors": [
@@ -34,7 +34,7 @@
3434
{
3535
"owner": "khoih-prog",
3636
"name": "WiFiNINA_Generic",
37-
"version": "^1.8.14-1",
37+
"version": "^1.8.14-3",
3838
"platforms": ["*"]
3939
},
4040
{
@@ -46,7 +46,7 @@
4646
{
4747
"owner": "khoih-prog",
4848
"name": "ESP8266_AT_WebServer",
49-
"version": "^1.4.0",
49+
"version": "^1.5.3",
5050
"platforms": ["*"]
5151
},
5252
{
@@ -70,13 +70,13 @@
7070
{
7171
"owner": "jandrassy",
7272
"name": "EthernetENC",
73-
"version": ">=2.0.1",
73+
"version": ">=2.0.2",
7474
"platforms": ["*"]
7575
},
7676
{
7777
"owner": "jandrassy",
7878
"name": "WiFiEspAT",
79-
"version": ">=1.3.1",
79+
"version": ">=1.3.2",
8080
"platforms": ["*"]
8181
},
8282
{
@@ -104,8 +104,10 @@
104104
"platforms": ["*"]
105105
},
106106
{
107+
"owner": "ssilverman",
107108
"name": "QNEthernet",
108-
"version": "https://github.com/ssilverman/QNEthernet"
109+
"version": ">=0.13.0",
110+
"platforms": ["teensy"]
109111
}
110112
],
111113
"license": "MIT",

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=MySQL_MariaDB_Generic
2-
version=1.5.2
2+
version=1.6.0
33
author=Dr. Charles Bell <[email protected]>, Khoi Hoang <[email protected]>
44
maintainer=Khoi Hoang <[email protected]>
55
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.

platformio/platformio.ini

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -51,34 +51,34 @@ lib_compat_mode = strict
5151

5252
lib_deps =
5353
; PlatformIO 4.x
54-
WiFiNINA_Generic@~1.8.13
55-
WebServer_WT32_ETH01@~1.2.0
56-
Ethernet@~2.0.0
57-
EthernetLarge@~2.0.0
58-
Ethernet2@~1.0.4
59-
Ethernet3@~1.5.5
60-
EthernetENC@~2.0.0
61-
UIPEthernet@~2.0.8
62-
WiFiEspAT@~1.3.1
63-
ESP8266_AT_WebServer@~1.4.0
64-
https://github.com/ssilverman/QNEthernet
54+
; WiFiNINA_Generic@~1.8.14-3
55+
; WebServer_WT32_ETH01@~1.4.1
56+
; Ethernet@~2.0.0
57+
; EthernetLarge@~2.0.0
58+
; Ethernet2@~1.0.4
59+
; Ethernet3@~1.5.5
60+
; EthernetENC@~2.0.0
61+
; UIPEthernet@~2.0.8
62+
; WiFiEspAT@~1.3.2
63+
; ESP8266_AT_WebServer@~1.5.3
64+
; QNEthernet@>=0.13.0
6565
; STM32duino STM32Ethernet@~1.2.0
6666
; STM32duino LwIP@~2.1.2
6767
;
6868
; PlatformIO 5.x
69-
; khoih-prog/WiFiNINA_Generic@~1.8.13
70-
; khoih-prog/WebServer_WT32_ETH01@~1.2.0
71-
; PaulStoffregen/Ethernet@~2.0.0
72-
; PaulStoffregen/EthernetLarge@~2.0.0
73-
; adafruit/Ethernet2@~1.0.4
74-
; sstaub/Ethernet3@~1.5.5
75-
; jandrassy/EthernetENC@~2.0.0
76-
; UIPEthernet/UIPEthernet@~2.0.8
77-
; jandrassy/WiFiEspAT@~1.3.1
78-
; khoih-prog/ESP8266_AT_WebServer@~1.4.0
69+
khoih-prog/WiFiNINA_Generic@~1.8.14-3
70+
khoih-prog/WebServer_WT32_ETH01@~1.4.1
71+
PaulStoffregen/Ethernet@~2.0.0
72+
PaulStoffregen/EthernetLarge@~2.0.0
73+
adafruit/Ethernet2@~1.0.4
74+
sstaub/Ethernet3@~1.5.5
75+
jandrassy/EthernetENC@~2.0.0
76+
UIPEthernet/UIPEthernet@~2.0.8
77+
jandrassy/WiFiEspAT@~1.3.2
78+
khoih-prog/ESP8266_AT_WebServer@~1.5.3
7979
; stm32duino/STM32duino LwIP@~2.1.2
8080
; stm32duino/STM32duino STM32Ethernet@~1.2.0
81-
; https://github.com/ssilverman/QNEthernet
81+
ssilverman/QNEthernet@>=0.13.0
8282

8383

8484
build_flags =

src/MySQL_Generic.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
1212
Built by Khoi Hoang https://github.com/khoih-prog/MySQL_MariaDB_Generic
1313
Licensed under MIT license
14-
Version: 1.5.2
14+
Version: 1.6.0
1515
1616
Version Modified By Date Comments
1717
------- ----------- ---------- -----------
@@ -28,6 +28,7 @@
2828
1.5.0 K Hoang 17/09/2021 Add support to Portenta_H7, using either WiFi or Vision-shield Ethernet
2929
1.5.1 K Hoang 10/10/2021 Update `platform.ini` and `library.json`
3030
1.5.2 K Hoang 01/12/2021 Auto detect ESP32 core for LittleFS. Fix bug in examples for WT32_ETH01
31+
1.6.0 K Hoang 10/03/2022 Fix memory leak bug. Optimize code.
3132
**********************************************************************************************************************************/
3233

3334
#ifndef MYSQL_GENERIC_H

src/MySQL_Generic_Connection.h

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
1212
Built by Khoi Hoang https://github.com/khoih-prog/MySQL_MariaDB_Generic
1313
Licensed under MIT license
14-
Version: 1.5.2
14+
Version: 1.6.0
1515
1616
Version Modified By Date Comments
1717
------- ----------- ---------- -----------
@@ -28,6 +28,7 @@
2828
1.5.0 K Hoang 17/09/2021 Add support to Portenta_H7, using either WiFi or Vision-shield Ethernet
2929
1.5.1 K Hoang 10/10/2021 Update `platform.ini` and `library.json`
3030
1.5.2 K Hoang 01/12/2021 Auto detect ESP32 core for LittleFS. Fix bug in examples for WT32_ETH01
31+
1.6.0 K Hoang 10/03/2022 Fix memory leak bug. Optimize code.
3132
**********************************************************************************************************************************/
3233

3334
/*********************************************************************************************************************************
@@ -64,14 +65,24 @@ class MySQL_Connection : public MySQL_Packet
6465
public:
6566
MySQL_Connection(Client *client_instance) : MySQL_Packet(client_instance) {}
6667

67-
bool connect(IPAddress server, int port, char *user, char *password, char *db = NULL);
68+
virtual ~MySQL_Connection()
69+
{
70+
if (server_version)
71+
{
72+
MYSQL_LOGDEBUG("Free server_version");
73+
74+
free(server_version);
75+
}
76+
};
77+
78+
bool connect(const IPAddress& server, const uint16_t& port, char *user, char *password, char *db = NULL);
6879

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

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

74-
Connection_Result connectNonBlocking(const char *hostname, int port, char *user, char *password, char *db = NULL);
85+
Connection_Result connectNonBlocking(const char *hostname, const uint16_t& port, char *user, char *password, char *db = NULL);
7586
////////
7687

7788
int connected()

0 commit comments

Comments
 (0)