WA> how can in insert i.e. a tar-archive in a blob ?
WA> i want to do it with perl. i read allready about the quote function but i
WA> wount work

Try to use placholders. I'm under impression that quote is not
reliable. At least man DBI says:

           Quote will probably not be able to deal with all possible
           input (such as binary data or data containing newlines),
           and is not related in any way with escaping or quoting
           shell meta-characters. There is no need to quote values
           being used with the Placeholders and Bind Values entry
           elsewhere in this document.

See below how you should change script:

WA> #!/usr/bin/perl

WA> use DBI;

WA> # DB-Vars

WA> $host = "ux4";
WA> $database = "db_webera";
WA> $user = "webera";
WA> $pass = "webera";
WA> $port = 3306;

WA> $driver = "mysql";
WA> $dsn = "DBI:$driver:database=$database;host=$host;port=$port";
WA> $dbh = DBI->connect($dsn, $user, $pass);
WA> #Binärdatei einlesen

WA> open(DATEI, "heim.tar.gz");
WA> foreach(<DATEI>) {
WA>     $string = $string.$_;
WA> }
WA> $dbh->quote($string);

WA> $sql_statement = "insert into table(tars) values('$string')";
WA> $sth = $dbh->do($sql_statement);

Change these two lines to

    $sql_statement = "insert into table(tars) values(?)";
    $sth = $dbh->do($sql_statement, undef, $string);

WA> $sth->execute;

-- 
 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
| Ilya Martynov (http://martynov.org/)                                    |
| GnuPG 1024D/323BDEE6 D7F7 561E 4C1D 8A15 8E80  E4AE BE1A 53EB 323B DEE6 |
| AGAVA Software Company (http://www.agava.com/)                          |
 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

---------------------------------------------------------------------
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

Reply via email to