You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+38-4Lines changed: 38 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -102,6 +102,36 @@ No dependencies except for the Arduino and ESP32 core SDK. The Sqlite3 code is i
102
102
103
103
Any Flash memory such as those available on SPIFFS or Micro SD cards have limitation on number of writes / erase per sector. Usually the limitation is 10000 writes or 100000 writes (on the same sector). Although ESP32 supports wear-levelling, this is to be kept in mind before venturing into write-intensive database projects. There is no limitation on reading from Flash.
104
104
105
+
## Compression with Shox96
106
+
107
+
This implementation of `sqlite3` includes two functions `shox96_0_2c()` and `shox96_0_2d()` for compressing and decompressing text data.
108
+
109
+
Shox96 is a compression technique developed for reducing storage size of Short Strings. Details of how it works can be found [here](https://github.com/siara-cc/Shox96).
110
+
111
+
As of now it can work on only strings made of 'A to Z', 'a to z', '0-9', Special Characters such as &*() etc. found on keyboard, CR, LF, TAB and Space.
112
+
113
+
In general it can achieve upto 40% size reduction for Short Strings.
114
+
115
+
### Usage
116
+
117
+
The following set of commands demonstrate how compression can be accomplished:
118
+
119
+
```sql
120
+
createtabletest (b1 blob);
121
+
insert into test values (shox96_0_2c('Hello World'));
122
+
insert into test values (shox96_0_2c('Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry''s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.'));
123
+
select txt, length(txt) txt_len from (select shox96_0_2d(b1) txt from test);
124
+
select length(b1) compressed_len from test;
125
+
```
126
+
127
+
See screenshots section for output.
128
+
129
+
### Limitations (for Shox96)
130
+
131
+
- Trying to decompress any blob that was not compressed using `shox96_0_2c()` will crash the program.
132
+
- It does not work if the string has binary characters. that is, other than ASCII 32 to 126, CR, LF and Tab.
133
+
- Dictionary based compression / decompression is not yet implemented.
134
+
105
135
## Acknowledgements
106
136
107
137
* This library was developed based on NodeMCU module developed by [Luiz Felipe Silva](https://github.com/luizfeliperj). The documentation can be found [here](https://nodemcu.readthedocs.io/en/master/en/modules/sqlite3/).
@@ -112,20 +142,24 @@ Any Flash memory such as those available on SPIFFS or Micro SD cards have limita
112
142
113
143
## Screenshots
114
144
115
-
Output of Micro SD example:
145
+
### Output of Micro SD example
116
146
117
147

118
148
119
-
Output of SD Card database query through WebServer example:
149
+
### Output of SD Card database query through WebServer example
120
150
121
151

122
152

123
153
124
-
SQLite console:
154
+
### SQLite console
125
155
126
156

127
157
128
-
Output of Querying StackOverflow DB through WebServer example:
158
+
### Shox96 compression
159
+
160
+

161
+
162
+
### Output of Querying StackOverflow DB through WebServer example:
0 commit comments