PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
Michael Peppler's resume

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 8:18AM



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
 
 
 
 

Open Client Message: (In msg_cb)
Message number: LAYER = (4) ORIGIN = (2) SEVERITY = (6) NUMBER = (50)
Message String: ct_send_data(): protocol specific layer: internal Client Library error: There is an internal tds layer error. An error was returned from the server while processing an internal tds stream.

Open Client Message: (In msg_cb)
Message number: LAYER = (1) ORIGIN = (1) SEVERITY = (1) NUMBER = (167)
Message String: ct_send(): user api layer: external error: This routine cannot be called because the command structure is in an undefined state.

Open Client Message: (In msg_cb)
Message number: LAYER = (1) ORIGIN = (1) SEVERITY = (1) NUMBER = (167)
Message String: ct_results(): user api layer: external error: This routine cannot be called because the command structure is in an undefined state.

Open Client Message: (In msg_cb)
Message number: LAYER = (1) ORIGIN = (1) SEVERITY = (1) NUMBER = (167)
Message String: ct_cmd_drop(): user api layer: external error: This routine cannot be called because the command structure is in an undefined state.