cordova-sqlite-evmax-build-free 0.0.4 → 0.0.6-voltbuild-test01
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGES.md +29 -1
- package/README.md +37 -32
- package/package.json +4 -7
- package/plugin.xml +21 -6
- package/spec/www/index.html +1 -0
- package/spec/www/spec/blobfrombase64-test.js +159 -0
- package/spec/www/spec/db-open-close-delete-test.js +3 -1
- package/spec/www/spec/db-tx-string-test.js +10 -13
- package/spec/www/spec/db-tx-value-bindings-test.js +6 -7
- package/spec/www/spec/sqlite-version-test.js +4 -1
- package/src/android/io/sqlc/SQLitePlugin.java +6 -3
- package/src/deps/android/sqlc-evplus-ndk-driver.jar +0 -0
- package/src/deps/common/{libb64-encode → libb64-core}/LICENSE +0 -0
- package/src/deps/common/libb64-core/README.md +31 -0
- package/src/deps/common/libb64-core/cdecode.c +93 -0
- package/src/deps/common/libb64-core/cdecode.h +29 -0
- package/src/deps/common/{libb64-encode → libb64-core}/cencode.c +0 -0
- package/src/deps/common/{libb64-encode → libb64-core}/cencode.h +0 -0
- package/src/deps/common/sqlite3-base64/README.md +18 -4
- package/src/deps/common/sqlite3-base64/sqlite3_base64.c +37 -2
- package/src/deps/common/sqlite3.c +13097 -7056
- package/src/deps/common/sqlite3.h +459 -64
- package/src/windows/SQLite3-WinRT-sync/SQLite3/SQLite3.Shared.vcxitems +7 -3
- package/src/windows/SQLite3-WinRT-sync/SQLite3/SQLite3.UWP.vcxproj +2 -2
- package/src/windows/SQLite3-WinRT-sync/SQLite3/SQLite3.sln +0 -4
- package/src/windows/libs/x64/BarcodeComponent.winmd +0 -0
- package/src/windows/libs/x64/SQLite3.UWP.dll +0 -0
- package/src/windows/libs/x64/SQLite3.winmd +0 -0
- package/src/windows/libs/x86/BarcodeComponent.winmd +0 -0
- package/src/windows/libs/x86/SQLite3.UWP.dll +0 -0
- package/src/windows/libs/x86/SQLite3.winmd +0 -0
- package/src/deps/common/libb64-encode/README.md +0 -27
|
@@ -531,8 +531,8 @@ var mytests = function() {
|
|
|
531
531
|
});
|
|
532
532
|
}, MYTIMEOUT);
|
|
533
533
|
|
|
534
|
-
//
|
|
535
|
-
// on
|
|
534
|
+
// ENCODING ISSUE NOW FIXED with emojis and other 4-byte UTF-8 characters
|
|
535
|
+
// on default Android evcore NDK implementation
|
|
536
536
|
// ref:
|
|
537
537
|
// - litehelpers/Cordova-sqlite-evcore-extbuild-free#44
|
|
538
538
|
// - litehelpers/Cordova-sqlite-storage#564
|
|
@@ -556,9 +556,9 @@ var mytests = function() {
|
|
|
556
556
|
var row = rs2.rows.item(0);
|
|
557
557
|
// [evplus] NOW FIXED (...)
|
|
558
558
|
// Full object check:
|
|
559
|
-
|
|
559
|
+
expect(row).toEqual({data: '@\uD83D\uDE03!'});
|
|
560
560
|
// Check individual members:
|
|
561
|
-
|
|
561
|
+
expect(row.data).toBe('@\uD83D\uDE03!');
|
|
562
562
|
|
|
563
563
|
tx.executeSql('SELECT HEX(data) AS hexvalue FROM test_table', [], function(tx_ignored, rs3) {
|
|
564
564
|
expect(rs3).toBeDefined();
|
|
@@ -591,7 +591,7 @@ var mytests = function() {
|
|
|
591
591
|
// ref:
|
|
592
592
|
// - litehelpers/Cordova-sqlite-evcore-extbuild-free#43
|
|
593
593
|
// - litehelpers/Cordova-sqlite-storage#564
|
|
594
|
-
it(suiteName + 'INSERT TEXT string with 25 emojis, SELECT the data, and check
|
|
594
|
+
it(suiteName + 'INSERT TEXT string with 25 emojis, SELECT the data, and check' , function(done) {
|
|
595
595
|
// ref:
|
|
596
596
|
// - litehelpers/Cordova-sqlite-evcore-extbuild-free#44
|
|
597
597
|
// - litehelpers/Cordova-sqlite-storage#564
|
|
@@ -614,8 +614,7 @@ var mytests = function() {
|
|
|
614
614
|
expect(rs2.rows.length).toBe(1);
|
|
615
615
|
|
|
616
616
|
var row = rs2.rows.item(0);
|
|
617
|
-
|
|
618
|
-
expect(row.data).toBe(part + part + part + part + part);
|
|
617
|
+
expect(row.data).toBe(part + part + part + part + part);
|
|
619
618
|
|
|
620
619
|
// Close (plugin only) & finish:
|
|
621
620
|
(isWebSql) ? done() : db.close(done, done);
|
|
@@ -104,7 +104,10 @@ var mytests = function() {
|
|
|
104
104
|
expect(rs).toBeDefined();
|
|
105
105
|
expect(rs.rows).toBeDefined();
|
|
106
106
|
expect(rs.rows.length).toBe(1);
|
|
107
|
-
|
|
107
|
+
if (isAndroid)
|
|
108
|
+
expect(rs.rows.item(0).myResult).toBe('3.38.5');
|
|
109
|
+
else
|
|
110
|
+
expect(rs.rows.item(0).myResult).toBe('3.40.0');
|
|
108
111
|
|
|
109
112
|
// Close (plugin only) & finish:
|
|
110
113
|
(isWebSql) ? done() : db.close(done, done);
|
|
@@ -410,7 +410,7 @@ public class SQLitePlugin extends CordovaPlugin {
|
|
|
410
410
|
@Override
|
|
411
411
|
void closeDatabaseNow() {
|
|
412
412
|
try {
|
|
413
|
-
if (mydbhandle
|
|
413
|
+
if (mydbhandle != EVNDKDriver.SQLC_NULL_HANDLE) EVNDKDriver.sqlc_db_close(mydbhandle);
|
|
414
414
|
} catch (Exception e) {
|
|
415
415
|
Log.e(SQLitePlugin.class.getSimpleName(), "couldn't close database, ignoring", e);
|
|
416
416
|
}
|
|
@@ -423,8 +423,11 @@ public class SQLitePlugin extends CordovaPlugin {
|
|
|
423
423
|
void bugWorkaround() { }
|
|
424
424
|
|
|
425
425
|
/* ** NOT USED in this plugin version:
|
|
426
|
-
String flatBatchJSON(
|
|
427
|
-
|
|
426
|
+
String flatBatchJSON(String batch_json, int ll) {
|
|
427
|
+
long ch = EVNDKDriver.sqlc_evcore_db_new_qc(mydbhandle);
|
|
428
|
+
String jr = EVNDKDriver.sqlc_evcore_qc_execute(ch, batch_json, ll);
|
|
429
|
+
EVNDKDriver.sqlc_evcore_qc_finalize(ch);
|
|
430
|
+
return jr;
|
|
428
431
|
}
|
|
429
432
|
// ** */
|
|
430
433
|
}
|
|
Binary file
|
|
File without changes
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
libb64: Base64 C Routines
|
|
2
|
+
=========================
|
|
3
|
+
|
|
4
|
+
From projects:
|
|
5
|
+
|
|
6
|
+
- <https://github.com/gorb314/libb64>
|
|
7
|
+
- <http://libb64.sourceforge.net/> (latest CVS source from <http://libb64.cvs.sourceforge.net/viewvc/libb64/>)
|
|
8
|
+
|
|
9
|
+
LICENSE:
|
|
10
|
+
--------
|
|
11
|
+
|
|
12
|
+
Public domain
|
|
13
|
+
|
|
14
|
+
Authors:
|
|
15
|
+
--------
|
|
16
|
+
|
|
17
|
+
- Chris Venter ([@gorb314](https://github.com/gorb314))
|
|
18
|
+
- Christopher J. Brody ([@brodybits](https://github.com/brodybits))
|
|
19
|
+
|
|
20
|
+
Major changes:
|
|
21
|
+
--------------
|
|
22
|
+
|
|
23
|
+
- Use macro instead of function to encode each value
|
|
24
|
+
- Line breaks disabled in cencode.c by default
|
|
25
|
+
- Flatter include statements to make iOS build easier
|
|
26
|
+
|
|
27
|
+
Other versions:
|
|
28
|
+
---------------
|
|
29
|
+
|
|
30
|
+
- <https://github.com/gorb314/libb64>
|
|
31
|
+
- <https://github.com/libb64/libb64>
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/*
|
|
2
|
+
cdecoder.c - c source to a base64 decoding algorithm implementation
|
|
3
|
+
|
|
4
|
+
This is part of the libb64 project, and has been placed in the public domain.
|
|
5
|
+
For details, see http://sourceforge.net/projects/libb64
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#include "cdecode.h"
|
|
9
|
+
|
|
10
|
+
int base64_decode_value(char value_in)
|
|
11
|
+
{
|
|
12
|
+
static const char decoding[] = {62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,-2,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51};
|
|
13
|
+
static const char decoding_size = sizeof(decoding);
|
|
14
|
+
value_in -= 43;
|
|
15
|
+
if (value_in < 0 || value_in >= decoding_size) return -1;
|
|
16
|
+
return decoding[(int)value_in];
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
void base64_init_decodestate(base64_decodestate* state_in)
|
|
20
|
+
{
|
|
21
|
+
state_in->step = step_a;
|
|
22
|
+
state_in->plainchar = 0;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
int base64_decode_block(const char* code_in, const int length_in, char* plaintext_out, base64_decodestate* state_in)
|
|
26
|
+
{
|
|
27
|
+
const char* codechar = code_in;
|
|
28
|
+
char* plainchar = plaintext_out;
|
|
29
|
+
int value;
|
|
30
|
+
char fragment;
|
|
31
|
+
|
|
32
|
+
*plainchar = state_in->plainchar;
|
|
33
|
+
|
|
34
|
+
switch (state_in->step)
|
|
35
|
+
{
|
|
36
|
+
while (1)
|
|
37
|
+
{
|
|
38
|
+
case step_a:
|
|
39
|
+
do {
|
|
40
|
+
if (codechar == code_in+length_in)
|
|
41
|
+
{
|
|
42
|
+
state_in->step = step_a;
|
|
43
|
+
state_in->plainchar = *plainchar;
|
|
44
|
+
return plainchar - plaintext_out;
|
|
45
|
+
}
|
|
46
|
+
value = base64_decode_value(*codechar++);
|
|
47
|
+
fragment = (char)value;
|
|
48
|
+
} while (value < 0);
|
|
49
|
+
*plainchar = (fragment & 0x03f) << 2;
|
|
50
|
+
case step_b:
|
|
51
|
+
do {
|
|
52
|
+
if (codechar == code_in+length_in)
|
|
53
|
+
{
|
|
54
|
+
state_in->step = step_b;
|
|
55
|
+
state_in->plainchar = *plainchar;
|
|
56
|
+
return plainchar - plaintext_out;
|
|
57
|
+
}
|
|
58
|
+
value = base64_decode_value(*codechar++);
|
|
59
|
+
fragment = (char)value;
|
|
60
|
+
} while (value < 0);
|
|
61
|
+
*plainchar++ |= (fragment & 0x030) >> 4;
|
|
62
|
+
*plainchar = (fragment & 0x00f) << 4;
|
|
63
|
+
case step_c:
|
|
64
|
+
do {
|
|
65
|
+
if (codechar == code_in+length_in)
|
|
66
|
+
{
|
|
67
|
+
state_in->step = step_c;
|
|
68
|
+
state_in->plainchar = *plainchar;
|
|
69
|
+
return plainchar - plaintext_out;
|
|
70
|
+
}
|
|
71
|
+
value = base64_decode_value(*codechar++);
|
|
72
|
+
fragment = (char)value;
|
|
73
|
+
} while (value < 0);
|
|
74
|
+
*plainchar++ |= (fragment & 0x03c) >> 2;
|
|
75
|
+
*plainchar = (fragment & 0x003) << 6;
|
|
76
|
+
case step_d:
|
|
77
|
+
do {
|
|
78
|
+
if (codechar == code_in+length_in)
|
|
79
|
+
{
|
|
80
|
+
state_in->step = step_d;
|
|
81
|
+
state_in->plainchar = *plainchar;
|
|
82
|
+
return plainchar - plaintext_out;
|
|
83
|
+
}
|
|
84
|
+
value = base64_decode_value(*codechar++);
|
|
85
|
+
fragment = (char)value;
|
|
86
|
+
} while (value < 0);
|
|
87
|
+
*plainchar++ |= (fragment & 0x03f);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
/* control should not reach here */
|
|
91
|
+
return plainchar - plaintext_out;
|
|
92
|
+
}
|
|
93
|
+
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*
|
|
2
|
+
cdecode.h - c header for a base64 decoding algorithm
|
|
3
|
+
|
|
4
|
+
This is part of the libb64 project, and has been placed in the public domain.
|
|
5
|
+
For details, see http://sourceforge.net/projects/libb64
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#ifndef BASE64_CDECODE_H
|
|
9
|
+
#define BASE64_CDECODE_H
|
|
10
|
+
|
|
11
|
+
typedef enum
|
|
12
|
+
{
|
|
13
|
+
step_a, step_b, step_c, step_d
|
|
14
|
+
} base64_decodestep;
|
|
15
|
+
|
|
16
|
+
typedef struct
|
|
17
|
+
{
|
|
18
|
+
base64_decodestep step;
|
|
19
|
+
char plainchar;
|
|
20
|
+
} base64_decodestate;
|
|
21
|
+
|
|
22
|
+
void base64_init_decodestate(base64_decodestate* state_in);
|
|
23
|
+
|
|
24
|
+
int base64_decode_value(char value_in);
|
|
25
|
+
|
|
26
|
+
int base64_decode_block(const char* code_in, const int length_in, char* plaintext_out, base64_decodestate* state_in);
|
|
27
|
+
|
|
28
|
+
#endif /* BASE64_CDECODE_H */
|
|
29
|
+
|
|
File without changes
|
|
File without changes
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
# sqlite3-base64
|
|
2
2
|
|
|
3
|
-
Add
|
|
3
|
+
Add base-64 encoding & decoding functions to SQLite3:
|
|
4
|
+
|
|
5
|
+
- `BASE64`
|
|
6
|
+
- `BLOBFROMBASE64`
|
|
4
7
|
|
|
5
8
|
**LICENSE:** UNLICENSE (public domain) ref: <http://unlicense.org/>
|
|
6
9
|
|
|
7
10
|
## External dependencies
|
|
8
11
|
|
|
9
|
-
- `cencode.h`, `cencode.c` from <
|
|
12
|
+
- `cencode.h`, `cencode.c`, `cdecode.h`, `cdecode.c` from <https://github.com/gorb314/libb64> or a fork such as <https://github.com/brodybits/libb64-core> (public domain)
|
|
10
13
|
- `sqlite3.h`
|
|
11
14
|
|
|
12
|
-
**NOTE:** `cencode.h` must be in the build path.
|
|
15
|
+
**NOTE:** `cencode.h` and `cdecode.h` must be in the build path.
|
|
13
16
|
|
|
14
17
|
## Sample usage
|
|
15
18
|
|
|
@@ -24,4 +27,15 @@ Then the following SQL:
|
|
|
24
27
|
SELECT BASE64(X'010203')
|
|
25
28
|
```
|
|
26
29
|
|
|
27
|
-
returns the following value
|
|
30
|
+
returns the following value _ending with a newline (`\n`)_:
|
|
31
|
+
```
|
|
32
|
+
AQID
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
And the following SQL:
|
|
36
|
+
|
|
37
|
+
```sql
|
|
38
|
+
SELECT HEX(BLOBFROMBASE64('AQID'))
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
returns the following value: `010203`
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
#include "cencode.h"
|
|
4
4
|
|
|
5
|
+
#include "cdecode.h"
|
|
6
|
+
|
|
5
7
|
#include <string.h>
|
|
6
8
|
#include <stdint.h>
|
|
7
9
|
|
|
@@ -11,7 +13,7 @@ void sqlite3_base64(sqlite3_context * context, int argc, sqlite3_value ** argv)
|
|
|
11
13
|
sqlite3_result_null(context);
|
|
12
14
|
} else {
|
|
13
15
|
// THANKS FOR GUIDANCE:
|
|
14
|
-
//
|
|
16
|
+
// https://www.sqlite.org/cgi/src/artifact/43916c1d8e6da5d1
|
|
15
17
|
// (src/func.c:hexFunc)
|
|
16
18
|
sqlite3_value * first = argv[0];
|
|
17
19
|
|
|
@@ -33,7 +35,40 @@ void sqlite3_base64(sqlite3_context * context, int argc, sqlite3_value ** argv)
|
|
|
33
35
|
}
|
|
34
36
|
}
|
|
35
37
|
|
|
38
|
+
static
|
|
39
|
+
void sqlite3_blobfrombase64(
|
|
40
|
+
sqlite3_context * context,
|
|
41
|
+
int argc,
|
|
42
|
+
sqlite3_value ** argv
|
|
43
|
+
) {
|
|
44
|
+
// Base64 value is WANTED in TEXT format
|
|
45
|
+
// It *may* be possible to get Base64 from INTEGER, does not seem interesting.
|
|
46
|
+
if (argc < 1 || sqlite3_value_type(argv[0]) != SQLITE_TEXT) {
|
|
47
|
+
sqlite3_result_null(context);
|
|
48
|
+
} else {
|
|
49
|
+
// get the info
|
|
50
|
+
sqlite3_value * first = argv[0];
|
|
51
|
+
const uint8_t * base64 = sqlite3_value_text(first);
|
|
52
|
+
|
|
53
|
+
const int base64_length = sqlite3_value_bytes(first);
|
|
54
|
+
|
|
55
|
+
// overestimating length needed is **much** better than underestimating !!
|
|
56
|
+
const uint8_t * blob = sqlite3_malloc(base64_length);
|
|
57
|
+
|
|
58
|
+
base64_decodestate ds;
|
|
59
|
+
base64_init_decodestate(&ds);
|
|
60
|
+
|
|
61
|
+
{
|
|
62
|
+
const int len = base64_decode_block(base64, base64_length, blob, &ds);
|
|
63
|
+
|
|
64
|
+
sqlite3_result_blob(context, blob, len, sqlite3_free);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
36
69
|
int sqlite3_base64_init(sqlite3 * db)
|
|
37
70
|
{
|
|
38
|
-
|
|
71
|
+
sqlite3_create_function_v2(db, "BASE64", 1, SQLITE_ANY | SQLITE_DETERMINISTIC, NULL, sqlite3_base64, NULL, NULL, NULL);
|
|
72
|
+
sqlite3_create_function_v2(db, "BLOBFROMBASE64", 1, SQLITE_ANY | SQLITE_DETERMINISTIC, NULL, sqlite3_blobfrombase64, NULL, NULL, NULL);
|
|
73
|
+
return 0;
|
|
39
74
|
}
|