Getting data out of objects
[prev]
[thread]
[next]
[Date index for 2005/04/27]
I am getting confused.
I am trying to work with a bunch of small tables in a SQLite
dbase. Methods in C::DBI that calculate a SQL instruction and
then execute it, seem to work fine. For example, if I have 5
rows in a table and do a retrieve_all on that table, the array
that is returned has 5 entries in it. And each entry has the
correct reference (Class).
If the primary key is a single column, I gather a person can do
$obj->id;
to retrieve it. Or, if the name of that column is account_id, you
could also do:
$obj->account_id;
I've tried the $obj->id method, all the $obj->$column_name
methods, the $obj->get($column_name) and $obj->_attr(@cols)
methods. None of these methods will actually retrieve values.
If I look in the SQLite dbase with a text editor, I can see the
data in there, so I know there are values. If I do an abstract
search with a fairly complex search term, it returns the correct
number of rows/objects. But any attempt to actually print or
otherwise access the values in columns of these objects returns
nothing. I am not sure if this is an empty string or undef it is
returning, it certainly isn't the integers or text strings that
are stored there.
I am guessing this is some elementary thing, but darned if I can
figure out what. I've used Class::DBI with a minimal set of
configuration, with relationships (has_a and has_many), with
constraints (CGI::Untaint) and Class::DBI::Loader under a similar
set of configuration. It does have all the tables in the
database, and every table has all the columns it is supposed to,
in the correct case (I had mixed case to begin with, now
everything is lowercase).
Could someone point out likely goofs or ways of testing for what
is going wrong? The modules are current, or very nearly so.
Thanks,
Gord
|
Getting data out of objects
Gordon Haverland 19:53 on 27 Apr 2005
|