I didn't have raiseerror on, so I turned it on and just got the same message,
aborted (core dumped).  Here is a much larger chunk of the code.  It reads a |
delimited file. Some of the fields are further delimited with ^.  One of the
data lines looks like:
PID|1||243||SIXEL^CARL^M^^^||19261024|M|||


#!/usr/bin/perl -w
#
use DBI;
use strict;
use Getopt::Std;
use DBI qw(:sql_types);

#Declare all the variables
my $patient_id;
my $person_id;
my $sth;
my $last_name;
my $first_name;
my $middle_initial;
my $patient_title;

open(INP,"$input_file");

my $dbh = DBI->connect( $data_source, $username, '', {RaiseError => 1} );

while (<INP>)
{
   chop($_);
   my $string=$_;
   my @split_string=split /\|/, $string;

   my $patient_name = $split_string[5];
   my @patient_split_name = split /\^/, $patient_name;
   $last_name = $patient_split_name[0];
   $first_name = $patient_split_name[1];
   $middle_initial = $patient_split_name[2];
   $patient_title = $patient_split_name[3];

   $sth = $dbh->prepare('call add_person (?, ?,?,?,?)');
   $sth->bind_param(1,$first_name);
   $sth->bind_param(2,$last_name);
   $sth->bind_param(3,$middle_initial);
   $sth->bind_param(4,$patient_title, {TYPE => SQL_VARCHAR});
   $sth->bind_param_inout(5,\$person_id,500);
   $sth->execute();
   $sth->finish;

}
$dbh->disconnect;
exit(0);
__END__

"Michael A. Chase" wrote:

> To get much further, we will need to see enough of your code to make some
> sense of it.
>
> Do you have $dbh->{RaiseError} set?  If not, you may have a failure
> somewhere else with no indication of what occurred.
> --
> Mac :})
> ** I normally forward private database questions to the DBI mail lists. **
> Give a hobbit a fish and he'll eat fish for a day.
> Give a hobbit a ring and he'll eat fish for an age.
> ----- Original Message -----
> From: "Sherry Graham" <[EMAIL PROTECTED]>
> To: "Curt Russell Crandall" <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Sent: Tuesday, May 08, 2001 12:29
> Subject: Re: Use of Null
>
> > I commented out the binds.  So I just have:
> >
> >             $patient_title = $dbh->quote($patient_title);
> >             print "HERE $patient_title\n";
> >             $sth->execute($first_name, $last_name, $middle_initial,
> $patient_title,
> > $person_id);
> >
> > By the way, the print types HERE NULL.
> >
> > Sherry Graham
> > [EMAIL PROTECTED]
> >
> >
> >
> > Curt Russell Crandall wrote:
> >
> > > If $patient_title is undef, it should turn it into SQL NULL.... however,
> > > if you then move it through a bind* method, it'll turn it into the
> string
> > > NULL.  Are you still using the bind* methods eventhough you are placing
> > > the args into the execute call?
> > >
> > > On Tue, 8 May 2001, Sherry Graham wrote:
> > >
> > > > The problem with using the execute to call the variables, is that the
> last one
> > > >
> > > > is bind_param_inout.  I don't know of a way to tell the execute call
> that it
> > > > needs to put a value in that parameter.
> > > >
> > > > But, just for testing sake, I put all the variables in the execute.  I
> did
> > > >
> > > > $patient_title = $dbh->quote($patient_title);
> > > >
> > > > before the execute.  The program did not core dump this time, and it
> inserted
> > > > the row, but to my great surprise, it inserted the word NULL instead
> of the
> > > > value NULL.
> > > >
> > > > I am using Perl 5.6.0 on linux and DBI 1.15.
> > > >
> > > > Sherry Graham
> > > > [EMAIL PROTECTED]
> > > >
> > > > Curt Russell Crandall wrote:
> > > >
> > > > > I'm bad.  I didn't see that you were using bind_param.  You don't
> want to
> > > > > quote and then use bind_param.  Either quote and then put your
> argument
> > > > > list into the call to execute or maybe try defining the variable
> type in
> > > > > bind_param... seemed like that helped me in one instance to keep
> undefs
> > > > > from causing SEGV signals.
> > > > >
> > > > > What version of Perl and DBI are you using... like I said earlier,
> an
> > > > > upgrade to the latest and greatest cured the problem.
> > > > >
> > > > > --Curt
> > > > >
> > > > > On Tue, 8 May 2001, Sherry Graham wrote:
> > > > >
> > > > > > I am using DBD::ASAny.  I am calling a stored procedure to insert
> rows
> > > > > > into a table. Some of the parameters that I want to pass might
> have null
> > > > > > in them, but I am having trouble using a variable and place holder
> that
> > > > > > has the value undef.  It keeps core dumping.  Here is the code
> that I'm
> > > > > > working with. What am I missing?
> > > > > >
> > > > > > $first_name = 'sherry';
> > > > > > $last_name = 'graham';
> > > > > > $middle_initial = 'a';
> > > > > > $patient_title = undef;
> > > > > > $sth = $dbh->prepare('call add_person (?, ?,?,?,?)');
> > > > > > $sth->bind_param(1,$first_name);
> > > > > > $sth->bind_param(2,$last_name);
> > > > > > $sth->bind_param(3,$middle_initial);
> > > > > > $sth->bind_param(4,$patient_title);
> > > > > > $sth->bind_param_inout(5,\$person_id,500);
> > > > > > $sth->execute();
> > > > > >
> > > > > > Thanks!
> > > > > > Sherry Graham
> > > > > > [EMAIL PROTECTED]
> > > > > > Applied Systems Intelligence, Inc.
> > > > > >
> > > > > >
> > > >
> > > >
> >
> >

Reply via email to