On Sun, Mar 10, 2002 at 09:59:09AM +0200, Toomas Vendelin wrote:

> It doesn't look "same way" :(. Normally I've read data from a file
> on a client's machine using Perl's read function like this
> 
> while(read($file, $data, 1024))
> {
>      print TO $data;
> }
> 
> to write it from $file on client's computer to a file associated
> with file handle TO.
> 
> Now I obviously need to store the data in a variable. Just pushing
> $data strings into array and then joining (join('',@array) doesn't
> work, because it's not ASCII (file gets corrupted). So, what I do not
> understand, is how to open a filehandle to a database field and then
> "print" to it? :).

Start with this:

---snip---

my $data;
open FILE, "<$filename" or die;
{
    local($/) = undef;
    $data = <file>;
}
close FILE;

---snip---

Then just create a prepared statement handle with a place holder for
the data and execute it, passing $data along the way.  The
"Placeholders and Bind Values" section of the DBI documentation
explains how to do that.

Jeremy
-- 
Jeremy D. Zawodny, <[EMAIL PROTECTED]>
Technical Yahoo - Yahoo Finance
Desk: (408) 349-7878   Fax: (408) 349-5454   Cell: (408) 685-5936

MySQL 3.23.47-max: up 31 days, processed 1,033,853,920 queries (382/sec. avg)

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