GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  TANGRAM::RELATIONAL (3)

.ds Aq ’

NAME

Tangram::Relational - Orthogonal Object Persistence in Relational Databases

CONTENTS

SYNOPSIS



   use Tangram;

   $schema = Tangram::Relational->schema( $hashref );

   Tangram::Relational->deploy($schema, $dbh);

   $storage = Tangram::Relational->connect( $schema,
      $data_source, $username, $password );

   $storage->disconnect();

   Tangram::Relational->retreat($schema, $dbh);



DESCRIPTION

This is the entry point in the vanilla object-relational persistence backend. Vendor-specific backends should be used when they exist. Currently Mysql, Sybase and Oracle have such backends; see Tangram::mysql, Tangram::Sybase and Tangram::Oracle.

More backends could be added in the future; they might implement persistence in XML documents, pure object databases, using C database libraries to bypass the need for an RDBMS, etc.

CLASS METHODS

    schema



   $schema = Tangram::Relational->schema( $hashref );



Returns a new Schema object. See Tangram::Schema.

    deploy



   Tangram::Relational->deploy($schema);
   Tangram::Relational->deploy($schema, HANDLE);
   Tangram::Relational->deploy($schema, @dbi_args);



Writes SQL statements for preparing a database for use with the given $schema.

Called with a single argument, writes SQL statements to STDOUT.

Called with two arguments, writes SQL statements to HANDLE. HANDLE may be a DBI connection handle or a file handle.

Called with more than two arguments, passes all but the first to DBI::connect() and writes statements to the resulting DBI handle, which is automatically closed.

The SQL code is only guaranteed to work on newly created databases.

    connect



   $storage = Tangram::Relational->connect( $schema,
      $data_source, $user, $password, \%options )



Connects to a storage and return a handle object. Dies in case of failure.

$schema is a Schema object describing the system of classes stored in the database.

$data_source, $user and $password are passed directly to DBI::connect().

\%options is a reference to a hash containing connection options. See Tangram::Storage for a description of available options.

    retreat



   Tangram::Relational->retreat($schema);
   Tangram::Relational->retreat($schema, HANDLE);
   Tangram::Relational->retreat($schema, @dbi_args);



Remove the tables created by deploy(). Only guaranteed to work against a database that was deployed using exactly the same schema.

For an explanation of the possible argument lists, see deploy.

WRITING A VENDOR DRIVER

Like Charles Moore (inventor of Forth) used to say, standards are great, everybody should have one!.

Tangram can take advantage of extensions available in some SQL dialects.

To create a vendor-specific driver, call it Tangram::Foo (where Foo is the name of the DBI driver, as would be selected with the DBI connection string dbi:Foo:), and derive Tangram::Relational.

For now, the existing back-ends should be used as examples of how to extend Tangram to support different databases or utilise some of their more exotic features.

Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 TANGRAM::RELATIONAL (3) 2015-10-09

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.