Skip to main content
Welcome guest. | Register | Login | Post

String storage problem

3 replies [Last post]
Offline
Joined: 2006-11-19

I've written an app that needs to have user-submitted strings, with (seperate) formatting information like font and colour. It returns random strings from a given set for that person. I'm moving from flat file to SQL database, and am wondering how the best way to do it is. My current solution involves two tables - one to store the strings and formatting information, and another to store all the different "selection". However, the only way I see of doing that is if one column is the ID of the "selection" and another is a comma-seperated list of all the IDs from the other table of that selection.

My second idea is having two columns - the minimum and maximum IDs of the selection, seeing as they're all next to each other.

Is there a better way. Should I be going for two tables? Should I even be moving to an SQL DB in the first place? Remember, the strings are specific to that person only, so if they all could be stored together it would be ideal.

tbuitenh's picture
Offline
Joined: 2005-12-21
I don't have a clue what

I don't have a clue what your program does, and I don't know too much about SQL, so I can only give some generic advice.

Do you need to compare, sort, extract, search, etc etc a lot of data? Then SQL or perhaps some other database language is the way to go. If not, it may be easier to use something like yaml. You could also make per-user flat files instead of one flat file, or even make a file for each string and use directories and symlinks to manage all those tiny files.

Offline
Joined: 2006-11-19
I guess a link to my site

I guess a link to my site would help explain. Basically, it gives you an image link, like 14.png, which is dynamically generated from a bunch of user selected strings. It's for putting quotes and things it some forum signatures.

I've considered the flat file per user approach, but it'd make central management harder. YAML looks interesting, but I feel if I'm doing a flat file, tab separated is best.

tbuitenh's picture
Offline
Joined: 2005-12-21
Later yesterday I thought

Later yesterday I thought "why didn't I even think of xml?". Anyway, as this is a web based tool, using SQL for data storage probably is a good idea.

Anyone with SQL experience who can help Jonty, please take over...

Comment viewing options