Skip site navigation (1) Skip section navigation (2)

DBD::Pg returns 1/0 for boolean field ...

From: "Marc G(dot) Fournier" <scrappy(at)hub(dot)org>
To: pgsql-interfaces(at)postgresql(dot)org
Subject: DBD::Pg returns 1/0 for boolean field ...
Date: 2005-11-07 05:17:35
Message-ID: 20051107011444.B993@ganymede.hub.org (view raw or flat)
Thread:
Lists: pgsql-interfaces
'k, not sure if I'm overlooking something obvious here, but the query 
below, when run through psql, returns 't' or 'f', as I'd expect:

    SELECT vm.path, vm.company_id, vs.ip_address_id, vm.path AS root_path,
           vm.vm_template_id, vt.mount_union
      FROM vm_status vs
LEFT JOIN virtual_machine vm ON (vs.virtual_machine_id = vm.id)
LEFT JOIN vm_template vt ON (vm.vm_template_id = vt.id)
     WHERE vs.stop_date IS NULL
       AND vs.server_id IN (SELECT id
                              FROM server
                             WHERE server_name = ?
                               AND status_id = '1' );

But, when I run it DBI/DBD::Pg, I'm getting 1's and 0's ...

I'm reading the results as:

$get_hosts->execute($hostname);
$host_array = $get_hosts->fetchall_arrayref({});
foreach my $row (@$host_array) {

and printing the results as:

   print $row->{'mount_union'} . "\n";
   next;

Am I doing something wrong, that DBD::Pg is "converting" it to 1's and 
0's?  Or is this expected?


----
Marc G. Fournier           Hub.Org Networking Services (http://www.hub.org)
Email: scrappy(at)hub(dot)org           Yahoo!: yscrappy              ICQ: 7615664

Responses

pgsql-interfaces by date

Next:From: Greg Sabino MullaneDate: 2005-11-07 13:01:15
Subject: Re: DBD::Pg returns 1/0 for boolean field ...
Previous:From: Michael FuhrDate: 2005-11-03 18:21:21
Subject: Re: installing PygreSQL and psychopg2 ?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group