GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
SPOPS::Exception::DBI(3) User Contributed Perl Documentation SPOPS::Exception::DBI(3)

SPOPS::Exception::DBI - SPOPS exception with extra DBI parameters

 my $rows = eval { SPOPS::SQLInterface->db_select( \%params ) };
 if ( $@ and $@->isa( 'SPOPS::Exception::DBI' ) ) {
     print "Tried to excecute SQL: ", $@->sql, "\n",
           "with values: ", ( ref $@->bound_value )
                              ? join( " :: ", @{ $@->bound_value } ) : 'n/a',
           "but died with the message: ", $@->message, "\n";
 }

Same as SPOPS::Exception but we add three new properties:

sql ($)

The SQL statement SPOPS tried to run. Note that this may be empty if the exception was thrown before the statement could be prepared. (For instance, if SPOPS cannot find a datasource.)

bound_value (\@)

The value(s) that would have been bound to the various placeholders. This may return undef if SPOPS did not reach the stage where it collected the bound values or if there were none. So you will want to test and ensure the return value is an arrayref before using it as such, otherwise you will get the dreaded error: "Can't use an undefined value as an ARRAY reference".

action ($)

Indicates the DBI action (generally 'do', 'prepare' or 'execute') that was being run when SPOPS encountered the error. This may be empty if we did not even reach the DBI stage yet.

No extra methods, but we override 'to_string' so any SQL executed will be part of the error.

Additionally, you can use a shortcut if you are throwing errors:

 use SPOPS::Exception::DBI qw( spops_dbi_error );

 ...
 spops_dbi_error "I found a DBI error: $@ ",
                 { sql => $sql, action => 'prepare' };

None known.

Nothing known.

SPOPS::Exception

DBI

Copyright (c) 2001-2004 intes.net, inc.. All rights reserved.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

Chris Winters <chris@cwinters.com>
2004-06-02 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.