that would indicate that the problem occurs when writing the data. How did you accomplish this using a DatabaseRow?
My test failed with another bug way earlier when writing using a DatabaseRow, the remaining seem to work fine:
[code]
//intit
Dim db As New SQLiteDatabase
db.Connect
db.ExecuteSQL(“CREATE TABLE t (id INT PRIMARY KEY, b1 BOOLEAN, b2 BOOLEAN);”)
//insert
Dim row As New DatabaseRow
row.Column(“b1”).BooleanValue = True
row.Column(“b2”).BooleanValue = False
//oh my! the following gives ‘near “)”: syntax error’
'db.AddRow(“t”, row)
db.ExecuteSQL(“INSERT INTO t(b1, b2) VALUES(‘True’, ‘False’);”) //this does not test writing
//read
Dim rs As RowSet
rs = db.SelectSQL(“SELECT * FROM t;”)
//…using RowSet
System.DebugLog rs.Column(“b1”).NativeValue + rs.Column(“b2”).NativeValue
System.DebugLog Str(rs.Column(“b1”).BooleanValue) + Str(rs.Column(“b2”).BooleanValue)
//…using DatabaseRow
For Each r As DatabaseRow In rs
System.DebugLog r.Column(“b1”).NativeValue + r.Column(“b2”).NativeValue
System.DebugLog Str(r.Column(“b1”).BooleanValue) + Str(r.Column(“b2”).BooleanValue)
Break //look in debugger
Next r
//read again
rs = db.SelectSQL(“SELECT * FROM t;”)
//…using RowSet
System.DebugLog rs.Column(“b1”).NativeValue + rs.Column(“b2”).NativeValue
System.DebugLog Str(rs.Column(“b1”).BooleanValue) + Str(rs.Column(“b2”).BooleanValue)
//…using DatabaseRow
For Each r As DatabaseRow In rs
System.DebugLog r.Column(“b1”).NativeValue + r.Column(“b2”).NativeValue
System.DebugLog Str(r.Column(“b1”).BooleanValue) + Str(r.Column(“b2”).BooleanValue)
Break //look in debugger
Next r[/code]
[quote]
This issue has been reproduced based on the information provided.
A workaround might be to use an Integer field instead and use 0 to represent False and 1 to represent True.
This is pretty much how SQLite implements its Boolean data type.[/quote]
So, the solution for now, is changing all booleans to integers.
I downloaded Robin’s example from your Feedback case.
Only changed this:
'row.Column("Flag").BooleanValue = flag
row.Column("Flag").IntegerValue = if(flag, 1, 0)
and it works too (this is another test from what I did before), in other words I didn’t change the ShowData method that includes:
Robin’s exemple do not save to disk file and reload from disk.[/quote]
Sorry, I think I was not clear enough. The save to database (BooleanValue) is broken, so you need:
to save to database, once is there (you can open the sqlite file with another program and see 1 or 0 as expected, but with the original code you will see that nothing was written to the boolean column.
When you load from the sqlite database you can use:
u.isDead = rs.Column(ïsDead").BooleanValue
and will get the correct value.
Robin’s example does create and save the information into Desktop/example.sqlite and pulls the information from that file to show the values on the listbox.
This bug can silently break things (and damage data in databases) so it is a priority to fix this. And also check the behavior of row.Column(name).BooleanValue in the other supported databases.