SQL support byte operation like 'AND' || 'OR'
Posted in 2006
The poster asked whether Informix SQL supports bitwise AND/OR operators on numbers in SELECT/WHERE clauses. Jonathan Leffler replied that IDS has no built-in bitwise operators, but SPL routines and DataBlades exist (pointers to the IIUG Software Archive, oninit.com, and past c.d.i. posts about bit_and/bitwise). The poster then tried building a C bit_routines shared library on Linux (IDS 9.30) and hit error 9793 "module load failed"; suggestions were that the routines/DataBlade weren't properly registered, plus links to DataBlade documentation. No confirmed fix is recorded.
Auto-generated by DrWatson from the posts below — may be imperfect; read the full thread.
Topics: General Discussion
hello every body Do you know any thing about number operation using "AND" or "OR" in select SQL statement(select or where condition grammar)? I can't find anything about it in google,please help me. thanks a lot. best regards liao mike
On 9/1/06, LIAO MIKE <liaomike@cht.com.tw> wrote: > Do you know any thing about number operation using "AND" or "OR" in > select SQL statement(select or where condition grammar)? > > I can't find anything about it in google,please help me. I'm not clear what you're asking about. Since the subject is "SQL support byte operation like 'AND' || 'OR'", are you asking about bitwise operators analogous to the C '&' and '|' operators? These aren't built-in to IDS, AFAICR. I have seen feature requests to provide them. There are some tools to do it in SPL - try looking at the IIUG Software Archive. Googling 'bit_and informix' gives me some hints about where else to look (datablade, for example, at oninit.com) - but qualifying it with 'site:iiug.org' did not produce any hits. Searching in comp.databases.informix at groups.google.com with bit_and reveals a few sets of comments over the years. You could poke around with 'bitwise' instead. If this is all way off track, then please explain what you are really asking more clearly. -- Jonathan Leffler #include <disclaimer.h> Email: jleffler@earthlink.net, jleffler@us.ibm.com Guardian of DBD::Informix v2005.02 -- http://dbi.perl.org/
I think I've read (in c.d.i) that there is a databablade for this. And if I'm not bad I also think I read a post where someone do that using procedures from the sysmaster database... Look in c.d.i (usenet forum) J. Jonathan Leffler escribió: > On 9/1/06, LIAO MIKE <liaomike@cht.com.tw> wrote: > >>Do you know any thing about number operation using "AND" or "OR" in >>select SQL statement(select or where condition grammar)? >> >>I can't find anything about it in google,please help me. > > > I'm not clear what you're asking about. Since the subject is "SQL > support byte operation like 'AND' || 'OR'", are you asking about > bitwise operators analogous to the C '&' and '|' operators? > > These aren't built-in to IDS, AFAICR. I have seen feature requests to > provide them. There are some tools to do it in SPL - try looking at > the IIUG Software Archive. Googling 'bit_and informix' gives me some > hints about where else to look (datablade, for example, at oninit.com) > - but qualifying it with 'site:iiug.org' did not produce any hits. > Searching in comp.databases.informix at groups.google.com with bit_and > reveals a few sets of comments over the years. You could poke around > with 'bitwise' instead. > > If this is all way off track, then please explain what you are really > asking more clearly. >
Thanks everyone's help.
Your suggestion is right and useful.
In the way i try the fast bitmask manipulation in SPL on linux mechine with
Informix Dynamic Server Version 9.30.UC2 .
Follow the command to compile .c to .o
->cc -c -DMI_SERVBUILD -I ./ -o bit_routines.o bit_routines.c
PS:The parameter '-xO2 -xCC' is not acceptable in my linux environment.
Follow the command to compile .o to .so
->ld -G -o bit_routines.so bit_routines.o
It's done.
I select a table in dbaccess with the following sql(n_ruleid is a integer
column in a table named acc_rule_map):
select count(*) from acc_rule_map
where bit_on(n_ruleid, 1)I see below with "9793: User Defined Routine (bit_or) module load failed."
The lnfomix logs "
16:44:23 Loading Module </home/informix/incl/public/bit_routines.so>
16:44:23 The C Language Module </home/informix/incl/public/bit_routines.so>
can't load" in the log file
Do i miss something?
thans you.
Do you register the datablade?
It seems you don't.
J.
-----Original Message-----
From: "LIAO MIKE" <liaomike@cht.com.tw>
To: ids@iiug.org
Date: Mon, 4 Sep 2006 03:41:33 -0400 (EDT)
Subject: Re: SQL support byte operation like 'AND' 'OR' [7414]
Thanks everyone's help.
Your suggestion is right and useful.
In the way i try the fast bitmask manipulation in SPL on linux mechine with
Informix Dynamic Server Version 9.30.UC2 .
Follow the command to compile .c to .o
->cc -c -DMI_SERVBUILD -I ./ -o bit_routines.o bit_routines.c
PS:The parameter '-xO2 -xCC' is not acceptable in my linux environment.
Follow the command to compile .o to .so
->ld -G -o bit_routines.so bit_routines.o
It's done.
I select a table in dbaccess with the following sql(n_ruleid is a integer
column in a table named acc_rule_map):
select count(*) from acc_rule_map
where bit_on(n_ruleid, 1)I see below with "9793: User Defined Routine (bit_or) module load failed."
The lnfomix logs "
16:44:23 Loading Module </home/informix/incl/public/bit_routines.so>
16:44:23 The C Language Module </home/informix/incl/public/bit_routines.so>
can't load" in the log file
Do i miss something?
thans you.
*******************************************************************************
Forum Note: Use "Reply" to post a response in the discussion forum.
Jean Sagi
jeansagi@myrealbox.com
jeansagi@gmail.com
Would you please tell me about 'datablade' module? This is my first time to hear about it? What time do i neet to use it? thanks a lot
Oh well I've just read only a bit about datablades. But never practiced. This is agood document for understanding datablades: http://www-128.ibm.com/developerworks/db2/zones/informix/library/techarticle/021 0machtynger/0210machtynger.html Maybe you have hit a bug: http://www-1.ibm.com/support/docview.wss?uid=swg21192982 (This may not be the case, 'cause it is about the geodetic datablade) As usual google is your friend, J. -----Original Message----- From: "LIAO MIKE" <liaomike@cht.com.tw> To: ids@iiug.org Date: Mon, 4 Sep 2006 10:43:41 -0400 (EDT) Subject: Re: Re: SQL support byte operation like 'AND' 'OR' [7416] Would you please tell me about 'datablade' module? This is my first time to hear about it? What time do i neet to use it? thanks a lot ******************************************************************************* Forum Note: Use "Reply" to post a response in the discussion forum. Jean Sagi jeansagi@myrealbox.com jeansagi@gmail.com
I found this on CDI... http://www.iiug.org/resources/cdi_archive/2003.05/cdii.116834 This may be of help to you. J. -----Original Message----- From: "Jean Sagi" <jeansagi@myrealbox.com> To: ids@iiug.org Date: Mon, 4 Sep 2006 19:39:58 -0400 (EDT) Subject: Re: Re: Re: SQL support byte operation like 'A.... [7417] Oh well I've just read only a bit about datablades. But never practiced. This is agood document for understanding datablades: http://www-128.ibm.com/developerworks/db2/zones/informix/library/techarticle/021 0machtynger/0210machtynger.html Maybe you have hit a bug: http://www-1.ibm.com/support/docview.wss?uid=swg21192982 (This may not be the case, 'cause it is about the geodetic datablade) As usual google is your friend, J. -----Original Message----- From: "LIAO MIKE" <liaomike@cht.com.tw> To: ids@iiug.org Date: Mon, 4 Sep 2006 10:43:41 -0400 (EDT) Subject: Re: Re: SQL support byte operation like 'AND' 'OR' [7416] Would you please tell me about 'datablade' module? This is my first time to hear about it? What time do i neet to use it? thanks a lot ******************************************************************************* Forum Note: Use "Reply" to post a response in the discussion forum. Jean Sagi jeansagi@myrealbox.com jeansagi@gmail.com ******************************************************************************* Forum Note: Use "Reply" to post a response in the discussion forum. Jean Sagi jeansagi@myrealbox.com jeansagi@gmail.com