You understand me very well...i need FOREACH to iterate row.
What i imagine:
@a,@b and @c -- variables;
select ITEM_AA,ITEM_AB into @a,@b from table_A where ...some
conditions. --load variables for every row
select ITEM_BA into @c from table_B where
FIELD_FROM_tableB=IF(OTHER_ITEM= @a,OTHER_ITEM =ANOTHER_ITEM,OTHER_ITEM=
RETURN @c; -- store the result (row by row) for
retrieving data with client function mysql_fetch_row().
I think is not too simple but i wish to try to do some like in this example
and i don't have any idea(for the moment) from where i must to start. And i
don't have too much time available to study, in the MySQL server source
code, to find from where i must to begin.
Thanks in advance,
P.S.Apologize if you find my english too poor but it's 01:50 AM and at 9:00
AM i must work again.
G.NET SOFTWARE COMPANY
Permanent e-mail address : gg@stripped
----- Original Message -----
From: "Peter Zaitsev" <peter@stripped>
To: "Gelu Gogancea" <ggelu@stripped>; <internals@stripped>
Sent: Tuesday, August 06, 2002 9:10 PM
Subject: Re: New native mySQL function.
On Tuesday 06 August 2002 19:25, Gelu Gogancea wrote:
> Hi ,
> MySQL for now, don't have store procedures.But have a lot of functions
> which can work, let's say,like unstored
> procedure(variables,IF(),CASE()...).And it's worked very well.But, to be
> completely this type of work i need a function which must do some "loop"
> retrieve data from every row .
At first I would inform you Stored procedures are on the way now.
So you will not have this problem in one of next MySQL versions.
> What i wish to do :
> I wish to try to implement a native MySQL function like "FOREACH" in
> procedure method work.
Have you taken a look at interface MySQL provides for adding
user level function and procedures ? This might be enough to solve
Really it depends on what type of FOREACH function you're
trying to implement.
In case it is FOREACH(const1,const2,const3,...cons5,expr) it would be not
that hard. You may take at BENCHMARK() function source to understand how
it might be implemented
In case you wish to create FOREACH() iterating over rows this might be much
harder as this might require large modifications in query executor.
> I know well the code of MySQL client,but i don't know the code of
> MySQL server.
> I beg you to give me a start point.What i must to do, to implement the
> function aforementioned ?What problems can occur if i try to implement a
> function like "FOREACH".
If you wish MySQL developers as well as other Internals list readers to
provide you with
good info it would be good to provide more comments. How would you like
this function to work
how it may be used and with which result ?
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Mr. Peter Zaitsev <peter@stripped>
/ /|_/ / // /\ \/ /_/ / /__ MySQL AB, Full-Time Developer
/_/ /_/\_, /___/\___\_\___/ Moscow, Russia
<___/ www.mysql.com M: +7 095 725 4955
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail internals-thread4292@stripped
To unsubscribe, e-mail <internals-unsubscribe@stripped>