Results 1 to 9 of 9

Thread: This application has requested the runtime to terminate it in an unusual way

  1. #1
    Join Date
    Oct 2011
    Posts
    13
    Thanks
    3
    Thanked 4 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default This application has requested the runtime to terminate it in an unusual way

    Hi all,
    I m trying to create 3tables in my SQlite database. I use the following code.
    Qt Code:
    1. QSqlQuery query;
    2. query.exec("create table user (UPI int primary key, firstname varchar, lastname varchar, cos int )");
    3. query.exec("insert into person values(380142, 'Danny', 'Young',10)");
    4. query.exec("insert into person values(102222, 'Christine', 'Holand',23)");
    5.  
    6. //The following requests create the tables, but don't insert the data
    7. query.exec("create table destination (number int primary key,type varchar)");
    8. query.exec("insert into destination values(0022921301074, 'local')");
    9. query.exec("insert into destination values(002217780216, 'international')");
    10.  
    11. //The requests below gives an error message
    12. query.exec("create table callId (id int primary key, ext int)")/*, day varchar, moment varchar,duree int,transfer int, transferExist bool,cosExist bool, number int, cos int)")*/;
    13. query.exec("insert into callId values(' ', '2011-10-28','17:25',128,3300,'true','false',0022921301074,' ')");
    14. query.exec("insert into callId values(' ', '2011-10-29','00:29',128,' ','false','true',002217780216,10)");
    To copy to clipboard, switch view to plain text mode 

    The error message is "This application has request the Runtime to terminate at an unusual way".

    And the debugger show the following message :
    Début du débogageASSERT: "idx >= 0 && idx < s" in file ..\..\include/QtCore/../../../../../../ndk_buildrepos/qt-desktop/src/corelib/tools/qvarlengtharray.h, line 107
    Invalid parameter passed to C runtime function.
    Invalid parameter passed to C runtime function.
    Fin du débogage

    Kindly help me;
    Thanks

  2. #2
    Join Date
    Feb 2008
    Posts
    491
    Thanks
    12
    Thanked 142 Times in 135 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default Re: This application has requested the runtime to terminate it in an unusual way

    Don't know if this causes the crash or not but:
    Qt Code:
    1. QSqlQuery query;
    2. query.exec("create table user (UPI int primary key, firstname varchar, lastname varchar, cos int )");
    3. query.exec("insert into person values(380142, 'Danny', 'Young',10)");
    4. query.exec("insert into person values(102222, 'Christine', 'Holand',23)");
    To copy to clipboard, switch view to plain text mode 
    The above inserts will fail with the wrong table name.
    Qt Code:
    1. query.exec("create table callId (id int primary key, ext int)")/*, day varchar, moment varchar,duree int,transfer int, transferExist bool,cosExist bool, number int, cos int)")*/;
    2. query.exec("insert into callId values(' ', '2011-10-28','17:25',128,3300,'true','false',0022921301074,' ')");
    3. query.exec("insert into callId values(' ', '2011-10-29','00:29',128,' ','false','true',002217780216,10)");
    To copy to clipboard, switch view to plain text mode 
    You create a table with two columns and try to insert nine columns. These inserts will fail also.

  3. #3
    Join Date
    Oct 2011
    Posts
    13
    Thanks
    3
    Thanked 4 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: This application has requested the runtime to terminate it in an unusual way

    Quote Originally Posted by norobro View Post
    You create a table with two columns and try to insert nine columns. These inserts will fail also.
    Even when I try with the nine columns I have the same error.
    Here is my code.
    Qt Code:
    1. query.exec("create table callId (id int primary key,ext int,day varchar(10),moment varchar(5),duree int,transfer int,transferExist int,cosExist int,number int,cos int)");
    2. query.exec("insert into callId values(' ', '2011-10-28','17:25',128,3300,'true','false',0022921301074,' ')");
    3. query.exec("insert into callId values(' ', '2011-10-29','00:29',128,' ','false','true',002217780216,10)");
    To copy to clipboard, switch view to plain text mode 
    Need your help.

  4. #4
    Join Date
    Feb 2008
    Posts
    491
    Thanks
    12
    Thanked 142 Times in 135 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default Re: This application has requested the runtime to terminate it in an unusual way

    Please post the stack trace or at least the last line in the stack trace that is your code.

  5. #5
    Join Date
    Oct 2011
    Posts
    13
    Thanks
    3
    Thanked 4 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: This application has requested the runtime to terminate it in an unusual way

    Unfortunately, there is no stack trace
    Capturer.jpg

  6. #6
    Join Date
    Feb 2008
    Posts
    491
    Thanks
    12
    Thanked 142 Times in 135 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default Re: This application has requested the runtime to terminate it in an unusual way

    Is that a debug build? Do a "Build->Clean All", a "Build->Rebuild All" and Run

    If that doesn't work, set a breakpoint and step through your program until it crashes.

    Other than that, can't help with Windows. Sorry.

  7. #7
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: This application has requested the runtime to terminate it in an unusual way

    There is nothing in the lines you have posted that should cause anything like a program crash. (See below for reasons it won't work anyway)
    • Rebuild the project from scratch: does the problem still occur?
    • Comment out those lines: does the crash still occur?
    • Single step through those lines, including stepping into the Qt code, and tell us exactly which causes the crash and how it arrived there?


    Other observations:
    • It is unusual that, in a table with only two varchar fields, you insert everything as a string. Sqlite should allow this, but you might consider fixing the inserts.
    • Sqlite treats 'bool' as integers with 1 == true, 0 == false, not strings 'true' and 'false'. While it will store and retrieve these faithfully it will treat both as false (i.e. their value as integers is zero) in boolean expressions.
    • Your table is defined with 10 columns (not 9) and you are trying to insert 9 values. The SQL is broken.
    • Your second insert will fail with a duplicate key. Sqlite will not manufacture an id column value for you unless the column is declared "integer primary key autoincrement" (literally) and you either insert a NULL into the column, or omit the column from the insert.
    • You should get into the habit of explicitly nominating columns in insert statements so that adding a column to a table does not break every existing insert. For example:
      Qt Code:
      1. create table a (id integer primary key autoincrement, b varchar(10));
      2. insert into a (b) values ('Hello');
      3. select * from a;
      To copy to clipboard, switch view to plain text mode 
    • If you need the 'number' column to preserve the leading zeroes on your (I assume) phone numbers then you must use a varchar field.

  8. #8
    Join Date
    Oct 2011
    Posts
    13
    Thanks
    3
    Thanked 4 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: This application has requested the runtime to terminate it in an unusual way

    Quote Originally Posted by ChrisW67 View Post
    There is nothing in the lines you have posted that should cause anything like a program crash. (See below for reasons it won't work anyway)
    • Rebuild the project from scratch: does the problem still occur?
    • yes
      Quote Originally Posted by ChrisW67 View Post
    • Comment out those lines: does the crash still occur?
    No
    Quote Originally Posted by ChrisW67 View Post
  9. Single step through those lines, including stepping into the Qt code, and tell us exactly which causes the crash and how it arrived there?
When I comment out the fllowing line, there is no more crash. But I need to delete the .db file created by the sqlite database before compiling again. If I don't do that, the crash occurs agin even if I comment the line.
Qt Code:
Switch view
  1. query.exec("create table callId (id int primary key,ext int,day varchar(10),moment varchar(5),duree int,transfer int,transferExist int,cosExist int,number int,cos int)");
To copy to clipboard, switch view to plain text mode 


Other observations:
[/QUOTE]
Thank you ChrisW67. I've just applied all your remarks. they were really helpful. But, I still have a the error message.
Here is my code.

Qt Code:
Switch view
  1. query.exec("create table callId (id integer primary key autoincrement,ext int,day varchar(10),moment varchar(5),duree int,transfer int,transferExist bool,cosExist bool,number varchar(20),cos int)");
  2. query.exec("insert into callId values(NULL, 3300,'2011-10-28','17:25',128,3333,0,1,0022921301074,NULL)");
  3. query.exec("insert into callId values(NULL, 3310,'2011-10-29','00:29',128,NULL,1,0,002217780216,10)");
To copy to clipboard, switch view to plain text mode 

Thanks Norobro to have replied to me.
Reply With Quote Reply With Quote

  • #9
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: This application has requested the runtime to terminate it in an unusual way

    Does the problem go away if you use ":memory:" as the database file name? That is make a transient, in-memory database.

  • Similar Threads

    1. Runtime application menu customisation
      By oberlus in forum Qt Programming
      Replies: 1
      Last Post: 26th July 2011, 17:30
    2. Replies: 2
      Last Post: 13th January 2011, 10:50
    3. Unusual TableView
      By giker in forum Qt Programming
      Replies: 0
      Last Post: 6th January 2011, 13:10
    4. Application gets aborted runtime
      By Yayati.Ekbote in forum Qt Programming
      Replies: 0
      Last Post: 2nd April 2010, 12:13
    5. Replies: 5
      Last Post: 23rd September 2008, 22:33

    Bookmarks

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •  
    Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.