FW: Escape a blob field.....

2002-02-13 Thread Ian Packard


Hi There!

I am using  mysql  3.23.41, for redhat-linux-gnu (i386).

My problem is this.

In java, I am trying to extract a blob field from a mysql table - I am
using 

Byte[] somebytes = RS.getBytes(FPPICTURE);
String somestring = new String(somebytes);


This gives me a string of the blob data.

I then need to create a new SQL insert statement that will insert the
blob data stored within somestring into a table..

String sqlCommand = INSERT INTO SOMETABLE (FPPICTURE) VALUES
('+somestring+');;

However, when I attempt to execute the above query, I have a problem
because the contents of somestring contains some characters that are
illegal within a SQL statement such as a ' .

I have used PHPMyAdmin, and exported a table which has blob fields
within it. The result is a SQL string with the contents of the blob
field being escaped within the SQL query.

My question is, how can I get a blob field from a mysql table that had
already escaped any illegal charachters, or how can I encode the blob
field myself so that the mysql statement I create is valid ???


Thanks in advance,
Ian Packard 



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




FW: Escape a blob field.....

2002-02-07 Thread Ian Packard


Hi There!

I am using  mysql  3.23.41, for redhat-linux-gnu (i386).

My problem is this.

In java, I am trying to extract a blob field from a mysql table - I am
using 

Byte[] somebytes = RS.getBytes(FPPICTURE);
String somestring = new String(somebytes);


This gives me a string of the blob data.

I then need to create a new SQL insert statement that will insert the
blob data stored within somestring into a table..

String sqlCommand = INSERT INTO SOMETABLE (FPPICTURE) VALUES
('+somestring+');;

However, when I attempt to execute the above query, I have a problem
because the contents of somestring contains some characters that are
illegal within a SQL statement such as a ' .

I have used PHPMyAdmin, and exported a table which has blob fields
within it. The result is a SQL string with the contents of the blob
field being escaped within the SQL query.

My question is, how can I get a blob field from a mysql table that had
already escaped any illegal charachters, or how can I encode the blob
field myself so that the mysql statement I create is valid ???


Thanks in advance,
Ian Packard 



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php