Re: inserting BLOB data

"Kenny Scott" <[email protected]> Tue, 11 Dec 2007 21:39:16 +0000
Newsgroups gmane.comp.db.mysql.perl
Message-ID <[email protected]>
Hi,

Well, the only difference between the text and blob column types,
afaik, is that a blob is a case sensitive text column.  Is the issue
that you have simply how to get the data in the table, rather than how
you would do it using Perl?  Or am I completely missing the point?

-- 
Kenny


On Dec 11, 2007 9:30 PM, Kiran Annaiah <[email protected]> wrote:
>
>
> No i havent yet tried using the perl script to insert the data. I was
> looking around and seems like it is done mostly using a script.
>
> No the file is not binary. It is just a one row of numbers(about half
> million columns)
> 0 12333 1 1 0 1 2 2 1 1 ....so on
>
> should i use a different data type instead of BLOB?
>
>
>
> ________________________________
> > Date: Tue, 11 Dec 2007 21:18:37 +0000
> > From: [email protected]
> > To: [email protected]
> > Subject: Re: inserting BLOB data
>
>
> >
> > Hi,
> >
> > What are the file contents? Is it binary data, which is why you're
> > wanting to use the BLOB column type?
> >
> > What have you tried so far, and has it not worked?
> >
> > I'm guessing that you've tried the following type of thing:
> >
> > my $dbh = DBI->connect( "dbi:mysql:test", "root" ) or die $DBI::errstr;
> > my $sth = $dbh->prepare( "INSERT INTO t SET file_name=?, file_size=?,
> file=?" );
> > $sth->execute( $file_name, $file_size, $file );
> > $sth->finish();
> >
> > Did you try that and it didn't work for some reason?
> >
> > --
> > Kenny
> >
> >
> > On Dec 11, 2007 8:44 PM, Kiran Annaiah <[email protected]> wrote:
> > > I am trying to store my file contents in a table. I have never worked
> with BLOB data types before.
> > > I realised that inserting the file contents into the BLOB column is not
> the same as inserting into a regular column.
> > >
> > > The file size is about 2.2M. I have set the system variable
> max_allowed_packet to 3M.
> > >
> > > Can anyone please give me some ideas about how the file contents can be
> inserted?
> > >
> > > Table structure is as follows.
> > >
> > >
> +-----------+-----------------------+------+-----+---------+----------------+
> > > | Field | Type | Null | Key | Default | Extra |
> > >
> +-----------+-----------------------+------+-----+---------+----------------+
> > > | file_id | smallint(5) unsigned | NO | PRI | NULL | auto_increment |
> > > | file_name | varchar(25) | NO | | | |
> > > | file_size | mediumint(8) unsigned | NO | | | |
> > > | file | mediumblob | NO | | | |
> > >
> +-----------+-----------------------+------+-----+---------+----------------+
> > >
> > >
> > > _________________________________________________________________
> > > i'm is proud to present Cause Effect, a series about real people making
> a difference.
> > > http://im.live.com/Messenger/IM/MTV/?source=text_Cause_Effect
>
> ________________________________
> i'm is proud to present Cause Effect, a series about real people making a
> difference. Learn more

-- 
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe:    http://lists.mysql.com/[email protected]