Hello,
I'm using alasql for a while now without problem, but for the first time I need to une ALTER TABLE queries and I got an issue.
my code:
alasql.promise([
'CREATE localStorage DATABASE IF NOT EXISTS Main',
'ATTACH localStorage DATABASE Main',
'Use Main',
"CREATE TABLE test (language INT, hello STRING)",
"INSERT INTO test VALUES (1,'Hello!')",
"INSERT INTO test VALUES (2,'Aloha!')",
"INSERT INTO test VALUES (3,'Bonjour!')",
'ALTER TABLE test ADD COLUMN aaa STRING',
"INSERT INTO test VALUES (4,'Hello!','xxxx')",
"SELECT * FROM test WHERE language > 1"
]).then(function(res){
console.log('Results from all queries:',res);
}).catch(function(reason){
console.log('Error:',reason);
});
just a test function to see if ALTER woks.
the result is an array with only "1" in it, except the last element:
0: {language: 2, hello: "Aloha!"}
1: {language: 3, hello: "Bonjour!"}
2: {language: 4, hello: "Hello!"}
-> I don't get the new column value!
-> If I look at the structure on localStorage there is only the 2 first columns, not the newly created one.
Looks like ADD COLUMN do nothing...
can you help me?
thanks! :)
This seems to work for me? The results have the new column value:
@OliverRadini
I think its related to the localstorage options.
If I just add the 3 lines to your code:
'CREATE localStorage DATABASE IF NOT EXISTS Main',
'ATTACH localStorage DATABASE Main',
'Use Main',
-> https://jsfiddle.net/d86z7abc/
When I run I get the correct answer, but the column is not persisted in localstorage.
If you look into the local storage "Main.test"/Columns -> there is only 2 columns, new one is not peristed.
happens the same to me, ALTER is not persisted to localStorage, no errors... I can even INSERT values to the column but it doesn't save to localStorage.
Some solution?
This is no good. Thank you for reporting this.