|
|
sybperl-l Archive
Up Prev Next
From: "Patrick S dot Leung" <pleung at easygroup dot com>
Subject: problem with ct_send_data
Date: Jun 14 2000 2:32PM
Hi,
I modified one of my old update text scripts, and it didn't work
afterward. The table has one text column,
and I used two calls to Sybase to do the insert: 1st one to a stored
proc to insert all columns except
the text, and the second call to update the text column with
ct_send_data. Here is the Perl:
$query_string = "EXEC insert_text_table 1";
$X->ct_execute($query_string);
while(($rc = $X->ct_results($restype)) == CS_SUCCEED) {
next unless($X->ct_fetchable($restype));
while(@dat = $X->ct_fetch) {
push @arraydat, @dat;
$rowcount=$rowcount+1;
}
}
### get the row we just insert from the return value of the
stored proc insert_text_table #######
$X->ct_execute("SELECT id_article, txt_article FROM article
WHERE id_article = " . $arraydat[0]);
while($X->ct_results($restype)==CS_SUCCEED){
next unless($X->ct_fetchable($restype));
while(@dat=$X->ct_fetch){
$X->ct_data_info(CS_GET, 2);
}
}
$data="Sample data to be inserted as text";
$X->ct_command(CS_SEND_DATA_CMD,'',CS_UNUSED,CS_COLUMN_DATA);
$X->ct_data_info(CS_SET,2,{total_txtlen=>length($data)});
$X->ct_send_data($data,length($data));
$X->ct_send;
while($X->ct_results($restype)==CS_SUCCEED){
next unless $X->ct_fetchable($restype);
while(@dat=$X->ct_fetch){
}
}
And here is the error message:
Server message: (In srv_cb)
Message number: 156, Severity 15, State 1, Line 1
Server 'DEVELOP1'
Message String: Incorrect syntax near the keyword 'NULL'.
...
(more errors below)
I suspected that the second argument to the call
$X->ct_command(CS_SEND_DATA_CMD,'',CS_UNUSED,CS_COLUMN_DATA);
cause the problem. From the Sybperl manual, that argument is supposed
to be buffer, but I don't know
what that is, and from the manual example this is just '' or a null
string. What else should I put in
there? This ct_send_data is copied directly from the Syperl Manual.
Would anyone have any idea?
Thanks.
Patrick
|