SQLite binding text to NULL

  1. last year

    ingurgite

    31 Aug 2019 User since 2018

    Hi,

    I am trying to set a TEXT field in SQLite to NULL. I believe it worked before but it seems that it does not any more. I can do it through:

    database.execute("UPDATE articles SET content = NULL WHERE identifier = \(_identifier)")

    But the following does not seem to work.

    var _record = DatabaseRecord()
    _record.bindText("content", null)
    
    var _status = database.addRecord(_record, "articles")

    Thanks.

  2. marco

    31 Aug 2019 Administrator User since 2016

    @ingurgite the right way is to use the bindNULL method:

    var _record = DatabaseRecord()
    _record.bindNULL("content")
    
    var _status = database.addRecord(_record, "articles")
  3. ingurgite

    1 Sep 2019 User since 2018

    Thanks.

or Sign Up to reply!