2016-06-17 18:24 GMT+02:00 James K. Lowden <jklow...@schemamania.org>:

>
> You are encoding type information in the name.  If you move the type
> information into the data, SQLite can manage the unit dimension.  You
> could use a CHECK constraint to require that speed was in m/s, or a
> trigger to make it so.
>

That would indeed be an option. I suppose that you mean to use a string
like "2.34 m/s" or a BLOB of typically 9 bytes (a 'double' and a unit
enum).
But this would slightly increase the database size, and slow down access
due to formatting / parsing.
I targeted to have a zero-overhead support when possible.
In addition, my approach had the big advantage to being backward
compatible: older versions of our application would just ignore the column
unit type, and read/write regular 'double'.
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to