DBD::Sybase: ct_send_data example fails

David Blackstone <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <[email protected]>
 I am trying to post data to an NTEXT field in MSSQL Server with
DBD::Sybase, using the example from the documentation.  Here is my
code:

my $sql = <<"EOF";
SELECT thenote
FROM Notes
WHERE notes_id = ?
EOF

my $sth = $dbh->prepare($sql);
$sth->execute($notes_id);
while ($sth->fetch)
{
 $sth->syb_ct_data_info('CS_GET', 1);
}

$sth->syb_ct_prepare_send;
$sth->syb_ct_data_info('CS_SET', 1,
 {total_txtlen => length $text,
  log_on_update => 1});
$sth->syb_ct_send_data($text, length $text);
$sth->syb_ct_finish_send;


This is more or less copied straight out of the docs.  Unfortunately,
when I hit the ct_send_data line, I get this error:
DBD::Sybase::st syb_ct_send_data failed: Server message number=102
severity=15 state=1 line=1 server=SQL_SERVER_TEST text=Incorrect
syntax near '0x00000000000000000000000000000000'.
Server message number=319 severity=15 state=1 line=1
server=SQL_SERVER_TEST text=Incorrect syntax near the keyword 'with'.
If this statement is a common table expression or an xmlnamespaces
clause, the previous statement must be terminated with a semicolon.


I turned on FreeTDS logging, and I see this in the logs:
write.c:134:tds_put_string converting 90 bytes of "writetext bulk
0x00000000000000000000000000000000 timestamp = 0x0000000000000000 with
log"


It would seem that I am coming up against the same error described here:
http://lists.ibiblio.org/pipermail/freetds/2005q1/018014.html
http://lists.ibiblio.org/pipermail/freetds/2005q1/018015.html
http://lists.ibiblio.org/pipermail/freetds/2005q1/018017.html

 Apparently in that discussion it was discovered that DBD::Sybase was
not setting all the values it needed to set in its call to
ct_send_data.  Has this been fixed?  Is there any workaround?  Has
anyone ever gotten the example in the documentation to work?
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.