Skip to content

Commit 30a554c

Browse files
kaizhu256lovasoa
andauthored
Fix issue with large numbers (#381)
* - remove `-DLONGDOUBLE_TYPE=double` from `Makefile` - update test to include CAST(1.7976931348623157e+308 AS REAL) - add test-case to verify infinity upper-bound - Co-authored-by: Christopher J. Brody <chris.brody at gmail.com> * Update test/test_issue325.js Co-authored-by: Ophir LOJKINE <[email protected]>
1 parent da3ff68 commit 30a554c

File tree

2 files changed

+39
-1
lines changed

2 files changed

+39
-1
lines changed

Makefile

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ EMCC=emcc
1919

2020
CFLAGS = \
2121
-O2 \
22-
-DLONGDOUBLE_TYPE=double \
2322
-DSQLITE_OMIT_LOAD_EXTENSION \
2423
-DSQLITE_DISABLE_LFS \
2524
-DSQLITE_ENABLE_FTS3 \

test/test_issue325.js

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
2+
exports.test = function(sql, assert){
3+
"use strict";
4+
// Create a database
5+
var db = new sql.Database();
6+
7+
// binding a large number
8+
assert.strictEqual(
9+
db.exec("SELECT ?", [1.7976931348623157e+308])[0].values[0][0],
10+
1.7976931348623157e+308,
11+
"binding 1.7976931348623159e+308 as a parameter"
12+
);
13+
14+
// inline result value test
15+
assert.strictEqual(
16+
db.exec("SELECT 1.7976931348623157e+308")[0].values[0][0],
17+
1.7976931348623157e+308,
18+
"SELECT 1.7976931348623157e+308 is 1.7976931348623157e+308"
19+
);
20+
21+
// Close the database and all associated statements
22+
db.close();
23+
};
24+
25+
if (module == require.main) {
26+
const target_file = process.argv[2];
27+
const sql_loader = require('./load_sql_lib');
28+
sql_loader(target_file).then((sql)=>{
29+
require('test').run({
30+
'test issue325': function(assert){
31+
exports.test(sql, assert);
32+
}
33+
});
34+
})
35+
.catch((e)=>{
36+
console.error(e);
37+
assert.fail(e);
38+
});
39+
}

0 commit comments

Comments
 (0)