Writing bzcompressed data into SQL-DB?

This is a discussion on Writing bzcompressed data into SQL-DB? within the PHP Language forums, part of the PHP Programming Forums category; Hi, when compressing strings with bzcompress, I have the problem that the result apparently often contains 'letters' that mess up ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 08-21-2004
Oliver Spiesshofer
 
Posts: n/a
Default Writing bzcompressed data into SQL-DB?

Hi,

when compressing strings with bzcompress, I have the problem that the
result apparently often contains 'letters' that mess up sql statements.

Of course I can urlencode the string, but that wont keep it as small.
What would be the best way to send a bzcompressed string to a SQL
statement? is it possible at all without urlencode?

thanks

Oliver

Reply With Quote
  #2 (permalink)  
Old 08-21-2004
Andy Hassall
 
Posts: n/a
Default Re: Writing bzcompressed data into SQL-DB?

On Sat, 21 Aug 2004 08:46:44 GMT, Oliver Spiesshofer <oliver@email.com> wrote:

>when compressing strings with bzcompress, I have the problem that the
>result apparently often contains 'letters' that mess up sql statements.
>
>Of course I can urlencode the string, but that wont keep it as small.
>What would be the best way to send a bzcompressed string to a SQL
>statement? is it possible at all without urlencode?


The best way depends on which database you are using. Which one is it?

--
Andy Hassall / <andy@andyh.co.uk> / <http://www.andyh.co.uk>
<http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool
Reply With Quote
  #3 (permalink)  
Old 08-21-2004
Michael Austin
 
Posts: n/a
Default Re: Writing bzcompressed data into SQL-DB?

Oliver Spiesshofer wrote:

> Hi,
>
> when compressing strings with bzcompress, I have the problem that the
> result apparently often contains 'letters' that mess up sql statements.
>
> Of course I can urlencode the string, but that wont keep it as small.
> What would be the best way to send a bzcompressed string to a SQL
> statement? is it possible at all without urlencode?
>
> thanks
>
> Oliver
>


Unless it is a password where the data is short enough or the data is NEVER used
in a select statement (using LIKE '%some text%' I would advise to NOT compress
the data. REtreiving the data or selecting on the data will cause a performance
hit you may not want to experience.

As long as the data is enclosed in single-quotes and you can guarantee that the
compressed data won't use single-qoutes, then you shouldn't have any problem.
If you urlencode your data you have another degree of obfuscation that will
translate into performance degradation.

Writing a web app based on testing one single connection is a problem waiting to
happen. Don't code with the mis-conception that if it works for one query it
will work for thousands per hour...

--
Michael Austin.
Consultant - Not Available.
Donations still welcomed. Http://www.firstdbasource.com/donations.html
:)
Reply With Quote
  #4 (permalink)  
Old 08-21-2004
Oliver Spiesshofer
 
Posts: n/a
Default Re: Writing bzcompressed data into SQL-DB?

Andy Hassall <andy@andyh.co.uk> wrote in
news:mj9ei0dflun255vp7d6k90a94o02d0h69s@4ax.com:

> The best way depends on which database you are using. Which one is
> it?
>


sorry,

its MySQL

Reply With Quote
  #5 (permalink)  
Old 08-21-2004
Andy Hassall
 
Posts: n/a
Default Re: Writing bzcompressed data into SQL-DB?

On Sat, 21 Aug 2004 15:02:09 GMT, Oliver Spiesshofer <oliver@email.com> wrote:

>Andy Hassall <andy@andyh.co.uk> wrote in
>news:mj9ei0dflun255vp7d6k90a94o02d0h69s@4ax.com :
>
>> The best way depends on which database you are using. Which one is
>> it?

>
>sorry,
>
>its MySQL


In that case it's the same as any other data you put into MySQL - run it
exactly once through addslashes() (or the practically equivalent
mysql_escape_string()).

--
Andy Hassall / <andy@andyh.co.uk> / <http://www.andyh.co.uk>
<http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 08:52 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0