skubey has asked for the wisdom of the Perl Monks concerning the following question:
Hello.
Background information:
1. SQL Server 2005
2. Tables which contain unicode characters.
3. Perl app to take XML based data and do inserts.
Problem:
Original Perl code (#3) used DBD::ODBC. Now that we've included unicode characters in some of our tables, data is mangled on the round trip. Switched to using Win32::OLE and tricks like Win32::OLE->Option(CP => Win32::OLE::CP_UTF8, LCID => 65001);
The good:
Round trip appears to be working (can put/get same data back in unicode, it isn't mangled, data is consistent).
The bad:
We have constraints on our tables and would like to know when they are violated during INSERT. Before using DBD::ODBC the dbh->errstr would provide SQL Server 2005's error string/description which pointed to constraint violations.
Now that we are using Win32::OLE (and I suspect DBD::ADO may do the same, trying this now), the error that is returned is OLE specific vs. context-relevant for a constraint violation in the DB.
Is there a way around this or something I am missing with Win32::OLE? I miss the more descriptive, context-relevant errors I was getting with DBI via dbh->errstr (and need them for the app we are working on). Currently using Win32::OLE LastError, or the Error obj contained as part of a Win32::OLE connection object from an ADODB Connection.
Any suggestions appreciated greatly,
-s