List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:March 1 2002 5:20pm
Subject:Re: Problem with Images and Blobs
View as plain text  
At 10:09 -0700 3/1/02, Hector Rosas wrote:
>Hello, look I'm trying to insert an Image into a blob field with a 
>Normal insert query. I know that the information that will be 
>contained on the blob field should be between " (quotation marks), 
>but if inside the info of the image is a quotation mark it should be 
>escaped with a \ (back slash). I was reading a document for perl 
>that use a special function called addslashes,

That sounds like a document for PHP, actually.

>that add a backslash to the characters ", ', NULL and the \, I think 
>the NULL character is the Ascii ( 0 ) so in every file I scan I will 
>add a \ before a Ascii (0).

You should either use placeholders, or convert the value with the DBI
quote() function to make it safe for insertion into the INSERT query string.
There's no point in messing around with this yourself when DBI will do it
for you.

>
>After add a \ before an Ascii(0) mysql still tell me that I have an 
>error on say ( I'm trying to save gif image):
>'"GIF89a'
>the Image is GIF89a0x00 <- this represent a ascii(0) value, so I 
>add: GIF89a\0x00 but the problem is the same, could somebody tell me 
>how can I do that, or what do I need to modify, thanks in advance.
>
>Hector.

Thread
Problem with Images and BlobsHector Rosas1 Mar
  • Re: Problem with Images and BlobsPaul DuBois1 Mar