if you call stoptScript then you inform ScriptCommunicator to stop the execution after the current function is finished (the code outside the functions is the start function). If you want that the code after this if statement is not executed then you have to place it in an else statement.
I will update the example accordingly in the next release.
scriptThread.appendTextToConsole('script has started');
var db = scriptSql.addDatabase("QSQLITE")
db.setDatabaseName(scriptFile.createAbsolutePath("test.db3"));
db.open();
if(!db.isOpen())
{
scriptThread.appendTextToConsole("could not open db");
}
else
{
createTableAndInsertData("test1");
createTableAndInsertData("test2");
createTableAndInsertByteArray("test1")
createTableAndInsertByteArray("test2")
testBinding();
testRecordAndField();
testSqlIndex()
}
scriptThread.stopScript();
Last edit: Stefan Zieker 2018-11-19
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
Anonymous
-
2018-11-19
Thank you for the explanation.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It does not seem to work. I tested the example of testSql.js and changed it a little:
if(!db.isOpen() || true)
{
scriptThread.appendTextToConsole("could not open db");
scriptThread.stopScript();
//scriptThread.stopScript(scriptThread);
}
But the script does not stop and continues. Is it possible to terminate the (only) script at this point (otherwise than to terminate SC)?
Hi,
if you call stoptScript then you inform ScriptCommunicator to stop the execution after the current function is finished (the code outside the functions is the start function). If you want that the code after this if statement is not executed then you have to place it in an else statement.
I will update the example accordingly in the next release.
Last edit: Stefan Zieker 2018-11-19
Thank you for the explanation.
my pleasure