Mickautsch, Alfred wrote:
-----Ursprüngliche Nachricht-----
Von: Martin Evans [mailto:[EMAIL PROTECTED]
Gesendet: Montag, 29. Januar 2007 09:43
An: [email protected]
Betreff: Re: CLOB Problem with DBD::ODBC/DBD::ADO for SQL Server
[...]
As no one else seems to have replied to you, if you can send a schema
and working Perl script using DBD::ODBC that demonstrates the problem
I'll take a look.
Martin
[...]
Thank you for your response Martin,
I have attached a ZIP file with the SQL script for creating the table with the
NCLOB(ntext) field and a perl script which inserts a text into this table. You
should edit the perl script to suit your environment.
Thank you for your help.
Servus -- Alfred
When I run this I do appear to getless chrs back than I put in but on
further investigation you are not putting the right number in.
The first issue is the back slashes in the here document.
my $text = <<_EOF;
hello\\\\
_EOF
print length($text), "\n";
prints 8 not 10 because \\ in a here document ends up as \. So half of
your '\\\\' go straight away to '\\'.
I have to admit to not being able to run your code on Windows at the
moment but from UNIX to SQL Server via various drivers we have the
following and they all work as expected:
isql -v install_dsn
SQL> insert into test_ntext values ('\\\\');
SQL> select * from test_ntext;
| \\\\ |
and in Perl:
use DBI;
$h = DBI->connect("dbi:ODBC:XXX","xxx", "yyy");
$s = $h->prepare(q/insert into test_ntext values(?)/);
$f = q/\\\\/;
$s->execute($f);
isql -v install_dsn
SQL> select * from test_ntext;
| \\ |
returns \\ because Perl itself turned q/\\\\/ to '\\' before passing it
to the driver.
Also with newlines, they appear to be kept:
use DBI;
$h = DBI->connect("dbi:ODBC:XXX","xxx", "yyy");
$s = $h->prepare(q/insert into test_ntext values(?)/);
$f = <<_EOF;
\\\\
\\\\
_EOF
$s->execute($f);
isql -v install_dsn
SQL> select * from test_ntext;
| \\
\\|
NOTE, those newlines above are UNIX new lines (in otherwords line feeds)
and I note the file you sent had dos line endings CR/LF
so I'm not sure you are losing the new lines but I am sure your losing
half of your back slashes down to Perl.
Martin
--
Martin J. Evans
Easysoft Limited
http://www.easysoft.com