This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

gzcompress

Help for those learning Tcl or writing their own scripts.
Post Reply
User avatar
Fire-Fox
Master
Posts: 289
Joined: Sat Sep 23, 2006 9:01 pm
Location: /dev/null

gzcompress

Post by Fire-Fox »

Is there a way of gzcompress stuff before inserting it to database...?
GreatZ
Fire-Fox | Denmark

Scripts: Relay | Store Text | TvMaze
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

A quote from a user on this topic that is related to gzcompress.

This is a bad idea because:
- theoretically, there might be a sequence of data that, when compressed, leads to a SQL injection or simply breaks the query
- gzcompressed data can't be properly indexed and searched - you'll have a database full of garbled characters
- gzcompression is computationally expensive

Simply always sanitize your data before entering it into a database, using the string escaping method of your library (like mysql(i)_real_escape_string()) or parametrized queries. If you do that reliably, no further protection is necessary.

You will end up getting an error like:
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'cUÓyM›û]YûßTS§mÖø_öè|®SÝT?½¥®Ê!y{ëVùÊP†’Â1�'‰;(§�èh$1Cà�b
Once the game is over, the king and the pawn go back in the same box.
User avatar
Fire-Fox
Master
Posts: 289
Joined: Sat Sep 23, 2006 9:01 pm
Location: /dev/null

Post by Fire-Fox »

Okay, thanks for the reply :)
GreatZ
Fire-Fox | Denmark

Scripts: Relay | Store Text | TvMaze
O
Ofloo
Owner
Posts: 953
Joined: Tue May 13, 2003 1:37 am
Location: Belguim
Contact:

Post by Ofloo »

look for a way to do it with images cause images like jpeg is basically just compressed data, .. read about "blob" type unless you're inserting text then you might better find something like drive compression never really looked into it but i know it used to be on ntfs, years ago when i still used windows, .. that there was this feature to compress all your data onto fly when you stored it on disk. I never saw much use for it and never really looked for something like that cause most of my files where jpeg or media files and then it's useless to compress them once more, .. it's only a waste of cpu time. I'm pretty sure you can set up some sort of zip drive, or whatever you want to call it in any os.
XplaiN but think of me as stupid
Post Reply