Re: Postgres and gzcompress

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux