NAME

OpenInteract2::SPOPS::DBI - Common SPOPS::DBI-specific methods for objects

SYNOPSIS

# In configuration file
'myobj' => {
   'isa'   => [ qw/ ... OpenInteract2::SPOPS::DBI ... / ],

   # Yes, I want OI to find my fields for me.
   'field_discover' => 'yes',
}

DESCRIPTION

This class provides common datasource access methods required by SPOPS::DBI.

METHODS

global_datasource_handle( [ $connect_key ] )

Returns a DBI handle corresponding to the connection key $connect_key. If $connect_key is not given, then the connection key specified for the object class is used. If the object class does not have a connection key (which is normal if you are using only one database), we use the key specified in the server configuration file in 'default_connection_db'.

global_db_handle( [ $connect_key ] )

THIS WILL THROW AN ERROR. OI 1.x supported this for backward compatibility. No longer.

connection_info( [ $connect_key ] )

Returns a hashref of DBI connection information. If no $connect_key is given then we get the value of 'datasource' from the object configuration.

See the server configuration file for documentation on what is in the hashref.

SPOPS::ClassFactory Methods

You will never need to call the following methods from your object, but you should be aware of them.

behavior_factory( $class )

Creates the 'discover_fields' behavior (see below) in the 'manipulate_configuration' slot of the SPOPS::ClassFactory process.

discover_fields( $class )

If 'field_discover' is set to 'yes' in your class configuration, this will find the fields in your database table and set the configuration value 'field' as appropriate. Pragmatically, this means you do not have to list your fields in your class configuration -- every time the server starts up the class interrogates the table for its properties.

BUGS

None known.

TO DO

Nothing known.

SEE ALSO

OpenInteract2::SPOPS

SPOPS::DBI

SPOPS::ClassFactory

SPOPS::Manual::CodeGeneration

COPYRIGHT

Copyright (c) 2002-2003 Chris Winters. All rights reserved.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

AUTHORS

Chris Winters <chris@cwinters.com>