NAME

DBIO::Firebird::Util - Shared Firebird-specific helper functions for DBIO

VERSION

version 0.900004

SYNOPSIS

use DBIO::Firebird::Util qw(mask_error_details);

my $message = mask_error_details(
  qq{-violation of PRIMARY or UNIQUE KEY constraint "INTEG_2" on table "t"\n}
  . q{-Problematic key value is ("ID" = 7, "EMAIL" = 'a@b.c')}
);
# ... -Problematic key value is ("ID" = ***, "EMAIL" = ***)

DESCRIPTION

Helpers of the Firebird driver that do not belong to one class.

METHODS

mask_error_details

my $text = mask_error_details($text, \@bound_values);

Replaces the values the Firebird server writes into an error text with ***. The type, the column, the constraint, the table and the error code stay. The optional second argument is the list of values bound to the statement; it only makes the reading of a key stricter (see below).

The sentences that hold a value:

Problematic key value is ("A" = 1, "B" = 'x')

(duplicate PRIMARY KEY or UNIQUE KEY, FOREIGN KEY) Every value becomes ***, the quoted column names stay: Problematic key value is ("A" = ***, "B" = ***). The server does not double a ' inside a value, so the text cannot always be taken apart. It is read column by column only when that is the one reading: the number of " = in the text is the number of columns found, and no bound value holds , " or ). Otherwise everything behind is becomes ***. A value of a statement without bound values that itself holds , "NAME" = cannot be told from a second column; the storage always passes the bound values, so only a literal in the statement can be read that way.

conversion error from string "..."

Becomes conversion error from string "***". The value may hold "; the mask reaches to the last " of the text.

validation error for column "T"."C", value "..."

The value becomes ***. The server's own marker for NULL (*** null ***) says nothing about data and stays.

A text without one of these sentences is returned as it is. Applying the function to its own result gives the same text. The values bound to the statement are not looked for here; that is the base storage's job ("_mask_error_values" in DBIO::Firebird::Storage::Common).

AUTHOR

DBIO & DBIx::Class Authors

COPYRIGHT AND LICENSE

Copyright (C) 2026 DBIO Authors Portions Copyright (C) 2005-2025 DBIx::Class Authors Based on DBIx::Class, heavily modified.

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