From: Michael Farr Date: April 15 1999 12:50pm Subject: Re: balance List-Archive: http://lists.mysql.com/mysql/1903 Message-Id: <199904151252.WAA01971@lion.cs.latrobe.edu.au> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" > >Michael> double balance(UDF_INIT *initid, UDF_ARGS *args, char *is_null, >Michael> char *error) >Michael> { >Michael> float total = 0; >Michael> for(int i = 1; i<=indexId; i++) >Michael> total += account(i).debit; >Michael> } > >Michael> If anyone can tell me how to access the data structures in MySQL to get any >Michael> of those things out I should be able to finish this little problem. > >Michael> Mike > >Hi! > >Sorry, you can't access the data structures in a UDF function. > >You can however solve your problem this way: > >Allocate a variable in your init function (you should save this in >UDF_INIT -> ptr) > >For each call to the balance function, add the new value to the old >value and return the new value. > >Regards, >Monty > UDF_INIT->prt is a char* isn't it? How can I store a double in a char*? ( really hoping that isnt a stupid question )