Anyone got some input regarding - my auto population of custom fields project

Micah Breitenstein silver7 at gmail.com
Wed Jan 23 23:28:26 UTC 2008


I've run into a problem, and could use some assistance. I'm new to
Perl, and to contributing to the open source community. Please keep
that in mind if and when you respond.

Background Info: I have a MySQL database that contains a description
of about 100 different test systems.

Goal: Implement a method for users logging a new bug to auto populate
the contents of predefined custom fields based upon a supplied
systemID.

So far I've implemented the following changes to the file create.html.tmpl:
1.	Modified the contents of the template create.html.tmpl to display
custom fields in a two column format.
2.	Added a button titled "Fetch System Info"
3.	Implemented a JavaScript button "Clear System Info" to clear all
defined custom fields.

Now that my user interface modifications are complete I'm now working
on the problem of populating the custom fields based upon the user's
specified systemID. Remember I am not querying the Bugzilla database.
I am querying a separate MySQL database maintained by our System
Admin.

I've written a Perl script that allows me to connect to the MySQL
hardware lab database and perform a query. However, I am confused as
to how to implement the last portion of my project.

Should I be fetching and returning a complete list of systems and
corresponding info. If so how do I get the results of my query to be
available and usable via the template?


My Perl script is as follows:

#!/usr/bin/perl

use strict;
use DBI;


my $hwl_dbh = DBI->connect( 'dbi:mysql:hwl',
                        'XXX',
                        'XXX',
                        {
                          RaiseError => 1,
                          AutoCommit => 0
                        }
                      ) || die "Database connection not made: $DBI::errstr";
#my $hwl_sql = qq{ SELECT SysID, SysName, Model FROM `BB-Systems`};
my $hwl_sth = $hwl_dbh->prepare( "SELECT SysID, SysName, Model FROM
`BB-Systems`" );
$hwl_sth->execute();

my( $sysId, $sysName, $sysModel );
$hwl_sth->bind_columns( undef, \$sysId, \$sysName, \$sysModel );
my @test;

while( $hwl_sth->fetch() ) {
    print "$sysId, $sysName, $sysModel\n";
}
$hwl_sth->finish();
$hwl_dbh->disconnect();



More information about the developers mailing list