July 2005
Intermediate to advanced
1032 pages
27h 10m
English
Now, let's turn our attention to query processing. DBI treats SELECT commands and non-SELECT commands differently. Commands other than SELECT require less-complex processing, so let's look at those first. Listing 14.6 shows the source code for client3a:
1 #!/usr/bin/perl -W
2 #
3 # Filename: client3a.pl
4 #
5
6 use strict;
7 use DBI;
8
9 my $dbh = DBI->connect( "dbi:Pg:", undef, undef, {PrintError => 0} )
10 or die "Can't connect to PostgreSQL: $DBI::errstr ($DBI::err)\n";
11
12 my $rows = $dbh->do( $ARGV[0] );
13
14 if( !defined( $rows )) {
15 print( $dbh->errstr."(".$dbh->err().")\n" );
16 }
17 else {
18 print( "Ok: $rows rows affected\n" );
19 }
20
21 $dbh->disconnect();
|
After successfully ...
Read now
Unlock full access