Aaron Brown > perfSONAR_PS-Services-PingER-0.09 > perfSONAR_PS::DB::SQL::Base

Download:
perfSONAR_PS-Services-PingER-0.09.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.09   Source  

NAME ^

perfSONAR_PS::DB::SQL::Base - A class that provides data access for SQL databases

DESCRIPTION ^

This module provides access to the relevant DBI wrapped methods given the relevant contact points for the database. Any service specific SQL DB handler should ingerit from this class.

SYNOPSIS ^

  package  perfSONAR_PS::DB::SQL::PingER;

  # extend from this class
  
  use  perfSONAR_PS::DB::SQL::Base;
  use base  perfSONAR_PS::DB::SQL::Base;
  
  
  1;

METHODS ^

new

    constructor accepts hashref as parameter
    returns object

init

   accepts hashref as single parameter and initializes object
  returns  
 
    0 = if everything is okay
   -1 = somethign went wrong 

connect

opens a connection to the database or reuses the cached one

Returns 0 = if everything is okay -1 = somethign went wrong

closeDB

closes the connection to the database Returns 0 = if everything is okay -1 = somethign went wrong

alive

   checks if db handle is alive
   Returns 
     0 = if everything is okay
   -1 = somethign went wrong

getFromTable

      accepts single hash param with keys:
      query => Rose::DB::Object::QueryBuilder type of query,
      table =>  table name
      validate => table validation HASHref constant
      index =>   name of the indexing key  for result 
      
      returns result as hashref keyd by $index
      or undef and sets ERRORMSG 

updateTable

      accepts singel hashref param with keys:
      set => hashref { for example  'ip_name' => $ip_name, 'ip_number' => $ip_number },
      table =>  table_name
      where => where clause ( formatted as Rose::DB::Object query )
  
      returns  
      
    0  if OK
   -1 = somethign went wrong 

insertTable

      accepts single hashref with keys:
      insert => {  'ip_name' => $ip_name, 'ip_number' => $ip_number },
      table =>  table_name 
      returns  
      
    0  or last inserted id number 
   -1 = somethign went wrong 

createTable

     create  table from template - second parameter is the name of the template table ( must exist )
    
    returns 
    
    0 - evrything is OK
    -1 - something is wrong

validateQuery

   vlaidated supplied query parameters against defined  fields for particular table
   optional arg $required is a hash of the required  table fields
   returns 
         
    0 = if everything is okay
   -1 = somethign went wrong 

fixTimestamp

  fix timestamp 
  
  returns
  
  fixed timestamp or undef if its not parseable

booleanToInt

    converts any boolean arg  to 0/1 int

tableExists

     check presence of the table

Returns

   0 = no table
   1 = table exists
syntax highlighting: