NAME

DBIO::DB2::Storage::Cursor - Reads the character columns of a Db2 result as characters and its decimals with a point

VERSION

version 0.900007

DESCRIPTION

DBD::DB2 returns the text of a result as the UTF-8 bytes the server holds, without the UTF-8 flag, and has no attribute to change that. This cursor decodes them: every column of a character type (CHAR, VARCHAR, LONG VARCHAR, CLOB, DBCLOB, the wide forms) of a database whose code set is UTF-8 ("_utf8_database" in DBIO::DB2::Storage). A binary column (BLOB, BINARY, VARBINARY) is left as it comes, a NULL stays NULL, and a database that is not UTF-8 is read as the DBD hands it over.

A numeric column with a fraction (DECIMAL, NUMERIC, REAL, DOUBLE, DECFLOAT) is delivered with a decimal point whatever the locale of the process is. The CLI formats such a value by the LC_CTYPE the process had when it connected, so under a German locale it hands over 1234567890,12, which Perl reads as 1234567890. Nothing a client can set steers that (not LANGUAGE, DB2CODEPAGE, DB2TERRITORY, a DSN key), and the process locale is not DBIO's to change, so the cursor repairs the text: a value of such a column with exactly one comma, optionally an exponent, and no grouping gets a point in its place. Every other value is left as it comes. DBIO sets no environment and no session setting for this, and does not touch the locale of the process. This holds with or without a UTF-8 database.

Used by DBIO::DB2::Storage as its cursor_class. Rows that do not come through a cursor ("select_single" in DBIO::Storage::DBI, the plan rows of explain) go through "decode_rows" as well.

METHODS

decode_rows

DBIO::DB2::Storage::Cursor->decode_rows($storage, $sth, \@row, ...);

Repairs, in place, the given rows (array references) of the result of $sth: the character columns are decoded when the database is UTF-8, and a numeric column with a fraction gets a decimal point for a comma, whether the database is UTF-8 or not. The one place that does it, for the cursor and for "select_single" in DBIO::DB2::Storage.

next

"next" in DBIO::Storage::DBI::Cursor, the columns repaired by "decode_rows".

all

"all" in DBIO::Storage::DBI::Cursor, the columns repaired by "decode_rows".

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.