RE: [PHP-DB] storing bzcompressed data in MySQL
| From: | Kyle Slattery | Date: | Sun, 13 Apr 2003 20:24:48 +0000 |
| Subject: | RE: [PHP-DB] storing bzcompressed data in MySQL | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-27062@lists.php.net to get a copy of this message | ||
addslashes() http://www.php.net/addslashes
|-----Original Message-----
|From: Paul Chvostek [mailto:paul+php@it.ca]
|Sent: Sunday, April 13, 2003 3:18 PM
|To: php-db@lists.php.net
|Subject: [PHP-DB] storing bzcompressed data in MySQL
|
|
|
|I've got an automated system that will be storing text files of up to
|about 20k. In peak times, I expect to have two to three million of
|these text files "on demand", though in reality they'll be expired *way*
|more often than they're referenced.
|
|To save space, I'd like to store the text using bzcompress(), but when I
|use a construct like this:
|
|$q = "INSERT INTO item (bztext) ('" . bzcompress($text,9) . "')";
|
|But running the query gets my mysql_error() results of
|You have an error in your SQL syntax near '$¢icÍeÖ3 ÒmX®""
|EèÓÊÊA*"("M0¤´è,¨
|ÚP#®ïsÂüÞ´+Ò÷jW6%e VdÁ' at line 2
|
|It seems that the bzcompressed data includes single (and double) quotes.
|
|Is the solution here to encode everything using htmlspecialchars(), thus
|using extra resources for both inbound and outbound data? Or will it
|suffice to str_replace("'","''",bzcompress($text,9)) ? Are
there other
|things that will break?
|
|Or is there some other preferred method to ensure accurate storage of
|blocks of binary data?
|
|Thanks. :)
|
|--
| Paul Chvostek <paul@it.ca>
| Operations / Abuse / Whatever
| it.canada, hosting and development http://www.it.ca/
|
|
|--
|PHP Database Mailing List (http://www.php.net/)
|To unsubscribe, visit: http://www.php.net/unsub.php
|
|
|