From: Seader, Cameron <CSeader@idahopower.com>
To: pgsql-php@postgresql.org
Subject: PostgreSQL and Bitwise and with int8 field
Date: Sat, 20 Dec 2003 14:44:31 -0700
Message-ID: <71B8A8BEC516CF46835CA629156CF211103813@bedford.idacorp.local> (raw)
I am trying to get the proper output with this SQL statement:
SELECT *, (highalarm & 0xffffffff)as high1, (highalarm >> 32)as high2 FROM t444d500009b5_2_6 ORDER BY utctime DESC LIMIT 1
im splitting this 64 bit integer into two 32 bit integers so that PHP can handle it.
if the highalarm value is 20000000040, which was inputed as a hex value chopping off the 0x at the beginning to store in an int8 field.
When changed to binary it should read 100000000000000000000000000000000001000000 which is a 64 bit binary value. from the select statement above, what i am trying to acheive is splitting this 64 bit binary up so that i can read it in two 32 bit values so that PHP can handle it.
when in the 64 bit binary value i use this value to determine error points for a device, which has 42 data points starting from right to left right being the start of point 1 and left ending in point 42 unless it is 0 it will truncate. to the closest 1 if there is one. This example happens to be point 42. so when reading it in PHP i can tell that point 42 is in alarm or in some kind of bad status and also point 7 is as well since there is a 1 in the 7 spot of this binary going from right to left.
Can i please get some help with this SQL Statement - am i doing something wrong to get this to work?
Thanks,
Cameron Seader
Operations Center Technician II
CSeader@Idahopower.com
1.208.388.2582 Office
This transmission may contain information that is privileged, confidential and/or exempt from disclosure under applicable law. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein (including any reliance thereon) is STRICTLY PROHIBITED. If you received this transmission in error, please immediately contact the sender and destroy the material in its entirety, whether in electronic or hard copy format. Thank you. A1.
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-php@postgresql.org
Cc: CSeader@idahopower.com
Subject: Re: PostgreSQL and Bitwise and with int8 field
In-Reply-To: <71B8A8BEC516CF46835CA629156CF211103813@bedford.idacorp.local>
References: <71B8A8BEC516CF46835CA629156CF211103813@bedford.idacorp.local>
* 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