List:General Discussion« Previous MessageNext Message »
From:Martin Ramsch Date:August 1 1999 11:45am
Subject:Re: Binary Data & MySQL
View as plain text  
On Sa, 1999-07-31 19:56:05 -0700, Jose de Leon wrote:
> Is there an alternative method to get binary data into a table?
> Other than LOAD INFILE?

Chapter "7.1.1 Strings" of the MySQL manual reads:

| If you want to insert binary data into a BLOB column, the following
| characters must be represented by escape sequences:

(note: i.e. by putting a backslash in front if it)
 
| NUL ASCII 0. Should be represented by `\0'
|              (a backslash and an ASCII `0' character).
| \   ASCII 92, backslash
| '   ASCII 39, single quote 
| "   ASCII 34, double quote 
| 
| If you write C code, you can use the C API function
| mysql_escape_string() to escape characters for the INSERT
| clause. See section "18.3 C API function overview".  In Perl, you
| can use the quote method of the DBI package to convert special
| characters to the proper escape sequences. See section "18.5.2 The
| DBI interface".
| 
| You should use an escape function on every possible string that may
| contain any of the special characters listed above!

Regards,
  Martin
-- 
Martin Ramsch <m.ramsch@stripped> <URL: http://home.pages.de/~ramsch/ >
PGP KeyID=0xE8EF4F75 FiPr=52 44 5E F3 B0 B1 38 26  E4 EC 80 58 7B 31 3A D7
Thread
Binary Data & MySQLBryan Porter30 Jul
  • Re: Binary Data & MySQLSasha Pachev30 Jul
  • Binary Data & MySQLJani Tolonen1 Aug
  • Re: Binary Data & MySQLJose de Leon1 Aug
    • Re: Binary Data & MySQLMartin Ramsch1 Aug
    • Re: Binary Data & MySQLJani Tolonen2 Aug