On 4 Oct 2013, at 9:32am, techi eth <[email protected]> wrote:

> Can anyone let me know what is best way to handle C Array in SQLite3 database
> ?
> 
> As of now I can think of creating multiple row for storing each array
> element.

When you need the contents of one of the elements of the array, is it 
reasonable to load them all, or do your arrays have thousands of elements ?

If your arrays have many elements, the above solution is good.  Simpler, will 
work for any number of elements, and you can use SQLite API to search and sort 
individual elements.

On the other hand, if your arrays have few elements, assuming that the contents 
of each of the elements is text, you could find a character that you would 
never use in your text, perhaps '|' or '~', and use that as an element 
separator:

freda|johanna|georgina|patricia

that lets you fetch an entire array at once and split it up in your programming 
language.  Faster, files are smaller, but fetches a lot of data each time you 
want only one element and you cannot sort an array by contents.

Simon.
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to