Maybe someone can tell me what is going on ...

I have a many-to-many join between TableA and TableB. TableA has an enum 
column.

When I fetch all the TableA's via TableB obj, the TableA objects come with the 
enum column marked as modified.

This does not happen if I load TableA directly.  It only happens when I load 
TableA via a many to many join.  A one to many join does not mark the enum 
column as modified either.

Maybe there is some magic option I need to set to get this to work?

I have attached:
DBConn.pm: basic db setup (using mysql test database)
Testing.pm: sets up TableA, TableB, and JoinAB objects
test.pl: Test::More script that checks for MODIFIED columns after fetch
create.sql: creates the tables and loads data needed for testing

Any ideas or work arounds?

Thanks!
-Cory

Using Rose::DB::Object-0.763 and Rose::DB-0.733 the output from this test is:

$ ./test.pl
1..5
ok 1 - A has no modified keys
ok 2 - B has no modified keys
not ok 3 - A via B has no modified keys
#   Failed test 'A via B has no modified keys'
#   in ./test.pl at line 18.
#     Structures begin differing at:
#          $got->{enum_val} = '1'
#     $expected->{enum_val} = Does not exist
not ok 4 - A via B has no modified keys
#   Failed test 'A via B has no modified keys'
#   in ./test.pl at line 18.
#     Structures begin differing at:
#          $got->{enum_val} = '1'
#     $expected->{enum_val} = Does not exist
not ok 5 - A via B has no modified keys
#   Failed test 'A via B has no modified keys'
#   in ./test.pl at line 18.
#     Structures begin differing at:
#          $got->{enum_val} = '1'
#     $expected->{enum_val} = Does not exist
# Looks like you failed 3 tests of 5.

Attachment: DBConn.pm
Description: application/perl-module

Attachment: Testing.pm
Description: application/perl-module

Attachment: test.pl
Description: Perl program

CREATE TABLE tableA (
    id       SERIAL NOT NULL PRIMARY KEY,
    enum_val ENUM('A','B') NULL DEFAULT 'A'
);

create table tableB (
    id SERIAL NOT NULL PRIMARY KEY
);

create table join_AB (
    tableA_id INTEGER,
    tableB_id INTEGER
);

insert into tableA values (1,"A");
insert into tableA values (2,"B");
insert into tableA values (3,"A");

insert into tableB values(1);

insert into join_AB values(1,1);
insert into join_AB values(2,1);
insert into join_AB values(3,1);
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object

Reply via email to