The following methods can be used by all types of DBI handles:
err |
$rv = $h->err; |
Returns the native database engine error code from the last driver method called. The code is typically an integer, but you should not assume that.
The DBI resets $h->err to undef before most DBI method calls, so the value has only a short lifespan. Also, most drivers share the same error variables across all their handles, so calling a method on one handle will typically reset the error on all the other handles that are children of that driver.
errstr |
$str = $h->errstr; |
Returns the native database engine error message from the last driver method called. This has the same lifespan issues as the err method described above.
state |
$str = $h->state; |
Returns an error code in the standard SQLSTATE five-character format. Note that the specific success code 00000 is translated to 0 (false). If the driver does not support SQLSTATE (and most don't), then state will return S1000 (General Error) for all errors.
trace |
$h->trace($trace_level); $h->trace($trace_level, $trace_filename); |
DBI trace information can be enabled for a specific handle (and any future children of that handle) by setting the trace level using the trace method.
See also the DBI->trace method for information about the DBI_TRACE environment variable.
trace_msg |
$h->trace_msg($message_text); $h->trace_msg($message_text, $min_level); |
Writes $message_text to the trace file if trace is enabled for $h or for the DBI as a whole. Can also be called as DBI- >trace_msg($msg). See trace.
func |
$h->func(@func_arguments, $func_name); |
The func method can be used to call private non-standard and non-portable methods implemented by the driver. Note that the function name is given as the last argument.
Copyright © 2001 O'Reilly & Associates. All rights reserved.