RT 3.8.17 Documentation

RT::Handle

Go to latest version →

NAME

RT::Handle - RT's database handle

SYNOPSIS

    use RT;
    BEGIN { RT::LoadConfig() };
    use RT::Handle;

DESCRIPTION

RT::Handle is RT specific wrapper over one of DBIx::SearchBuilder::Handle classes. As RT works with different types of DBs we subclass repsective handler from DBIx::SerachBuilder. Type of the DB is defined by DatabasseType RT's config option. You must load this module only when the configs have been loaded.

METHODS

FinalizeDatabaseType

Sets RT::Handle's superclass to the correct subclass of DBIx::SearchBuilder::Handle, using the DatabaseType configuration.

Connect

Connects to RT's database using credentials and options from the RT config. Takes nothing.

BuildDSN

Build the DSN for the RT database. Doesn't take any parameters, draws all that from the config.

DSN

Returns the DSN for this handle. In order to get correct value you must build DSN first, see "BuildDSN".

This is method can be called as class method, in this case creates temporary handle object, "BuildDSN builds DSN" and returns it.

SystemDSN

Returns a DSN suitable for database creates and drops and user creates and drops.

Gets RT's DSN first (see DSN) and then change it according to requirements of a database system RT's using.

Database compatibility and integrity checks

Database maintanance

CreateDatabase $DBH

Creates a new database. This method can be used as class method.

Takes DBI handle. Many database systems require special handle to allow you to create a new database, so you have to use SystemDSN method during connection.

Fetches type and name of the DB from the config.

DropDatabase $DBH [Force => 0]

Drops RT's database. This method can be used as class method.

Takes DBI handle as first argument. Many database systems require special handle to allow you to create a new database, so you have to use SystemDSN method during connection.

Fetches type and name of the DB from the config.

InsertACL

InsertSchema

GetVersionFile

Takes base name of the file as argument, scans for <base name>-<version> named files and returns file name with closest version to the version of the RT DB.

InsertInitialData

Inserts system objects into RT's DB, like system user or 'nobody', internal groups and other records required. However, this method doesn't insert any real users like 'root' and you have to use InsertData or another way to do that.

Takes no arguments. Returns status and message tuple.

It's safe to call this method even if those objects already exist.

InsertData

Load some sort of data into the database, takes path to a file.

ACLEquivGroupId

Given a userid, return that user's acl equivalence group

← Back to index