(2016-09-06, 17:52)DaveBlake Wrote: Thanks for clarifying and references.
So there could be some space saving on MySQL databases to change dateadded to varchar, consistent with the other date/time fields. In SQLite there really is no saving between varchar and text.
Use DATETIME would need to be a consistent change to all date/time fields in both music and video not just song.dateadded field. I would guess that a string was used originally instead of DATETIME because of differences between MySQL and SQLite handling that the db wrapper could not handle, using own string format rather than local OS etc. giving Kodi control over what is stored. I don't feel a desire to change that approach even if it does take more space. Maybe someone else will?
But I can only repeat that is database size is an actual user issue, rather than a principle, then I am interested to hear about it.
Hey,
thanks for the reply.
One side of this argument is the efficiency - I chose to emphasise this in my original posts, as this is the most concrete argument against using a TEXT field to store what is, in effect, a DATETIME.
The other side of the argument is the principle - the fact that the database schema is "just wrong" if we're using a TEXT field to store a DATETIME. This may be a little less concrete, but is just as obvious and persuasive, in my opinion, as the efficiency argument.
As far as I'm concerned, if there were differences between how DATETIMEs are handled in mysql and sqlite, then this should be abstracted away at a very low layer (e.g. db connection layer), so that the database schema can be correct, and Kodi - at the application layer - needs know nothing about the peculiarities of mysql and/or sqlite. I would've expected that Kodi was using an ORM (or something similar) that would do exactly this job for it, so I'd be surprised if this were the reason why a TEXT field were chosen.
Could you perhaps ping a few other Kodi core devs who might be able to comment on this and explain the thinking behind it?
I totally understand that you guys are busy working on other necessary refactorings, bugfixes and features without some guy coming along and complaining about the bloody database schema. However, this was something so strange that I'd really love to know the reason for it, and, if it can be changed, would be willing to help out to the best of my efforts on fixing.
Cheers!