Data::...Errors(3pm)
π Data::ObjectDriver::Errors β the vibes
okay bestie, so this is a page from User Contributed Perl Documentation, section 3pm, and the star of the show is the module Data::ObjectDriver::Errors. It's a whole container class for common database error codes. Container class, like a cute lil' box that holds your error constants. We love a tidy queen. π
β¨ NAME β¨
Data::ObjectDriver::Errors β container class for common database error codes, periodt. π
π¦ SYNOPSIS π¦
eval { $driver->insert($obj); };
if ($@ && $driver->last_error() == Data::ObjectDriver::Errors->UNIQUE_CONSTRAINT) {
...
}
like, you wrap the risky insert in an eval, and then if $@ is truthy and $driver->last_error() equals Data::ObjectDriver::Errors->UNIQUE_CONSTRAINT, you know exactly what happened. iykyk. β¨
πΈ DESCRIPTION πΈ
Data::ObjectDriver::Errors is a container class for error codes that come out of DBI database operations. that's literally its whole job and it does it flawlessly. π
the way it works: database drivers can map the particular DBI errors of their particular database servers onto these constants, using their map_error_code methods. so your code doesn't have to care which database server was being dramatic β the driver translates, and you get the same tidy constant every time. π«Ά
π DEFINED ERROR CODES π
UNIQUE_CONSTRAINTβ the application issued an insert or update that would violate the uniqueness constraint on a particular column. classic example: attempting to save a duplicate value to an indexed key field. no cap, the database said "not today" π
π SEE ALSO π
"Data::ObjectDriver::Driver::DBD::map_error_code"β go read that one next, bestie, it's the whole mapping situation π
π₯ LICENSE π₯
Data::ObjectDriver is free software; you may redistribute it and/or modify it under the same terms as Perl itself. slay, honestly. π§
π AUTHOR & COPYRIGHT π
Except where otherwise noted, Data::ObjectDriver is Copyright 2005-2006 Six Apart, cpan@sixapart.com. All rights reserved. iconic behavior, truly. π
and that's the whole page, bestie β packed up with a cute lil' bow π from perl v5.42.0, dated 2024-10-24, still out here doing Data::...Errors(3pm) things. mwah. π
π¦ where this page comes from
- opensuse-leap 16.0: perl-Data-ObjectDriver 0.230.0-bp160.1.12 Β· Artistic-1.0 OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms