Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 244671 Details for
Bug 360501
Error message reported by new perl-DBD-MySQL packages
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
Prepared testing script "test.pl" I used for testing
test.pl (text/x-perl), 12.53 KB, created by
Jan Lieskovsky
on 2007-10-31 16:21:46 UTC
(
hide
)
Description:
Prepared testing script "test.pl" I used for testing
Filename:
MIME Type:
Creator:
Jan Lieskovsky
Created:
2007-10-31 16:21:46 UTC
Size:
12.53 KB
patch
obsolete
>#!/usr/bin/perl -w > >use DBI; > >my ($dbname,$hostname,$user,$password) = ("test","127.0.0.1","testuser","testuser"); > ># We will create user, architecture, package, release and bug tables >my @tables = ("user","architecture","package","release","bug"); > ># User table details >my @user=("id","SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT","name","VARCHAR(20) CHARACTER SET utf8","surname","VARCHAR(20) CHARACTER SET utf8", > "role","ENUM('reviewer','corrector','admin') CHARACTER SET utf8","PRIMARY KEY","(id)", "FULLTEXT (surname));"); > ># Architecture table details >my @architecture=("id","SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT","name","VARCHAR(10) CHARACTER SET utf8","description","VARCHAR(20) CHARACTER SET utf8", > "PRIMARY KEY","(id)","FULLTEXT (name));"); > ># Package table details >my @package=("id","SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT","name","VARCHAR(30) CHARACTER SET utf8","description","VARCHAR(300) CHARACTER SET utf8", > "version","VARCHAR(30) CHARACTER SET utf8","PRIMARY KEY","(id)", "user_fk","SMALLINT UNSIGNED NOT NULL REFERENCES user(id)", > "arch_fk", "SMALLINT UNSIGNED NOT NULL REFERENCES architecture(id)", "rel_fk", "SMALLINT UNSIGNED NOT NULL REFERENCES release(id)", > "FULLTEXT (description));"); > > ># Release table details >my @release=("id","SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT","name","ENUM('RHEL-2.1','RHEL-3','RHEL-4','RHEL-5')","PRIMARY KEY","(id));"); > > ># Bug table details >my @bug=("id","SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT","bname","VARCHAR(30) CHARACTER SET utf8","bdescription","VARCHAR(300) CHARACTER SET utf8", > "PRIMARY KEY","(id)","pkg_fk","SMALLINT UNSIGNED NOT NULL REFERENCES package(id)","FULLTEXT (bname,bdescription));"); > >sub db_connect { > > my $dsn = "DBI:mysql:database=$dbname;host=$hostname"; > > my $dbh = DBI->connect($dsn, $user, $password, > {'RaiseError' => 1}); > > return \$dbh; > >} > >sub create_tables { > my $dbptr = shift; > my $sql_query = &create_table(@user); > print "Performing SQL query: \n $sql_query"; > eval { $$dbptr->do($sql_query) }; > die "Creation of table user failed: $@\n" if $@; > print " [ OK ] \n" unless $@; > > $sql_query = &create_table(@architecture); > print "Performing SQL query: \n $sql_query"; > eval { $$dbptr->do($sql_query) }; > die "Creation of table architecture failed: $@\n" if $@; > print " [ OK ] \n" unless $@; > > $sql_query = &create_table(@package); > print "Performing SQL query: \n $sql_query"; > eval { $$dbptr->do($sql_query) }; > die "Creation of table package failed: $@\n" if $@; > print " [ OK ] \n" unless $@; > > $sql_query = &create_table(@release); > print "Performing SQL query: \n $sql_query"; > eval { $$dbptr->do($sql_query) }; > die "Creation of table release failed: $@\n" if $@; > print " [ OK ] \n" unless $@; > > $sql_query = &create_table(@bug); > print "Performing SQL query: \n $sql_query"; > eval { $$dbptr->do($sql_query) }; > die "Creation of table bug failed: $@\n" if $@; > print " [ OK ] \n" unless $@; > print "Tables: user, architecture, package, release and bug successfully created. \n" unless $@; >} > >sub drop_tables { > my $dbptr = shift; > print "Performing SQL query: DROP TABLE bug"; > eval { $$dbptr->do("DROP TABLE bug") }; > die "Dropping table bug failed: $@\n" if $@; > print " [ OK ] \n" unless $@; > > print "Performing SQL query: DROP TABLE release"; > eval { $$dbptr->do("DROP TABLE release") }; > die "Dropping table release failed: $@\n" if $@; > print " [ OK ] \n" unless $@; > > print "Performing SQL query: DROP TABLE package"; > eval { $$dbptr->do("DROP TABLE package") }; > die "Dropping table package failed: $@\n" if $@; > print " [ OK ] \n" unless $@; > > print "Performing SQL query: DROP TABLE architecture"; > eval { $$dbptr->do("DROP TABLE architecture") }; > die "Dropping table architecture failed: $@\n" if $@; > print " [ OK ] \n" unless $@; > > print "Performing SQL query: DROP TABLE user"; > eval { $$dbptr->do("DROP TABLE user") }; > die "Dropping table user failed: $@\n" if $@; > print " [ OK ] \n" unless $@; > > print "Tables: user, architecture, package, release and bug successfully dropped. \n" unless $@; > >} > >sub create_table { > my @table = @_; > my $table_creation = "CREATE TABLE "; > my $counter = 0; > for $item (@table) { > if($table_creation eq "CREATE TABLE ") { > $table_creation .= shift(@tables)."("; > } > $table_creation .= "$item " if($counter%2 == 0); > $table_creation .= "$item, " if($counter%2 != 0); > $counter++; > } > $table_creation = substr($table_creation, 0, length($table_creation)-2); > return $table_creation; >} > >sub fillin_user_table { > my $dbptr = shift; > open(IN,"user.txt") || die "Check presence of file user.txt in your CWD! \n"; > while(<IN>) { > next if(/^#.*/ || /^\s*$/); # We ignore the comments from the "user.txt" file and blank lines > $query = "INSERT INTO user VALUES ".$_; > chomp($query); > print "Performing SQL query: $query "; > eval { $$dbptr->do($query) }; > die "Inserting row $query into table user failed: $@\n" if $@; > print " [ OK ] \n" unless $@; > } > close(IN); >} > >sub fillin_architecture_table { > my $dbptr = shift; > open(IN,"arch.txt") || die "Check presence of file arch.txt in your CWD! \n"; > while(<IN>) { > next if(/^#.*/ || /^\s*$/); # We ignore the comments from the "arch.txt" file and blank lines > $query = "INSERT INTO architecture VALUES ".$_; > chomp($query); > print "Performing SQL query: $query "; > eval { $$dbptr->do($query) }; > die "Inserting row $query into table architecture failed: $@\n" if $@; > print " [ OK ] \n" unless $@; > } > close(IN); >} > >sub fillin_release_table { > my $dbptr = shift; > open(IN,"rel.txt") || die "Check presence of file rel.txt in your CWD! \n"; > while(<IN>) { > next if(/^#.*/ || /^\s*$/); # We ignore the comments from the "rel.txt" file and blank lines > $query = "INSERT INTO release VALUES ".$_; > chomp($query); > print "Performing SQL query: $query "; > eval { $$dbptr->do($query) }; > die "Inserting row $query into table release failed: $@\n" if $@; > print " [ OK ] \n" unless $@; > } > close(IN); >} > >sub fillin_package_table { > my $dbptr = shift; > open(IN,"pkg.txt") || die "Check presence of file pkg.txt in your CWD! \n"; > while(<IN>) { > next if(/^#.*/ || /^\s*$/); # We ignore the comments from the "pkg.txt" file and blank lines > $query = "INSERT INTO package VALUES ".$_; > chomp($query); > print "Performing SQL query: $query "; > eval { $$dbptr->do($query) }; > die "Inserting row $query into table package failed: $@\n" if $@; > print " [ OK ] \n" unless $@; > } > close(IN); >} > >sub fillin_bug_table { > my $dbptr = shift; > open(IN,"bug.txt") || die "Check presence of file bug.txt in your CWD! \n"; > while(<IN>) { > next if(/^#.*/ || /^\s*$/); # We ignore the comments from the "bug.txt" file and blank lines > $query = "INSERT INTO bug VALUES ".$_; > chomp($query); > print "Performing SQL query: $query "; > eval { $$dbptr->do($query) }; > die "Inserting row $query into table bug failed: $@\n" if $@; > print " [ OK ] \n" unless $@; > } > close(IN); >} > >sub select_user_table { > my $dbptr = shift; > my $sth = undef; > my $query = "SELECT id, name, surname FROM user WHERE role LIKE 'reviewer'"; > print "Performing SQL query: $query "; > eval { $sth = $$dbptr->prepare($query); > $sth->execute(); }; > die "Performing $query from table user failed: $@\n" if $@; > unless ($@) { > print " [ OK ] \n" unless $@; > my $numFields = $sth->{'NUM_OF_FIELDS'}; > my $counter = 1; > while (my $ref = $sth->fetchrow_arrayref) { > print "Item \#".eval { $counter++}.": "; > for (my $i = 0; $i < $numFields; $i++) { > printf("%s%s", $i ? "," : "", $$ref[$i]); > } > print "\n"; > } > } >} > >sub select_architecture_table { > my $dbptr = shift; > my $sth = undef; > my $query = "SELECT * FROM architecture WHERE description LIKE '\%bit\%'"; > print "Performing SQL query: $query "; > eval { $sth = $$dbptr->prepare($query); > $sth->execute(); }; > die "Performing $query from table architecture failed: $@\n" if $@; > unless ($@) { > print " [ OK ] \n" unless $@; > my $numFields = $sth->{'NUM_OF_FIELDS'}; > my $counter = 1; > while (my $ref = $sth->fetchrow_arrayref) { > print "Item \#".eval { $counter++}.": "; > for (my $i = 0; $i < $numFields; $i++) { > printf("%s%s", $i ? "," : "", $$ref[$i]); > } > print "\n"; > } > } > > $query = "SELECT * FROM architecture WHERE name LIKE '\%s390\%'"; > print "Performing SQL query: $query "; > eval { $sth = $$dbptr->prepare($query); > $sth->execute(); }; > die "Performing $query from table architecture failed: $@\n" if $@; > unless ($@) { > print " [ OK ] \n" unless $@; > my $numFields = $sth->{'NUM_OF_FIELDS'}; > my $counter = 1; > while (my $ref = $sth->fetchrow_arrayref) { > print "Item \#".eval { $counter++}.": "; > for (my $i = 0; $i < $numFields; $i++) { > printf("%s%s", $i ? "," : "", $$ref[$i]); > } > print "\n"; > } > } > >} > > >sub select_release_table { > my $dbptr = shift; > my $sth = undef; > my $query = "SELECT * FROM release WHERE name LIKE '\%RHEL\%'"; > print "Performing SQL query: $query "; > eval { $sth = $$dbptr->prepare($query); > $sth->execute(); }; > die "Performing $query from table release failed: $@\n" if $@; > unless ($@) { > print " [ OK ] \n" unless $@; > my $numFields = $sth->{'NUM_OF_FIELDS'}; > my $counter = 1; > while (my $ref = $sth->fetchrow_arrayref) { > print "Item \#".eval { $counter++}.": "; > for (my $i = 0; $i < $numFields; $i++) { > printf("%s%s", $i ? "," : "", $$ref[$i]); > } > print "\n"; > } > } > >} > >sub select_package_table { > my $dbptr = shift; > my $sth = undef; > my $query = "SELECT * FROM package WHERE arch_fk = '1'"; > print "Performing SQL query: $query "; > eval { $sth = $$dbptr->prepare($query); > $sth->execute(); }; > die "Performing $query from table package failed: $@\n" if $@; > unless ($@) { > print " [ OK ] \n" unless $@; > my $numFields = $sth->{'NUM_OF_FIELDS'}; > my $counter = 1; > while (my $ref = $sth->fetchrow_arrayref) { > print "Item \#".eval { $counter++}.": "; > for (my $i = 0; $i < $numFields; $i++) { > printf("%s%s", $i ? "," : "", $$ref[$i]); > } > print "\n"; > } > } > >} > >sub select_bug_table { > my $dbptr = shift; > my $sth = undef; > my $query = "SELECT * FROM bug WHERE bname LIKE '\%BZ\#\%'"; > print "Performing SQL query: $query "; > eval { $sth = $$dbptr->prepare($query); > $sth->execute(); }; > die "Performing $query from table bug failed: $@\n" if $@; > unless ($@) { > print " [ OK ] \n" unless $@; > my $numFields = $sth->{'NUM_OF_FIELDS'}; > my $counter = 1; > while (my $ref = $sth->fetchrow_arrayref) { > print "Item \#".eval { $counter++}.": "; > for (my $i = 0; $i < $numFields; $i++) { > printf("%s%s", $i ? "," : "", $$ref[$i]); > } > print "\n"; > } > } > >} > ># We connect to the database >print "Opening the connection to the database... \n"; >my $dbconn = &db_connect; >print "Successfully connected to the database: test \n" if($dbconn); > ># We create the tables >print "Creating tables: user, architecture, release, package and bug... \n"; >&create_tables($dbconn); > >print "Filling table user... \n"; ># We fill in the "user" table >&fillin_user_table($dbconn); > >print "Filling table architecture... \n"; ># We fill in the "architecture" table >&fillin_architecture_table($dbconn); > >print "Filling table release... \n"; ># We fill in the "release" table >&fillin_release_table($dbconn); > >print "Filling table package... \n"; ># We fill in the "package" table >&fillin_package_table($dbconn); > >print "Filling table bug... \n"; ># We fill in the "bug" table >&fillin_bug_table($dbconn); > ># Select some data from user table >print "Selecting data from user table... \n"; >&select_user_table($dbconn); > ># Select some data from architecture table >print "Selecting data from architecture table...\n"; >&select_architecture_table($dbconn); > ># Select some data from release table >print "Selecting data from release table...\n"; >&select_release_table($dbconn); > ># Select some data from package table >print "Selecting data from package table...\n"; >&select_package_table($dbconn); > ># Select some data from bug table >print "Selecting data from bug table...\n"; >&select_bug_table($dbconn); > >print "Dropping tables user, architecture, release, package and bug... \n"; ># We drop the tables >&drop_tables($dbconn); > >print "Closing the connection to the database... \n"; ># We close the connection to the database >$$dbconn->disconnect(); >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 360501
: 244671 |
244681
|
244691
|
244701
|
244711
|
244721
|
244731