Re: Postgres and gzcompress
| From: | John DeSoi | Date: | Thu, 07 Sep 2006 23:30:47 +0000 |
| Subject: | Re: Postgres and gzcompress | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-42327@lists.php.net to get a copy of this message | ||
If your goal was to compress the data, this seems counterproductive since base64 will inflate it by 33% or more.
I would recommend using a bytea column and a prepared statement to insert or update. This will be faster and you won't have to worry about escaping.
On Sep 6, 2006, at 11:18 PM, Nathan Harmon wrote:
Thanks a lot for your help. I finally got it to work by encoding after doing the compress -- instead of before as you suggested. So, using a text column type: $dataToInsert = pg_escape_string(base64_encode(gzcompress($data))); // insert here... // select here... $data = base64_decode(gzuncompress($row[0]));John DeSoi, Ph.D. http://pgedit.com/ Power Tools for PostgreSQL