sguazt sguazt wrote:
Hi!
From: Philippe Poelvoorde <[EMAIL PROTECTED]>
Reply-To: "'mysql@lists.mysql.com '" <mysql@lists.mysql.com>
To: mysql@lists.mysql.com
Subject: Re: Queries inside UDF
Date: Thu, 17 Mar 2005 08:22:46 +0000
..
You can actually access a DB within a UDF, but you should do the same
than when you're using the C api of mysql. So you need a way to get
database name, user/passwd and port without user-input, and do
mysql_init, mysql_connect, mysql_query, and so on, like when you are
accessing that database using a 'external' C program. Also bear in
mind that it should be thread-safe ;)
a way to extend udf, is ... stored procedure ?
Yes I did it ... look my first post (http://lists.mysql.com/mysql/181361)
There you can find and example of a C-code I used to write my UDF ...
but when using the UDF inside MySQL I've got "Can't connect to MySQL
server on 'localhost' (111)"
you should check the permission.
Instead compiling the C-code as stand-alone program (removing the
xxx_init/xxx_deinit functions and adding a main) all is OK, the query is
executed and the program normally exits.
did you execute it on your DB server ? (not on your WS)
I can't use stored procedure because the target DB is the 4.0.21
Currently I'm working on MySQL 4.1.10a on my devel station ... but the
production station is 4.0.21
(all installed as RPM x86).
So please look at the C-code and tell me if it's wrong ... as
alternative you can post me a working example of UDF containing MySQL
query execution.
Thanks!
-- Marco
--
Philippe Poelvoorde
COS Trading Ltd.
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]
_________________________________________________________________
Personalizza MSN Messenger con sfondi e fotografie!
http://www.ilovemessenger.msn.it/
--
Philippe Poelvoorde
COS Trading Ltd.
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]