Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

DBD::Sybase charset error change

37 views
Skip to first unread message

Douglas Wilson

unread,
Aug 8, 2011, 8:58:37 PM8/8/11
to dbi-...@perl.org
I'm using perl 5.8.8 with DBD::Sybase 1.09, and the SQL statement
below appears to prepare and execute fine, but I've also just compiled
a perl 5.14.1 with DBD::Sybase 1.12, and with the newer versions I get
the following error on prepare:

DBD::Sybase::db prepare failed: Server message number=2401 severity=11
state=2 line=0 server=TESTASE text=Character set conversion is not
available between client character set 'utf8' and server character set
'iso_1'.
Server message number=2411 severity=10 state=1 line=0 server=TESTASE
text=No conversions will be done.

If I add ';charset=iso_1' to the dsn string on connect, then
everything seems to work ok. I'm just wondering what changed the
behavior (perl? DBD::Sybase?), and if I've handled it correctly or
done something else wrong...

Thanks...

my $upd_sql = <<SQL;
UPDATE my_table
SET
group_nbr = ?, last_ch_user = user, last_ch_date = getdate()
WHERE primary_id = ?
AND source_id = 100
SQL

Michael Peppler

unread,
Aug 9, 2011, 9:40:31 AM8/9/11
to Douglas Wilson, dbi-...@perl.org
There was a change in 1.11 (I think) to handle utf8/unicode data. THis
included forcing the charset to utf8 in the client.

You can go back to the old behavior if you edit dbdimp.c and change or
comment out the following:

if (retcode == CS_SUCCEED) {
if ((retcode = cs_locale(context, CS_SET, locale, CS_SYB_CHARSET,
"utf8", CS_NULLTERM, NULL)) != CS_SUCCEED) {
warn("cs_locale(CS_SYB_CHARSET) failed");
}
}

in the syb_init() call.

I'll need to review that decision to see how to make it work for both
unicode and non-unicode data.

Michael

Douglas Wilson

unread,
Aug 9, 2011, 2:58:07 PM8/9/11
to Michael Peppler, dbi-...@perl.org
Just for an extra bit of FYI, the error only occurs when there's another statement prepared right before the update, so DBD::Sybase has to create another dbh because of the multiple active statement handles.

-- Sent from my Palm Pre


On Aug 9, 2011 6:40 AM, Michael Peppler &lt;mpep...@peppler.org&gt; wrote:

There was a change in 1.11 (I think) to handle utf8/unicode data. THis

included forcing the charset to utf8 in the client.

You can go back to the old behavior if you edit dbdimp.c and change or

comment out the following:

if (retcode == CS_SUCCEED) {

if ((retcode = cs_locale(context, CS_SET, locale, CS_SYB_CHARSET,

"utf8", CS_NULLTERM, NULL)) != CS_SUCCEED) {

warn("cs_locale(CS_SYB_CHARSET) failed");

}

}

in the syb_init() call.

I'll need to review that decision to see how to make it work for both

unicode and non-unicode data.

Michael

On Tue, Aug 9, 2011 at 2:58 AM, Douglas Wilson

&lt;douglas...@gmail.com&gt; wrote:

&gt; I'm using perl 5.8.8 with DBD::Sybase 1.09, and the SQL statement

&gt; below appears to prepare and execute fine, but I've also just compiled

&gt; a perl 5.14.1 with DBD::Sybase 1.12, and with the newer versions I get

&gt; the following error on prepare:

&gt;

&gt; DBD::Sybase::db prepare failed: Server message number=2401 severity=11

&gt; state=2 line=0 server=TESTASE text=Character set conversion is not

&gt; available between client character set 'utf8' and server character set

&gt; 'iso_1'.

&gt; &nbsp;Server message number=2411 severity=10 state=1 line=0 server=TESTASE

&gt; text=No conversions will be done.

&gt;

&gt; If I add ';charset=iso_1' to the dsn string on connect, then

&gt; everything seems to work ok. I'm just wondering what changed the

&gt; behavior (perl? DBD::Sybase?), and if I've handled it correctly or

&gt; done something else wrong...

&gt;

&gt; Thanks...

&gt;

&gt; my $upd_sql = &lt;&lt;SQL;

&gt; UPDATE my_table

&gt; SET

&gt; &nbsp;group_nbr = ?, last_ch_user = user, last_ch_date = getdate()

&gt; WHERE primary_id = ?

&gt; AND source_id = 100

&gt; SQL

&gt;


0 new messages