In MySQL 5.0.40-enterprise-gpl-log I run the following: 

CREATE TABLE `foo` (
  `foo_id` bigint(10) NOT NULL auto_increment, 
  `nullable_int` bigint(10) default NULL,
  `nullable_varchar` varchar(10) default NULL,
  PRIMARY KEY  (`foo_id`)
);

insert into foo (foo_id) values (1);

mysql> select * from foo;
+--------+--------------+------------------+
| foo_id | nullable_int | nullable_varchar |
+--------+--------------+------------------+
|      1 |         NULL | NULL             |
+--------+--------------+------------------+
1 row in set (0.00 sec)

In Foo.pm, I have:

package XYZ::DB::Object::Foo;

use strict;
use warnings;

use base qw(XYZ::DB::Object);

__PACKAGE__->meta->setup(
    table   => 'foo',

    columns => [
        foo_id           => { type => 'bigint', not_null => 1 },
        nullable_int     => { type => 'bigint' },
        nullable_varchar => { type => 'varchar', length => 10 },
    ],

    primary_key_columns => [ 'foo_id' ],
);

__PACKAGE__->meta->initialize(replace_existing => 1);

1;

In check_null.pl, I have: 

# sample script to test out the null value translation
use XYZ::DB::Object::Foo;

print "VERSION: ", $Rose::DB::VERSION,"\n";

my $foo = new XYZ::DB::Object::Foo( foo_id => 1 );

$foo->load();

printf("Foo ID:%s, Nullable_Int:%s Nullable_VARCHAR:%s\n",
       $foo->foo_id, $foo->nullable_int, $foo->nullable_varchar);

exit 0;

When I run check_null.pl, I get the following: 

Rose::DB VERSION: 0.734
Rose::DB::Object VERSION: 0.764
Foo ID:1, Nullable_Int:0 Nullable_VARCHAR:

It seems that my Foo RDBO is returning 0 for $foo->nullable_int instead of
the expected undef.  Did something change on this new version or is this a
bug?  Anyone got a fix if it is?

-- Jeff Horn


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object

Reply via email to