#!/usr/bin/perl
package Keyword;

#####################################################################
# Author : Shuai Weng
# Date   : March 2003
# 
#####################################################################

use strict;
use DBI;
use Carp;
use vars qw (@ISA %allowedConstructors);
use dictyBase_Table;
@ISA = qw (dictyBase_Table); # base class

# Class Globals

# put column names in the hash below, that are able to uniquely
# specify a row in the table

%allowedConstructors = (keyword=>undef,
			keyword_no=>undef);


####################################################################
sub DESTROY{
####################################################################
# nothing needs to be done 

}

####################################################################
sub colleagueInfoArrayRef {
####################################################################
    my ($self) = @_;

    my $schema = $self->schema;

    my $sth = $self->{'_dbh'}->prepare("
        SELECT C.colleague_no, C.last_name, C.first_name, C.suffix
        FROM   $schema.colleague C, $schema.coll_keyword CK
        WHERE  CK.keyword_no = ?
        AND    CK.colleague_no = C.colleague_no
        ORDER BY upper(C.last_name), upper(C.first_name)
    ");  
    $sth->execute($self->keyword_no);
    my $arrayRef = $sth->fetchall_arrayref();
    $sth->finish;
    return $arrayRef;

}



####################################################################
1; #################################################################
####################################################################

=pod

=head1 Name

Keyword.pm

=head1 Description

This perl object (Keyword.pm) acts as container for Keyword info in oracle database. Once an object has been instantiated, several methods are available to retrieve the attributes of the object. 


=head1 Instantiating a New Keyword Object

To instantiate a new Keyword object, you may use one of following syntaxes: 

my $obj = Keyword->new(dbh=>$dbh,
		       keyword_no=>$keywordNo);


OR 

my $obj = Keyword->new(dbh=>$dbh,
		       keyword=>$keyword);


where $dbh is a valid database handle to either dictyBase or SDEV. All passed in values must be valid values for the columns that were provided, otherwise the script will die, with an appropriate error message.
 

=head1 Accessor Methods


All accessor methods take the form of : 


my $column_value = $obj->column_name, eg: 


my $keyword = $obj->keyword; 


my $source = $obj->source;


etc. You can use an accessor for any valid column in the Keyword table. 

See valid columns in Keyword table:

http:///usr/local/dicty/www_dictybase/db/lib/cgi-bin/dictyBase/tableSpecifications?table=KEYWORD

=head1 getRow method

Usage:

my $row = $obj->getRow;

This method returns a tab-delimited row from keyword table.

=head1 Insert, update and delete Methods

You can also use 'Insert' class method and 'update' and 'delete' 
instance methods for inserting new row into database, updating and 
deleting info for a specified row. 

See dictyBase_Table documentation for usage details :

Update : http:///usr/local/dicty/www_dictybase/db/lib/staff/dictyBase/programmer/dictyBase_Table.html#Update_Method

Insert : http:///usr/local/dicty/www_dictybase/db/lib/staff/dictyBase/programmer/dictyBase_Table.html#Insert_Method

Delete : http:///usr/local/dicty/www_dictybase/db/lib/staff/dictyBase/programmer/dictyBase_Table.html#Delete_Method

=head1 Author

Shuai Weng

shuai@genome.stanford.edu

=cut











