User Tag List

Results 1 to 10 of 10

Thread: SQLite3 - Causes MMF2 to Crash

  1. #1
    Clicker Fusion 2.5 DeveloperHTML5 Export Module

    Join Date
    Jun 2006
    Posts
    1,461
    Mentioned
    10 Post(s)
    Tagged
    0 Thread(s)

    SQLite3 - Causes MMF2 to Crash

    I found that if you create a database with a table and you issue a statement like:

    select sum(somefield) from table
    Set Editbox to FieldString$(Sqlite3, 0)

    If the table has records this works.

    If the table is empty of records SQLite3 will say 1 record is returned but the sum(somefield) must be Null I guess.

    This causes a problem if you are using the the SQLite3 FieldString$(SQLite3, 0). The 0 will cause MMF2 Runtime to abort if the table is empty of records but works if at least one record is in the table.

    If the table is empty of records or no records are selected using a where clause then SQLite3 needs to say 0 records are returned.

  2. #2
    Clicker Fusion 2.5 Developer

    Join Date
    May 2007
    Posts
    548
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: SQLite3 - Causes MMF2 to Crash

    Hi, droberson.

    It works here. Are you sure you're using the latest version?
    And more importantly, can you post an example file so I can see how exactly you're using the SQL syntax in your events?

  3. #3
    Clicker Fusion 2.5 DeveloperHTML5 Export Module

    Join Date
    Jun 2006
    Posts
    1,461
    Mentioned
    10 Post(s)
    Tagged
    0 Thread(s)

    Re: SQLite3 - Causes MMF2 to Crash

    I'll create an example and post it for you.

  4. #4
    Clicker Multimedia Fusion 2 Developer

    Join Date
    May 2007
    Location
    Brazil
    Posts
    135
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: SQLite3 - Causes MMF2 to Crash

    aqui nunca deu problema...ops I mean works fine here, please post this example

  5. #5
    No Products Registered

    Join Date
    Jun 2006
    Posts
    625
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: SQLite3 - Causes MMF2 to Crash

    I think I used to have a crash when a null result was sent. Byo corrected it very fast, maybe you don't have the latest version ?

  6. #6
    Clicker Fusion 2.5 DeveloperHTML5 Export Module

    Join Date
    Jun 2006
    Posts
    1,461
    Mentioned
    10 Post(s)
    Tagged
    0 Thread(s)

    Re: SQLite3 - Causes MMF2 to Crash

    I'm using version 1.3 which is the lastest version.

    I believe Corentin you are correct. I believe the crash I am speaking of is related to a null result being returned in the result set. Perhaps it is because I am using a sum function in my sql statement. It was tricky to find in that everything seemed to work fine. Then it showed up after I had closed and reopened the application. I believe for it to show up the database has to have no records when the application begins. The runtime would bomb when I issued the command to fetch data from the 0 field and the field was null. As I stated SQLite3 reported that one record was returned as part of the result set but the field had to be null. It should have reported that 0 records where returned since the database was empty of records.

    Anyway I will try to create a sample to define the problem better.

  7. #7
    No Products Registered

    Join Date
    Jun 2006
    Posts
    625
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: SQLite3 - Causes MMF2 to Crash

    There is a workaround SQLite function to correct this, instead of SUM() use this other function, it will return 0 rather than NULL... Of course I can't remember the name of this function, maybe TOTAL() ? You'll find it in the documentation anyway.

    It still doesn't fix the bug of course, but at least you'll have a viable solution

    EDIT : from Sqlite doc :
    Return the numeric sum of all non-NULL values in the group. If there are no non-NULL input rows then sum() returns NULL but total() returns 0.0. NULL is not normally a helpful result for the sum of no rows but the SQL standard requires it and most other SQL database engines implement sum() that way so SQLite does it in the same way in order to be compatible. The non-standard total() function is provided as a convenient way to work around this design problem in the SQL language.

    The result of total() is always a floating point value. The result of sum() is an integer value if all non-NULL inputs are integers. If any input to sum() is neither an integer or a NULL then sum() returns a floating point value which might be an approximation to the true sum.

    Sum() will throw an "integer overflow" exception if all inputs are integers or NULL and an integer overflow occurs at any point during the computation. Total() never throws and integer overflow.

  8. #8
    No Products Registered

    Join Date
    Jul 2006
    Location
    www.dingdongstudios.co.nr
    Posts
    505
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: SQLite3 - Causes MMF2 to Crash

    Edit: My bad, wrong sql object.

  9. #9
    No Products Registered

    Join Date
    Jun 2006
    Posts
    625
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: SQLite3 - Causes MMF2 to Crash

    Don't confuse SQlite and SQL Server Objects

  10. #10
    Clicker Fusion 2.5 Developer

    Join Date
    May 2007
    Posts
    548
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: SQLite3 - Causes MMF2 to Crash

    That's some really useful information, Corentin. Thanks a lot.

    Sum() will throw an "integer overflow" exception if all inputs are integers or NULL and an integer overflow occurs at any point during the computation.
    Does it mean the exception may be from the SQLite DLL library and not the extension itself?

    I know there are some cases when the DLL will throw an excpetion error but most of them were addressed in previous versions of the SQLite DLL. I'm just not sure if it's something from the extension or from the DLL.

    droberson:Please post an example file if you're able to reproduce the error again or send me the file with this issue privately. I hate unmanaged exceptions. And I know that when I first wrote this extension I've used some techniques that I think need total recode.

Similar Threads

  1. SQlite3
    By byo in forum Released Extensions
    Replies: 16
    Last Post: 28th December 2013, 04:25 AM
  2. Replies: 3
    Last Post: 7th January 2013, 01:35 PM
  3. SQLite3 version 2.0
    By byo in forum Released Extensions
    Replies: 0
    Last Post: 12th October 2009, 11:41 PM
  4. SQLite3 example for dingdong
    By byo in forum File Archive
    Replies: 3
    Last Post: 28th June 2008, 07:41 PM
  5. SQLite3
    By Sphax in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 15th March 2008, 01:02 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •