-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changing 'sv_setpvn' to 'sv_setpvn_mg' #171
Comments
Hi, I have the same issue. I narrowed it down to the following script. It seems to depend on NSL_LANG setting. use strict;
use warnings;
use v5.26;
use Devel::Peek;
use DBI;
use DBD::Oracle;
require bytes;
sub test {
$ENV{NLS_LANG} = $_[0];
my $dbh = DBI->connect(
'DBI:Oracle:host=xxx;service_name=xxx;port=1521',
'xxx',
'xxx',
);
my $sql = <<~EOsql;
SELECT '1.555' nam FROM dual union all
SELECT '2.6666' nam FROM dual union all
SELECT '3.44' nam FROM dual union all
SELECT '4.555' nam FROM dual order by nam
EOsql
my $sth = $dbh->prepare($sql);
$sth->execute();
say "---- env.nls_lang $ENV{NLS_LANG}";
while (my $row = $sth->fetchrow_arrayref()) {
say $row->[0] . q( ) . length($row->[0]) . q( - ) . bytes::length($row->[0]);
#Dump($row->[0]);
}
}
say "Perl: $^V";
say "DBD::Oracle $DBD::Oracle::VERSION";
test(q());
test(q(GERMAN_GERMANY.AL32UTF8)); output Perl v5.32 + DBD::Oracle v1.80
output Perl v5.40 + DBD::Oracle v1.90
Perl v5.32 + DBD::Oracle v1.80 Perl v5.40 + DBD::Oracle v1.90 With the Devel::Peek::Dump enabled I see also a lot of wrong "magic" with Perl v5.40:
|
@spuelrich Hi, does |
@lzsiga yes
I split the output. It's the |
I'd say it has to be handled in three steps:
|
I've found some strange behavior in YaSQL which is a Sql*Plus alternative written in Perl that uses DBD-Oracle.
I've created a test-script to show the problem: https://github.com/lzsiga/yasql-fx/blob/main/test/test0001.sh
The problem has something to do with utf8, function
substr
, caching string-len and 'magical variables'.One way to solve it would be changing every call of
sv_setpvn
tosv_setpvn_mg
inoci8.c
. I admit I don't really know why both still exist, I'd saysv_setpvn_mg
is the reliable variant,sv_setpvn
is the quick but unreliable one.The text was updated successfully, but these errors were encountered: