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: Tunc Beyhan <tbeyhan at bline dot net dot tr>
Subject: Msg Handling Prob
Date: Feb 19 1998 7:22PM

Hi,
I am trying to write a transfer program which reads the data from
a csv file and inserts it to Sybase db . problem is when i have 
duplicate keyed records my script segfaults.Here is modified ct_sql
script to simulate the prob

#!/usr/bin/perl
#
#   @(#)ct_sql.pl   1.2 8/7/95

# Using the special one step query routine ct_sql().

use Sybase::CTlib;
use strict;

require 'ctutil.pl';

my $d;
my $i;
my $sqlstr;
my $ref;
my $line;


$d = new Sybase::CTlib "sa", "password", "sybase";

# ct_sql() returns a 'reference' to an array:

$sqlstr= "insert into muhbt2..hplani (
Yil,Kod,Ad,Detay,HSeviye,Kur,Kapali,Maste
r_Kod) values ( 1998,'100','KASA',0,1,NULL,NULL,NULL )";


for($i=0;$i<100;$i++) {
$ref = $d->ct_sql($sqlstr);

foreach $line (@$ref)  # 'de-reference' the pointer
{
    print "@$line\n";
}

}
                                                                       
If I remark " require 'ctutil.pl' " line everything works fine .AFAIK
the server message handler in ctutil.pl is similar to the default.

Thanks in advance

Tunc Beyhan