Some basic types of fail-over may be added to Rose::DB in the future, but right now the mapping is strictly one-to-one. Multiplexing, fail-over, and other more complex relationships between logical data sources and physical databases are not part of Rose::DB. Each logical data source is currently backed by a single "physical" database (basically a single DBI connection). Instead of dealing with "databases" that exist on "hosts" or are located via some vendor-specific addressing scheme, Rose::DB deals with "logical" data sources. The basic features of Rose::DB are as follows. This is yet another reason to read the documentation for the subclass that corresponds to your data source's database software. Subclasses may also add methods that do not exist in the parent class, of course. You must read the subclass documentation to learn about behaviors that are specific to each type of database. The Rose::DB object method documentation found here defines the purpose of each method, as well as the default behavior of the method if it is not overridden by a subclass. This mapping can be changed using the driver_class class method. The default mapping of databases to Rose::DB subclasses is: DBD::Pg -> Rose::DB::Pg Rose::DB's constructor method ( new()) returns a database-specific subclass of Rose::DB, chosen based on the driver value of the selected data source. Patches are welcome.Īll database-specific behavior is contained and documented in the subclasses of Rose::DB. Support for more drivers may be added in the future. Rose::DB will attempt to service an unsupported database using a generic implementation that may or may not work. Rose::DB currently supports the following DBI database drivers: DBD::Pg (PostgreSQL) Rose::DB alone is simply a data source abstraction layer it is not an ORM. Rose::DB::Object is an ORM that uses this module to manage its database connections. Tip: Are you looking for an object-relational mapper (ORM)? If so, please see the Rose::DB::Object module. Please see the tutorial (perldoc Rose::DB::Tutorial) for an example usage scenario that reflects "best practices" for this module. A Rose::DB object "has a" DBI object it is not a subclass of DBI. Rose::DB is a wrapper and abstraction layer for DBI-related functionality. Rose::DB - A DBI wrapper and abstraction layer. Vendor-Specific Column Value Parsing and Formatting.There's one example for each of the databases supported by Rose::DB. Below are examples of primary key column definitions that provide auto-generated values. The exact technique varies from vendor to vendor. This will only work, however, if the corresponding column definition in the database is set up correctly. Print "Generated new id value: ", $o->id Example: $o = My::DB::Object->new(name => 'bud') # no id specified Given the column metadata definition above, Rose::DB::Object will automatically generate and/or retrieve the primary key column value when an object is save()d. If the database column uses big integers, use " bigserial" column type instead. (Note that the column doesn't have to be named "id" it can be named anything.) # Create classes - two possible approaches: # a quick start, see the Rose::DB::Tutorial documentation. # the Rose::DB documentation for more information. # won't be able to connect to the database at all. # First, set up your Rose::DB data sources, otherwise you # see the Rose::DB::Object::Tutorial documentation. SYNOPSIS # For an informal overview of Rose::DB::Object, please Rose::DB::Object - Extensible, high performance object-relational mapper (ORM).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |