NAME

DBIO::Sybase::Util - Shared Sybase ASE-specific helper functions for DBIO

VERSION

version 0.900007

SYNOPSIS

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

my $message = mask_error_details(
  q{Syntax error during implicit conversion of CHAR value 'abc' to a DATE field.}
);
# Syntax error during implicit conversion of CHAR value '***' to a DATE field.

DESCRIPTION

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

METHODS

mask_error_details

my $message = mask_error_details($message);
my $message = mask_error_details($message, \@binds);

ASE writes the offending value into the text of some of its errors, also when the value was a bind, and so does its client library. The family's rule is that a message names keys, columns and options, never values; the text of the engine is the driver's to keep to it, and this is where the driver does.

Every value in the sentences that quote one is replaced by ***; the message number, the type, the column, the constraint and the table stay.

Syntax error during implicit conversion of CHAR value '***' to a DATE field.
cs_convert: ... common library error: ... to_numeric() failed for '***'
cs_convert failed (to_money(***))
Create unique index aborted on duplicate key.  Primary key is '***'
Syntax error converting the varchar value '***' to a column of data type int

A value is not escaped in these texts and may hold quotes, commas, colons or line breaks; each rule ends the value at the last place its sentence can end, and where that is not certain it masks more, not less.

\@binds is optional: the values bound to the statement. Each one of four characters or more that is found elsewhere in the message is replaced as well. Shorter values, undef and references are not looked for, since a letter or a number is part of any text; the sentences above hold those. A bound value with a line break makes the key of the duplicate-key message run to the end of the text.

A message the sentences do not know is returned as it is, and so is one without a value: Attempt to insert NULL value into column 'id', table 't'; column does not allow nulls., Attempt to insert duplicate key row in object 't' with unique index 'x', Implicit conversion from datatype 'VARCHAR' to 'INT' is not allowed.

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.