in

System.Data.SQLite

An open source ADO.NET provider for the SQLite database engine

Strange Error in Linux, not Windows

Last post 08-31-2010 10:54 AM by Tink. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 08-31-2010 7:45 AM

    • Tink
    • Top 500 Contributor
    • Joined on 07-08-2010
    • Posts 5

    Strange Error in Linux, not Windows

     Hello,

    I have a really strange one I am hoping somebody with more Linux via Mono knowledge can help me with.

    This code:

                    da.Update(ds, "Devices")

    (da is the SQLite data adapter, ds is a DataSet)

    Caused an error:  Abort due to constraint violation
                              Devices.name may not be NULL

    So here is the deal - the table (Devices) has a field called Name - it is an old object being saved, older than when 'Name' was a reserved word in many things, so I am not ignoring that it may be related to that, but there is another table in the same database with the same column name, and it works fine.

    So your first thought is, "it has a null value, duh!" but that is not the case...  

    I compared the two tables and found that the only difference was that where the error happens, I have the "NOT NULL" on the column and in the other one I do not, but as I said this works FINE under Windows, just not on Linux via Mono.

    So I am assuming (Robert) that you switch to Mono when it runs under that environment, and so the problem is likely in the binary distribution of SQLite for Linux, but I could not find anything in a search yesterday so I am hoping that some of the veterans here can help.

    Thanks

     

  • 08-31-2010 9:32 AM In reply to

    • Tink
    • Top 500 Contributor
    • Joined on 07-08-2010
    • Posts 5

    Re: Strange Error in Linux, not Windows

    More info...

    Trying to debug this, I got it beyond the initial error by removing the NOT NULL constraint, and it went on to the next field:

    Abort due to constraint violation
    Devices.devValue may not be NULL

    And devValue is a numerical field, so the value is at least 0 before .Update is called!

    So does the Linux implementation of SQLite not support the NULL constraint or is it broken?

     

  • 08-31-2010 10:54 AM In reply to

    • Tink
    • Top 500 Contributor
    • Joined on 07-08-2010
    • Posts 5

    Re: Strange Error in Linux, not Windows

    And yet even more info...

    Got rid of all of the NOT NULL constraints, except where the field was the primary key, and all of the errors go away.  However, not all of the data is being written to the database. :(  Only the primary key field is being written, all the rest are NULL.

    I think we just have an issue with the Provider on Mono/Linux, so anybody who has gone through this before, HELP!

    Thanks

     

Page 1 of 1 (3 items)
Powered by Community Server (Commercial Edition), by Telligent Systems