Reputation: 359
I have a column of type INTEGER to which I insert a value using the following statement:
connection.execute("INSERT INTO ActiveTable (IDPK, Time) VALUES (NULL, CURRENT_TIMESTAMP)")
But the data stores unicode in the format: yyyy-mm-dd hh:mm:ss
How can an INTEGER field store a unicode formatted timestamp? Why doesn't an error get thrown here?
Upvotes: 2
Views: 1971
Reputation: 1295
SQLite uses dynamic typing. It does not enforce data type constraints. So it do the saving-is-first strategy, saving you data is the the main job and when the data type is not matching the defined type SQLite would converts it in some particular principles.
More info: https://www.sqlite.org/faq.html#q3 https://www.sqlite.org/datatype3.html#affinity
Upvotes: 2