Re: [RDBO] Deleting 'one to one' object fails

2007-06-13 Thread Ovid
- Original Message 
From: John Siracusa [EMAIL PROTECTED]

 This is fixed in SVN.  The test you sent me now passes.

Thanks!  Any idea when there might be a new stable release?

Cheers,
Ovid
 
-- 
Buy the book -- http://www.oreilly.com/catalog/perlhks/
Perl and CGI -- http://users.easystreet.com/ovid/cgi_course/





-
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


Re: [RDBO] Deleting 'one to one' object fails

2007-06-13 Thread John Siracusa
On 6/13/07, Ovid [EMAIL PROTECTED] wrote:
 Thanks!  Any idea when there might be a new stable release?

End of the month, maybe.

-John

-
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


Re: [RDBO] Deleting 'one to one' object fails

2007-06-12 Thread Ovid
- Original Message 
From: John Siracusa [EMAIL PROTECTED]

 I can't reproduce this error with similarly (as far as I can tell)
 structured relationships.  Can you send me a self-contained example with
 table and class definitions that reproduces the problem (by private email if
 you want).

I have attached a very stripped down version of the problem.  It's about as 
small a completely self-contained test case as I can generate.  I stripped it 
down quickly (including removing POD), so it might look ugly in spots.  It's a 
regular distribution, so a typical build should work.  Since it's a quick hack, 
it's rather *nix centric and assumes that you have sqlite3 installed.  Let me 
know if there's a problem.

Cheers,
Ovid

tar zxvf Model-undef.tar.gz
[snip]
cd Model-undef/
Model-undef $ perl Makefile.PL  make  make test
Checking if your kit is complete...
Looks good
WARNING: Setting VERSION via file 'lib/Model.pm' failed
 at /usr/local/share/perl/5.8.8/ExtUtils/MakeMaker.pm line 501
WARNING: Setting ABSTRACT via file 'lib/Model.pm' failed
 at /usr/local/share/perl/5.8.8/ExtUtils/MakeMaker.pm line 513
Writing Makefile for Model
cp lib/Server/Dedicated.pm blib/lib/Server/Dedicated.pm
cp lib/Server/Dedicated/Suspended.pm blib/lib/Server/Dedicated/Suspended.pm
cp lib/Model/Object.pm blib/lib/Model/Object.pm
cp lib/Model.pm blib/lib/Model.pm
cp lib/Model/Object/Metadata.pm blib/lib/Model/Object/Metadata.pm
PERL_DL_NONLAZY=1 /usr/bin/perl -MExtUtils::Command::MM -e test_harness(0, 
'blib/lib', 'blib/arch') t/*.t
t/suspendedok 1/0No foreign key named 'suspended' at 
/usr/local/share/perl/5.8.8/Rose/DB/Object.pm line 539
eval {...} called at /usr/local/share/perl/5.8.8/Rose/DB/Object.pm line 
478
Rose::DB::Object::save('Server::Dedicated=HASH(0x8152c28)') called at 
lib/Server/Dedicated.pm line 47
Server::Dedicated::unsuspend('Server::Dedicated=HASH(0x8152c28)') 
called at t/suspended.t line 50
 at t/suspended.t line 50
# Looks like your test died just after 14.
t/suspendeddubious   
Test returned status 255 (wstat 65280, 0xff00)
after all the subtests completed successfully
Failed Test   Stat Wstat Total Fail  List of Failed
---
t/suspended.t  255 65280140  ??
Failed 1/1 test scripts. 0/14 subtests failed.
Files=1, Tests=14,  0 wallclock secs ( 0.52 cusr +  0.03 csys =  0.55 CPU)
Failed 1/1 test programs. 0/14 subtests failed.
make: *** [test_dynamic] Error 255

  
-- 
Buy the book -- http://www.oreilly.com/catalog/perlhks/
Perl and CGI -- http://users.easystreet.com/ovid/cgi_course/





Model-undef.tar.gz
Description: GNU Zip compressed data
-
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


[RDBO] Deleting 'one to one' object fails

2007-06-11 Thread Ovid
In my meta setup for one object, I have the following:

relationships = [
suspended = {
class  = 'Donhost::Server::Dedicated::Suspended',
column_map = { server = 'server' },
type   = 'one to one',
required   = 0,
},
],

And when I try to delete the corresponding object in there:

  $self-delete_suspended;

  diag Dumper($self-suspended);

I still have a Donhost::Server::Dedicated::Suspended object in there.

I thought, maybe I need to save it first:

  $self-delete_suspended;
  $self-save;
  diag Dumper($self-suspended);


Nope:

  not ok 5 - cannot_reinitialize died (No foreign key named 'suspended' at 
/usr/local/lib/perl5/site_perl/5.8.7/Rose/DB/Object.pm line 539 ...
  #   eval {...} called at 
/usr/local/lib/perl5/site_perl/5.8.7/Rose/DB/Object.pm line 478
  #   Rose::DB::Object::save() called at lib/Donhost/Server/Dedicated.pm 
line 563

As you can see, the error is thrown when I call 'save'.  However, it complains 
about a missing foreign key, even though I thought relationships are supposed 
to be used when we don't have foreign keys.  I've tried reading through the 
docs and the tests on this, but no luck.

This is Rose::DB::Object 0.764.

Cheers,
Ovid


-- 
Buy the book -- http://www.oreilly.com/catalog/perlhks/
Perl and CGI -- http://users.easystreet.com/ovid/cgi_course/




-
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


Re: [RDBO] Deleting 'one to one' object fails

2007-06-11 Thread John Siracusa
On 6/11/07 8:46 AM, Ovid wrote:
 And when I try to delete the corresponding object in there:
 
   $self-delete_suspended;
 
   diag Dumper($self-suspended);
 
 I still have a Donhost::Server::Dedicated::Suspended object in there.
 
 I thought, maybe I need to save it first:

You do, because the delete method created (by default) for a one-to-one
relationship is a delete_on_save method.

   $self-delete_suspended;
   $self-save;
   diag Dumper($self-suspended);
 
 
 Nope:
 
   not ok 5 - cannot_reinitialize died (No foreign key named 'suspended' at
 /usr/local/lib/perl5/site_perl/5.8.7/Rose/DB/Object.pm line 539 ...
   #   eval {...} called at
 /usr/local/lib/perl5/site_perl/5.8.7/Rose/DB/Object.pm line 478
   #   Rose::DB::Object::save() called at lib/Donhost/Server/Dedicated.pm
 line 563

Is cannot_reinitialize one of your methods?  If so, what does it look
like?

-John



-
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


Re: [RDBO] Deleting 'one to one' object fails

2007-06-11 Thread Ovid
- Original Message 
From: John Siracusa [EMAIL PROTECTED]

  $self-delete_suspended;
  $self-save;
  diag Dumper($self-suspended);
 
  Nope:
 
   not ok 5 - cannot_reinitialize died (No foreign key named 'suspended' at
  /usr/local/lib/perl5/site_perl/5.8.7/Rose/DB/Object.pm line 539 ...
   #   eval {...} called at
  /usr/local/lib/perl5/site_perl/5.8.7/Rose/DB/Object.pm line 478
   #   Rose::DB::Object::save() called at lib/Donhost/Server/Dedicated.pm
  line 563

 Is cannot_reinitialize one of your methods?  If so, what does it look
 like?

Er, um, it's an embarrassing holdover from an earlier refactoring.

  sub cannot_reinitialize {
  my $self = shift;
  
  if ( $self-suspended ) {
  return 'Suspended';
  }
  elsif ( $self-state eq none qw/ allocated install_failed / ) {
  return 'Not allocated';
  }
  elsif ( !$self-has_standard_hardware ) {
  return 'Running on non-standard hardware';
  }
  return;
  }

And before you ask :)

  sub has_standard_hardware {
  defined shift-_hardware_spec_id;
  }

('_hardware_spec_id' merely refers to a varchar(32) column.  Nothing unusual 
about it)

Cheers,
Ovid
 
-- 
Buy the book -- http://www.oreilly.com/catalog/perlhks/
Perl and CGI -- http://users.easystreet.com/ovid/cgi_course/





-
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


Re: [RDBO] Deleting 'one to one' object fails

2007-06-11 Thread John Siracusa
On 6/11/07 8:46 AM, Ovid wrote:
 In my meta setup for one object, I have the following:
 
 relationships = [
 suspended = {
 class  = 'Donhost::Server::Dedicated::Suspended',
 column_map = { server = 'server' },
 type   = 'one to one',
 required   = 0,
 },
 ],

I can't reproduce this error with similarly (as far as I can tell)
structured relationships.  Can you send me a self-contained example with
table and class definitions that reproduces the problem (by private email if
you want).

-John



-
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


Re: [RDBO] Deleting 'one to one' object fails

2007-06-11 Thread Ovid
- Original Message 
From: John Siracusa [EMAIL PROTECTED]

 I can't reproduce this error with similarly (as far as I can tell)
 structured relationships.  Can you send me a self-contained example with
 table and class definitions that reproduces the problem (by private email if
 you want).

I'll see if I can get that to you tomorrow.  Thanks.

Cheers,
Ovid
 
-- 
Buy the book -- http://www.oreilly.com/catalog/perlhks/
Perl and CGI -- http://users.easystreet.com/ovid/cgi_course/





-
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