# m_pullPortInfo.pl: module for SIP911.pl and/or getPortInfo.pl
# This module looks up SQL table and prints the physical location of the source.
#
# Usage: &pullPortInfo($Switch, $TempArray[0], $TempArray[1]);		       
#
# Copyright 2002 (c) year by Columbia University. All rights reserved.
#!/bin/env perl

sub pullPortInfo
{
    my($Data) = new Win32::ODBC("DSN=PortMap;UID=jisoo;PWD=joshua");
    my($q_switch, $q_board, $q_port) = @_;
    my($SqlString);
    $SqlString = "select * from PortMap where Switch='".$q_switch."' and Board=".$q_board." and Port=".$q_port;
    $Data->Win32::ODBC::Sql($SqlString);
    while ($Data->Win32::ODBC::FetchRow())
    {
	%TempData = $Data->Win32::ODBC::DataHash();
	$pmid = $TempData{'Pmid'};
	$building = $TempData{'Building'};
	$room = $TempData{'Room'};
	$jack = $TempData{'Jack'};
	$switch = $TempData{'Switch'};
	$board = $TempData{'Board'};
	$port = $TempData{'Port'};	
	print("PM ID:".$pmid." Building:".$building." Room:".$room." Jack:".$jack." Switch:".$switch." Board:".$board." Port:".$port."\n");
    }
    $Data->Close();
    undef %TempData;
}


1;
