I have a simple table description for storing files. I store the files in
the "contents" column. I also have a simple RDBO class that autoinitializes
from the database. The output of the meta->perl_class_definition is given
below the table definition. Why is the type for "contents" a scalar? I
would like to store binary data in that column, which I can do with straight
DBI, but it seems I have to specify the bind_type as DBD::Pg::PG_BYTEA. I
have tried storing the same binary data using RDBO and do not get the
correct information stored. I wonder if the binding is correct? Any ideas
on how to fix the problem?
Thanks,
Sean
CREATE TABLE public.uploaded_files (
id SERIAL NOT NULL
, filename VARCHAR(255) NOT NULL
, description TEXT
, size INTEGER
, upload_timestamp TIMESTAMP DEFAULT now() NOT NULL
, contents BYTEA
, filetype VARCHAR(255) DEFAULT 'application/octet-stream'
);
ALTER TABLE public.uploaded_files
ADD CONSTRAINT PK_UPLOADED_FILES
PRIMARY KEY (id);
package My::File;
use strict;
use My::DB::Object;
our @ISA = qw(My::DB::Object);
__PACKAGE__->meta->table('uploaded_files');
__PACKAGE__->meta->columns(
id => { type => 'serial', not_null => 1 },
filename => { type => 'varchar', length => 255, not_null => 1 },
description => { type => 'text' },
size => { type => 'integer' },
contents => { type => 'scalar' },
filetype => { type => 'varchar', default => 'text/plain' },
upload_timestamp => { type => 'timestamp', default => 'now()', not_null
=> 1 },
);
__PACKAGE__->meta->primary_key_columns([ 'id' ]);
__PACKAGE__->meta->initialize;
1;
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Rose-db-object mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rose-db-object