Skip to content

Commit 90c74b5

Browse files
Copilotmathiasrw
andcommitted
Initial investigation of toJS error
Co-authored-by: mathiasrw <[email protected]>
1 parent 4415f83 commit 90c74b5

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

test_issue_temp.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
if (typeof exports === 'object') {
2+
var assert = require('assert');
3+
var alasql = require('.');
4+
}
5+
6+
// Test the issue with INSERT INTO with SELECT subquery
7+
try {
8+
alasql('DROP TABLE IF EXISTS t');
9+
alasql('CREATE TABLE t (report_type string, inv_qty number, week number, month number, year number)');
10+
console.log('Table created');
11+
alasql('INSERT INTO t(report_type,inv_qty,week,month,year) VALUES ((SELECT \'k\',1,2,3,4))');
12+
console.log('Insert executed');
13+
var res = alasql('SELECT * FROM t');
14+
console.log('Result:', JSON.stringify(res));
15+
} catch(e) {
16+
console.log('Error:', e.message);
17+
console.log('Stack:', e.stack);
18+
}

test_parse.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
var alasql = require('.');
2+
3+
// Test parsing the problematic query
4+
var parsed = alasql.parse('INSERT INTO t(report_type,inv_qty,week,month,year) VALUES ((SELECT \'k\',1,2,3,4))');
5+
console.log('Parsed:', JSON.stringify(parsed, null, 2));

0 commit comments

Comments
 (0)