/usr/share/doc/libdbd-odbc-perl/examples/unicode_sql.pl is in libdbd-odbc-perl 1.50-1+b1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | #!/usr/bin/perl
# $Id$
#
# Small example showing how you can insert unicode inline in the SQL
#
# expected output:
#Has unicode: 1
#$VAR1 = [
# [
# "\x{20ac}"
# ]
# ];
#$VAR1 = [
# [
# "\x{20ac}"
# ],
# [
# "\x{20ac}"
# ]
# ];
#
use DBI;
use strict;
use warnings;
use Data::Dumper;
my $h = DBI->connect();
#$h->{odbc_default_bind_type} = 12;
warn "Warning DBD::ODBC not built for unicode - this will not work as expected" if !$h->{'odbc_has_unicode'};
eval {$h->do(q/drop table martin/);};
print "Has unicode: " . $h->{odbc_has_unicode} . "\n";
$h->do(q/create table martin (a nvarchar(100))/);
my $s = $h->prepare(q/insert into martin values(?)/);
$s->execute("\x{20ac}");
my $r = $h->selectall_arrayref(q/select * from martin/);
print Dumper($r);
my $sql = 'insert into martin values(' . $h->quote("\x{20ac}") . ')';
$h->do($sql);
$r = $h->selectall_arrayref(q/select * from martin/);
print Dumper($r);
#--with-iconv-char-enc=
#--with-iconv-ucode-enc=enc
|