[Dbix-class] INSERT occurring on SELECT
Dermot
paikkos at googlemail.com
Tue Jun 24 10:10:39 BST 2008
Hi,
I have been trying to get started using dbix (in a Catalyst env) and
have hit an early problem. When I call a method to list all the
entries in one table, null entries are created in a different table.
Below is the trace.
SELECT me.id, me.name, me.contrib_id FROM submissions me:
SELECT me.id, me.name, me.contrib_id FROM submissions me:
SELECT me.id, me.code FROM contributors me WHERE ( ( ( me.id = ? ) ) ): '1'
SELECT me.id, me.code FROM contributors me WHERE ( ( ( me.id = ? ) ) ): '2'
INSERT INTO contributors (id) VALUES (?): '2'
SELECT me.id, me.code FROM contributors me WHERE ( ( ( me.id = ? ) ) ): '3'
INSERT INTO contributors (id) VALUES (?): '3'
I have a small dataset. There are 2 tables. T1 has with a single entry.
>sqlite3 motion.db "select * from contributors"
1|S6G
T2 have 3 entries. The 3rd column is the ID in T1.
>sqlite3 motion.db "select * from submissions"
1|23|1
2|167|1
3|254|1
If I use a conventional script to list the data, all is fine.
I have traced the problem to my Template within my Catalyst app.
[% FOREACH submission IN submissions %]
[%# SET contributor = submission.contrib_id %]
<li>
[% submission.name | html %] [%# contributor.code | html
%] [%# submission.contrib_id.code %]
If any of the commented lines are used I get the result below.
>sqlite3 motion.db "select * from contributors"
1|S6G
2|
3|
I hope this isn't OT for the list. Can anyone suggest where the
problem might be?
Thanx,
Dp.
More information about the DBIx-Class
mailing list