To JSON or not to JSON

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

To JSON or not to JSON

Cecil Westerhof-5
A long time ago I changed a line base application to a SQLite application.
Every line was a record and this record could have several elements. Every
element was send to Twitter with a minute between them. When converting I
kept it like this. So my SQLite database contains for example:
"5BF19111-9FD5-48CA-B919-A09411346A87"    "[
  ""The journey of a thousand miles
must begin with a single step.

- Lao Tzu"",
  ""Welke stap kun je vandaag zetten,
om dat verre doel te bereiken?""
]"    "2018-07-07"

Respectively quoteID, quote (with extra line(s)) and lastUsed.

Is this an acceptable way to implement it, or would it be better to unravel
the elements in different records?

--
Cecil Westerhof
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: To JSON or not to JSON

Clemens Ladisch
Cecil Westerhof wrote:

> my SQLite database contains for example:
>
> "5BF19111-9FD5-48CA-B919-A09411346A87"    "[
>   ""The journey of a thousand miles
> must begin with a single step.
>
> - Lao Tzu"",
>   ""Welke stap kun je vandaag zetten,
> om dat verre doel te bereiken?""
> ]"    "2018-07-07"
>
> Respectively quoteID, quote (with extra line(s)) and lastUsed.
>
> Is this an acceptable way to implement it, or would it be better to unravel
> the elements in different records?

Putting the quotes into a separate table, one per row, would allow you to
access them individually.

If you never need to access individual quotes, and if you know that this
will never happen in the future, you could just as well keep storing the
quotes as an array.  (And then please tell us how you manage to predict
the future.  ;-)


Regards,
Clemens
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users