storing large chunks of text in a database

Currently reading:
storing large chunks of text in a database

Watch out for SQL injection if you're allowing writes to the database!
ther than that, just make sure you choose the right data type when you define your schema, and don't go over the top to avoid wasting space.
It's a good job you've got a host with plenty of capacity ;)
H
 
bulldog5046 said:
dont worry too much about SQL injection just give me the addy after :devil:

only thing with databases is you are limited to 250 charecters, theres a way around it but i dont know it off the top of my head sorry!

With SQL there is no limit.
 
See above, then don't forget to escape the string before adding it to the query. 's can cause havoc if you haven't followed the ANSI or product specific escaping mechanism. MySQL for example requires you escape 's like this:

\'
 
just HTML encode everything before you send it to the database, HTML has codes for all the fancy symbols you need, its only lazyness that causes people to skip this and use the original character.

also it depends on your database type, access has a memo type for large text, mssql has as text type, both can cope with large amounts of text and if you have several hundred or thousands of characters is is better than defining a static field of (ex) 5000 chars as these will always be allocated on every record inserted so can end up wasting huge amounts of space if you dont use them.
 
Morritt said:
just HTML encode everything before you send it to the database, HTML has codes for all the fancy symbols you need, its only lazyness that causes people to skip this and use the original character.
Surely that will only work if you only want HTML out?
H
 
hmallett said:
Surely that will only work if you only want HTML out?
H
not just that, you can use detects in scripts to parse html formatted documentation, and format it in "your style". I.e. you can use the html tags to create word or excel tags or whatever.
 
Back
Top