Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Re: Re: Re: Re: Re: Re: DBI ODBC CGI Access hangs on execution of select statement

by buttroast (Scribe)
on Apr 14, 2003 at 03:01 UTC ( [id://250210]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Re: Re: Re: Re: DBI ODBC CGI Access hangs on execution of select statement
in thread DBI ODBC CGI Access hangs on execution of select statement

Hello, I am at home now. I do have a lock file issue...How do I get rid of it? I don't want to have to leave the file there forever. I don't know how to delete the ldb file. I also cannot delete the JETTMP file that is in cgi-bin. I'm using Apache and Windows ME. I don't want to have to rename my db either. Here is my entire script in case you see something wrong that I am overlooking...There is no security as far as incoming data checks yet
#!c:\Perl\bin\perl.exe -wT use strict; use warnings; use CGI qw(:standard); use File::Slurp; use DBI; $CGI::DISABLE_UPLOADS = 1; # Disable uploads $CGI::POST_MAX = 51_200; # Maximum number of bytes per POST # Debugging info $|=1; use CGI::Carp('fatalsToBrowser'); # # Get our configuration # my %config = read_ini("genealogy.ini"); my $locality = $config{LOCALITY}; my $sitename = $config{SITE_NAME}; my $thisscript = "genealogy.pl"; # # Connect to the database # my $dbName = "DBI:ODBC:genealogy"; my $dbUserName = ""; my $dbPassword = ""; my $dbh = DBI->connect( $dbName, $dbUserName, $dbPassword ); my $sql = ""; my $dataObject = ""; # # Get parameters # my $in_lname = param( "lname" ); my $in_id = param( "id" ); # # Variables # my( $last_name, $first_name, $middle_name, $maiden_name, $nick_name, $ +suffix, $prefix, $birth_date, $birth_place, $death_date, $death_place, $other_surna +mes, $paper_name, $paper_locality, $paper_date, $paper_page, $paper_col +umn, $obituary_id, $paper_id ); # # Print the page header # print header( "text/html" ), start_html(-title => $sitename), h1($sitename); if ($in_lname eq "") { if ($in_id eq "") { print start_form( { -action => "$thisscript", -enctype => "application/x-www-form-urlenc +oded", -method => "post" } ); print table( {-border => "0"}, Tr( td( "Enter a Last Name:" ), td( input( { -type => "text", -size => "30", -maxle +ngth => "30", -name => "lname" } ) ) ), Tr( td( { -colspan => "2", -align => "right" }, input( { -type => "submit", -value => "Search"} +), input( { -type => "reset"} ) ) ) ); } else { $sql = "SELECT lname, fname, middle, nickname, maiden, suffix, + prefix, paperdate, page, column, birthdate, birthplace, deathdate, d +eathplace, othersurnames, papername, paperlocality FROM obituaries, n +ewspapers WHERE obituaryid = $in_id AND obituaries.paperid = newspape +rs.paperid"; $dataObject = $dbh->prepare( $sql ); $dataObject->execute(); $dataObject->bind_columns( undef, \$last_name, \$first_name, \ +$middle_name, \$nick_name, \$maiden_name, \$suffix, \$prefix, \$paper +_date, \$paper_page, \$paper_column, \$birth_date, \$birth_place, \$d +eath_date, \$death_place, \$other_surnames, \$paper_name, \$paper_loc +ality ); $dataObject->fetch(); print p( "Individual view for obituary #$in_id:" ); print table( { -border => "0" }, Tr( th( { -align => "left" }, "Last Name:" ), td( +$last_name ) ), Tr( th( { -align => "left" }, "First Name:" ), td( +$first_name ) ), Tr( th( { -align => "left" }, "Middle Name:" ), td( +$middle_name ) ), Tr( th( { -align => "left" }, "Nick Name:" ), td( +$nick_name ) ), Tr( th( { -align => "left" }, "Maiden Name:" ), td( +$maiden_name ) ), Tr( th( { -align => "left" }, "Suffix:" ), td( +$suffix ) ), Tr( th( { -align => "left" }, "Prefix:" ), td( +$prefix ) ), Tr( th( { -align => "left" }, "Birth Date:" ), td( +$birth_date ) ), Tr( th( { -align => "left" }, "Birth Place:" ), td( +$birth_place ) ), Tr( th( { -align => "left" }, "Death Date:" ), td( +$death_date ) ), Tr( th( { -align => "left" }, "Death Place:" ), td( +$death_place ) ), Tr( th( { -align => "left" }, "Other Names:" ), td( +$other_surnames ) ), Tr( th( { -align => "left" }, "Paper Name:" ), td( +$paper_name ) ), Tr( th( { -align => "left" }, "Locality:" ), td( +$paper_locality ) ), Tr( th( { -align => "left" }, "Paper Date:" ), td( +$paper_date ) ), Tr( th( { -align => "left" }, "Page:" ), td( +$paper_page ) ), Tr( th( { -align => "left" }, "Column:" ), td( +$paper_column ) ) ), p(a( { -href => "$thisscript" }, "Click Here to Search Again!" + )); $dataObject->finish(); $dbh->disconnect(); } } else { $sql = "SELECT obituaryid, lname, fname, middle, suffix, prefix, b +irthdate, deathdate, paperdate FROM obituaries where lname like '$in_ +lname%' ORDER BY lname, fname, middle, birthdate, deathdate"; $dataObject = $dbh->prepare( $sql ); $dataObject->execute(); $dataObject->bind_columns( undef, \$obituary_id, \$last_name, \$fi +rst_name, \$middle_name, \$suffix, \$prefix, \$birth_date, \$death_da +te, \$paper_date ); print p( "Your search for \"$in_lname\" returned the following res +ults:" ); print qq!<TABLE border="1"><TR><TH>Last Name</TH><TH>First Name</T +H><TH>Middle Name</TH><TH>Prefix</TH><TH>Suffix</TH><TH>Birth</TH><TH +>Death</TH><TH>Paper Date</TH><TH>&nbsp;</TH></TR>!; while( $dataObject->fetch() ) { print "<TR><TD>$last_name</TD>", "<TD>$first_name</TD>", "<TD>$middle_name</TD>", "<TD>$prefix</TD>", "<TD>$suffix</TD>", "<TD>$birth_date</TD>", "<TD>$death_date</TD>", "<TD>$paper_date</TD>", "<TD><A HREF=\"$thisscript?id=$obituary_id\">More Info</ +A></TD></TR>"; } print qq!</TABLE>!; print p(a( { -href => "$thisscript" }, "Click Here to Search Again +!" )); $dataObject->finish(); $dbh->disconnect(); } # # Print the page and get out. # print end_html(); exit; sub read_ini { my @local_ini = read_file(shift); my ($key,$value); my %config; foreach(@local_ini) { chomp; # We should have a usable value now, add it to the hash ($key,$value) = split("=",$_); next unless $value; $config{$key} = $value; } # Give configuration back to caller return %config; }
Thanks buttroast
  • Comment on Re: Re: Re: Re: Re: Re: Re: DBI ODBC CGI Access hangs on execution of select statement
  • Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://250210]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (1)
As of 2024-04-25 01:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found