Rose::DB::Object - Perl语言ORM


未知
跨平台
Perl

软件简介

Rose::DB::Object 是一个Perl语言的数据库对象映射框架

示例代码:

  $product = Product->new(id          => 123,  
                          name        => 'GameCube',  
                          status      => 'active',  
                          start_date  => '11/5/2001',  
                          end_date    => '12/1/2007',  
                          category_id => 5);

  $product->save;

  ...

  $product = Product->new(id => 123);  
  $product->load;

  # Load foreign object via "one to one" relationship  
  print $product->category->name;

  $product->end_date->add(days => 45);

  $product->save;

  ...

  $product = Product->new(id => 456);  
  $product->load;

  # Load foreign objects via "one to many" relationship  
  print join ' ', $product->prices;