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: "vissu Musunuru" <vissu_musunuru at hotmail dot com>
Subject: Re: problem with ct_send_data
Date: Jun 15 2000 5:23PM

ct_command and ct_send calls are for remote procedure calls
and cursor management.ct_command prepares the sql statement,
ct_send sends the sql which is stored in the buffer to server for
execution.
try ct_execute for inserting the data too.


>From: "Patrick S. Leung" 
>Reply-To: SYBPERL-L@list.cren.net
>To: SybPerl Discussion List 
>Subject: problem with ct_send_data
>Date: Wed, 14 Jun 2000 22:32:11 +0800
>
>
>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
>

________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com