[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

09/12/2009 at 02:00PM PDT, ID: 24727211 | Points: 500
[x]
Attachment Details

Retrievieving Database Error String Via PERL

Asked by frasierphilips in Perl Programming Language, MySQL Server, Databases Miscellaneous

Tags: PERL MYSQL DBI

I am writing a browser based application using AJAX and PERL and I want to retrieve an error string in the event of a database error.  I've tried all sorts of things but I can't retrieve (or for that matter detect) an error/error message.

I know there are several ways to connect to a database in PERL. I DO NOT want to change my connection method, this code is all over the place.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
$dbh = DBI->connect("dbi:mysql:database=dbxxxxxxxxx;host=localhost;mysql_socket=/tmp/mysql5.sock;user=dbxxxxxxxxxx;password=xxxxxxxx");
 
	if ($Temp[1] eq "true")
		{
		$qst="DELETE FROM tbstock_items where `Stock #`=\"$Temp[0]\"";$dbh->do($qst);	
		$result="stockStatus^Stock Item Deleted";
		}	
	else
		{
		$query{Avg_Markup}/=100;
		if ($query{Archive} eq "true") {$query{Archive}="1";} else {$query{Archive}="0";}
			
		foreach $vl (keys %query)
			{
			if ($vl ne "" && $vl ne "STOCKNO")
				{
				$vlname=$vl;
				if ($vl eq "SubCategory") {$vlname="Sub-Category";}
				$qst="update tbstock_items set `$vlname` = \"$query{$vl}\" where `Stock #`=\"$Temp[0]\"";$dbh->do($qst);
	
				}
			}
 
		if ($DBI::errstr ne "") {$result="Error^Error:- $DBI::errstr"} else {$result="stockStatus^Data Saved";}
 
Keywords: Retrievieving Database Error String Via…
 
Loading Advertisement...
 
[+][-]09/12/09 09:05 PM, ID: 25318902

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/13/09 01:48 AM, ID: 25319470

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09/14/09 05:01 AM, ID: 25324553

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/20/09 01:15 AM, ID: 25376272

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/16/09 05:42 AM, ID: 25588927

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20090824-EE-VQP-74 - Hierarchy / EE_QW_3_20080625