StoredHash::ARS - Remedy/ARS adapter for StoredHash
StoredHash::ARS allows the normal persistence methods of StoredHash to be used with Remedy ARS database backend (with few exceptions where certain method would not make sense).
ARS is much more constrained about DB side conventions than traditional relational databases. ID numbering is always automatic and primary key is always field called (actually numbered as ARS uses numbers for attribute names) '1'.
To learn to use StoredHash::ARS, read "perldoc StoredHash". The documentation here focuses only on ARS / Remedy specific quirks.
NOTE: This module is still experimental.
use StoredHash::ARS; use ARS; # ARS Connection my $ctrl = ars_Login($ENV{'ARS_SERVER'}, $ENV{'ARS_USER'}, $ENV{'ARS_PASS'}); # StoredHash persister configuration ('pkey' intentionally missing for ARS) my $shpc = {'table' => 'HPD::Helpdesk', 'dbh' => $ctrl, 'debug' => 0}; my $shp = StoredHash::ARS->new(%$shpc); # Load my hdent = $shp->load(['HD...']); # Insert, Update, Delete ... as usual
Method documentation focuses only on ASR specific differences. Be sure to read StoredHash documentation for an overview.
General notes:
StoredHash::ARS constructor. Notes on keyword parameters (in %opts).
Because Remedy always uses the same numeric name for primary key and auto-allocates id, the parameters 'pkeys' and 'autoid' are not relevant for Remedy.
Insert an entry into ARS database. Pass ARS Entry instance ($e) with NUMERIC Field IDs (i.e. not descriptive field names).
$e = {'240000005' => 'mrjohnsmith', '260000002' => 'mrjohnsmith@corp.com'}; my $eid = $sp->insert($e);
Return Remedy entry ID for the new entry (usable in further persistence ops).
Update entry in ARS database schema. Keyword params in %opts:
Delete an Entry by id ($eid) permanently from ARS database.
Return true value for successesful deletion.
Test presence of entry by ID ($eid) in ARS database. Return true for present in DB, false for not present.
Load an entry from Remedy database schema by its id ($eid). Keyword params in %opts:
Keyword parameters (in %opts):
Query columns for ARS Schema (given by persister internal field 'table' passed at construction time). Return numeric fieldnames sorted alphabetically (as ARS does not have deterministic order for fields).