wexpo
1
When using transaction.executeSql() is it possible to execute multiple sql statements at once?
e.g.
CREATE TABLE BlahConfig
(
key VARCHAR(50),
val VARCHAR(255)
);
INSERT INTO BlahConfig
VALUES
(
'db_version',
'1.00'
),
(
'dt_created',
CURRENT_TIMESTAMP
);
it seems this creates the table, but doesn’t execute the insert statement.
1 Like
@nikki do you know the answer to this?
1 Like
Has anybody known the answer to this question ? I’m also having the same problem
mc10
4
Would calling two separate statements in the same transaction be sufficient for you? Something like this should work.
db.transaction(tx => {
tx.executeSql(
`CREATE TABLE BlahConfig
(
key VARCHAR(50),
val VARCHAR(255)
);`
);
tx.executeSql(
`INSERT INTO BlahConfig
VALUES
(
'db_version',
'1.00'
),
(
'dt_created',
CURRENT_TIMESTAMP
);`
);
});
1 Like
Was create multiple executeSQL statements the correct answer?