Apologies for the mailbox clutter, but I've answered my own question...

$PDL::undefval = -999;

is the easy solution!!!

Can $PDL::undefval be set to BAD somehow??

Trevor.

----- Original Message -----
From: Trevor Carey-Smith <[EMAIL PROTECTED]>
Date: Wednesday, May 23, 2007 4:15 pm
Subject: PDL and databases
To: perldl list <[email protected]>

> Hi,
> 
> I'm trying to extract data from an oracle database directly into 
> piddles. The method below suggested by Doug works, except when 
> there are NULL values in the database. These all end up as 
> zeroes in the piddle. Does anyone know of a workaround to 
> this... perhaps setting the value to bad?
> 
> Regards,
> 
> Trevor.
> 
> 
> ----- Original Message -----
> 
> 
> From: Doug Hunt <[EMAIL PROTECTED]>
> 
> 
> Date: Tuesday, July 4, 2006 10:17 am
> 
> 
> Subject: Re: Fw: PDL Getting Started book Re: [Perldl] IDL thing
> 
> 
> To: [EMAIL PROTECTED]
> 
> 
> Cc: perldl list <[email protected]>
> 
> 
> 
> 
> 
> > Hi Celia:
> 
> 
> > 
> 
> 
> > In many cases its easy to get SQL database info into a 2D PDL.
> 
> 
> > 
> 
> 
> > We use postgres, so I often say something like:
> 
> 
> > 
> 
> 
> > my $db     = "dbi:Pg:dbname=$dbname;host=$dbhost";
> 
> 
> > my $dbh    = DBI->connect($db);
> 
> 
> > die "Cannot connect to database = $dbname, dbhost = $dbhost"
> 
> 
> > unless (defined($dbh));
> 
> 
> > 
> 
> 
> > my $sql = "select id, value1, value2 from table1 where ...";
> 
> 
> > 
> 
> 
> > my $p = pdl ( $dbh->selectall_arrayref($sql) );
> 
> 
> > 
> 
> 
> > This works provided all the selected values are numeric.
> 
> 
> > 
> 
> 
> > Regards,
> 
> 
> > 
> 
> 
> >    Doug
> 
> 
> > 
> 
> 
> > [EMAIL PROTECTED]
> 
> 
> > Software Engineer III
> 
> 
> > UCAR - COSMIC, Tel. (303) 497-2611
> 
> 
> > 
> 
> 
> > On Wed, 28 Jun 2006, [EMAIL PROTECTED] wrote:
> 
> 
> > 
> 
> 
> > >
> 
> 
> > > I sort of got into PDL because it sounded a very interesting 
> 
> 
> > way to do data
> 
> 
> > > manipulation.  But I found it very hard to get going. I 
> 
> 
> > also found it was
> 
> 
> > > hard to find stuff unless you exactly knew what you where 
> 
> 
> > doing and what it
> 
> 
> > > was named.  It was also very hard to find example 
> 
> 
> > scripts.   I love example
> 
> 
> > > scripts it is how I learn stuff.
> 
> 
> > >
> 
> 
> > > My problem was that most of my files where in comma 
> delimited 
> 
> 
> > format or
> 
> 
> > > from relational databases ( which I used a dbi modules to 
> 
> 
> > get).  I really
> 
> 
> > > wanted example of how to get data from the following sources 
> 
> 
> > into PDL.  But
> 
> 
> > > I found it hard to find resources and also ran out of 
> 
> 
> > time.  So I didn't
> 
> 
> > > end up doing it.
> 
> 
> > >
> 
> 
> > > Celia
> 
> 
> > >
> 
> 
> > >
> 
> 
> > >
> 
> 
> > >
> 
> 
> > >
> 
> 
> > >
> 
> 
> > >             Donald Jackson
> 
> 
> > >             <[EMAIL PROTECTED]
> 
> 
> > >             
> ms.com>                                                    To
> 
> 
> > >
> 
> 
> > >             28/06/2006 
> 12:43                                           cc
> 
> 
> > >             AM
> 
> 
> > 
> >                                                                   Subject
> 
> 
> > >                                       Re: PDL Getting 
> Started book Re:
> 
> 
> > >                                       [Perldl] IDL thing
> 
> 
> > >
> 
> 
> > >
> 
> 
> > >
> 
> 
> > >
> 
> 
> > >
> 
> 
> > >
> 
> 
> > >
> 
> 
> > >
> 
> 
> > >
> 
> 
> > >
> 
> 
> > > As a newbie user, I can attest to the need- the POD is 
> pretty 
> 
> 
> > good, but
> 
> 
> > > it's like a dictionary: you need to know what to look for in 
> 
> 
> > order to
> 
> 
> > > find it!
> 
> 
> > >
> 
> 
> > > I'd happily volunteer as a guinea pig for testing drafts on.
> 
> 
> > >
> 
> 
> > > Don Jackson
> 
> 
> > >
> 
> 
> > > Xavier Calbet wrote:
> 
> 
> > >
> 
> 
> > >>  If you all agree, we could start writing
> 
> 
> > >> a simple introductory PDL book...
> 
> 
> > >>
> 
> 
> > >>
> 
> 
> > >
> 
> 
> > > _______________________________________________
> 
> 
> > > Perldl mailing list
> 
> 
> > > [email protected]
> 
> 
> > > http://mailman.jach.hawaii.edu/mailman/listinfo/perldl
> 
> 
> > >
> 
> 
> > >
> 
> 
> > >
> 
> 
> > >
> 
> 
> > >
> 
> 
> > >
> 
> 
> > > _______________________________________________
> 
> 
> > > Perldl mailing list
> 
> 
> > > [email protected]
> 
> 
> > > http://mailman.jach.hawaii.edu/mailman/listinfo/perldl
> 
> 
> > >
> 
> 
> > 
> 
> 
> > _______________________________________________
> 
> 
> > Perldl mailing list
> 
> 
> > [email protected]
> 
> 
> > http://mailman.jach.hawaii.edu/mailman/listinfo/perldl
> 
> 
> > 
> 

_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl

Reply via email to