Menu

stopScript

Anonymous
2018-11-19
2018-11-19
  • Anonymous

    Anonymous - 2018-11-19

    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)?

     
  • Stefan Zieker

    Stefan Zieker - 2018-11-19

    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.

    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
    • Anonymous

      Anonymous - 2018-11-19

      Thank you for the explanation.

       
  • Stefan Zieker

    Stefan Zieker - 2018-11-19

    my pleasure

     

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.