X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 01C88D1B440 for ; Sat, 20 Dec 2003 21:45:49 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 21084-06 for ; Sat, 20 Dec 2003 17:45:01 -0400 (AST) Received: from ariel1.idahopower.com (unknown [204.76.195.71]) by svr1.postgresql.org (Postfix) with SMTP id 7D077D1B44D for ; Sat, 20 Dec 2003 17:44:58 -0400 (AST) Received: from 204.76.195.33 by ariel1.idahopower.com with ESMTP (IPCo Mail Relay at your service (MMS v4.7);); Sat, 20 Dec 2003 14:42:29 -0700 X-Server-Uuid: c4da1ae6-7048-11d2-bc8e-00a083360239 Received: from bedford.idacorp.local ([172.18.201.66]) by midway.idacorp.local with Microsoft SMTPSVC(5.0.2195.6713); Sat, 20 Dec 2003 14:44:31 -0700 X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 content-class: urn:content-classes:message MIME-Version: 1.0 Subject: PostgreSQL and Bitwise and with int8 field Date: Sat, 20 Dec 2003 14:44:31 -0700 Message-ID: <71B8A8BEC516CF46835CA629156CF211103813@bedford.idacorp.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: PostgreSQL and Bitwise and with int8 field Thread-Index: AcPHQnOb1l55k9l2TL+eyQmPFJyIzA== From: "Seader, Cameron" To: pgsql-php@postgresql.org X-OriginalArrivalTime: 20 Dec 2003 21:44:31.0851 (UTC) FILETIME=[73A5A3B0:01C3C742] X-WSS-ID: 13FA1DCF203508-01-01 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200312/54 X-Sequence-Number: 2500 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 h= andle it.=20 if the highalarm value is 20000000040, which was inputed as a hex value cho= pping off the 0x at the beginning to store in an int8 field. When changed to binary it should read 1000000000000000000000000000000000010= 00000 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 re= ad 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 be= ing 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 poi= nt 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 w= rong 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 inte= nded recipient, you are hereby notified that any disclosure, copying, distr= ibution, or use of the information contained herein (including any reliance= thereon) is STRICTLY PROHIBITED. If you received this transmission in erro= r, please immediately contact the sender and destroy the material in its en= tirety, whether in electronic or hard copy format. Thank you. A1.