pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Marc G. Fournier <scrappy@hub.org>
To: pgsql-interfaces@postgresql.org
Subject: DBD::Pg returns 1/0 for boolean field ...
Date: Mon, 7 Nov 2005 01:17:35 -0400 (AST)
Message-ID: <20051107011444.B993@ganymede.hub.org> (raw)


'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@hub.org           Yahoo!: yscrappy              ICQ: 7615664



view thread (2+ messages)  latest in thread

Message-ID: <20051107011444.B993@ganymede.hub.org>
Permalink:  ../20051107011444.B993@ganymede.hub.org/
Also on:    postgresql.org/message-id/20051107011444.B993@ganymede.hub.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: scrappy@hub.org
  Subject: Re: DBD::Pg returns 1/0 for boolean field ...
  In-Reply-To: <20051107011444.B993@ganymede.hub.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox