in reply to Re^3: SQL INSERTs don't work
in thread SQL INSERTs don't work
Seems odd that they'd leave the error checking off of the connect when they do it in the section called "manual error checking". I'd honestly like to know if my programming style is wrong. I read once that RaiseError applied to the connect and have been leaving the 'or die "Couldn't connect..."' off ever since.#!/usr/bin/perl -w # # ch04/error/ex2: Small example using automatic error handling with # RaiseError, i.e., the program will abort upon detection # of any errors. use DBI; # Load the DBI module my ($dbh, $sth, @row); ### Perform the connection using the Oracle driver $dbh = DBI->connect( "dbi:Oracle:archaeo", "username", "password" , { PrintError => 0, ### Don't report errors via warn( ) RaiseError => 1 ### Do report errors via die( ) } ); ### Prepare a SQL statement for execution $sth = $dbh->prepare( "SELECT * FROM megaliths" ); ### Execute the statement in the database $sth->execute( ); ### Retrieve the returned rows of data while ( @row = $sth->fetchrow_array( ) ) { print "Row: @row\n"; } ### Disconnect from the database $dbh->disconnect( ); exit;
thor
Feel the white light, the light within
Be your own disciple, fan the sparks of will
For all of us waiting, your kingdom will come
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: SQL INSERTs don't work
by dragonchild (Archbishop) on Nov 09, 2004 at 13:50 UTC |