Bzip2 Question

Bzip2 Question

am 04.11.2007 11:17:03 von Nilesh India

I have a query about Bzip2 in PHP. Let's say that i have a paragraph
like:

abcdbc nnotp iidhdmmc;
uuidpssa

-------End-------

Now, i compress it using bzcompress() and store it in a mysql
database.

Now suppose i want to search for the string abcd in the database so if
i encode "abcd" in bzip2 then use the LIKE SQL query; will it fetch me
the result ?

Re: Bzip2 Question

am 04.11.2007 11:21:17 von Michael Fesser

..oO(Nilesh)

>I have a query about Bzip2 in PHP. Let's say that i have a paragraph
>like:
>
>abcdbc nnotp iidhdmmc;
>uuidpssa
>
>-------End-------
>
>Now, i compress it using bzcompress() and store it in a mysql
>database.
>
>Now suppose i want to search for the string abcd in the database so if
>i encode "abcd" in bzip2 then use the LIKE SQL query; will it fetch me
>the result ?

No, this can't work. Why do you want to store compressed strings at all?

Micha

Re: Bzip2 Question

am 04.11.2007 11:54:59 von Nilesh India

On Nov 4, 3:21 pm, Michael Fesser wrote:
> .oO(Nilesh)
>
> >I have a query about Bzip2 in PHP. Let's say that i have a paragraph
> >like:
>
> >abcdbc nnotp iidhdmmc;
> >uuidpssa
>
> >-------End-------
>
> >Now, i compress it using bzcompress() and store it in a mysql
> >database.
>
> >Now suppose i want to search for the string abcd in the database so if
> >i encode "abcd" in bzip2 then use the LIKE SQL query; will it fetch me
> >the result ?
>
> No, this can't work. Why do you want to store compressed strings at all?
>
> Micha

Saving database space. :D

Re: Bzip2 Question

am 04.11.2007 12:12:24 von Michael Fesser

..oO(Nilesh)

>On Nov 4, 3:21 pm, Michael Fesser wrote:
>>
>> No, this can't work. Why do you want to store compressed strings at all?
>
>Saving database space. :D

That's usually nothing to worry about. If the strings are really short,
compression might even lead to a _longer_ string.

Micha

Re: Bzip2 Question

am 04.11.2007 14:21:47 von Nilesh India

On Nov 4, 4:12 pm, Michael Fesser wrote:
> .oO(Nilesh)
>
> >On Nov 4, 3:21 pm, Michael Fesser wrote:
>
> >> No, this can't work. Why do you want to store compressed strings at all?
>
> >Saving database space. :D
>
> That's usually nothing to worry about. If the strings are really short,
> compression might even lead to a _longer_ string.
>
> Micha

I meant that for longer strings.

Re: Bzip2 Question

am 04.11.2007 14:53:38 von Jerry Stuckle

Nilesh wrote:
> I have a query about Bzip2 in PHP. Let's say that i have a paragraph
> like:
>
> abcdbc nnotp iidhdmmc;
> uuidpssa
>
> -------End-------
>
> Now, i compress it using bzcompress() and store it in a mysql
> database.
>
> Now suppose i want to search for the string abcd in the database so if
> i encode "abcd" in bzip2 then use the LIKE SQL query; will it fetch me
> the result ?
>
>

Try comp.database.mysql for mysql questions.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Re: Bzip2 Question

am 04.11.2007 17:13:04 von Michael Fesser

..oO(Nilesh)

>I meant that for longer strings.

Even then I don't think it's necessary, especially since it makes
searching and pattern matching impossible. You would always have to
decompress the string before you can perform a search on it.

Micha