[Dovecot] using mysql from within a plugin
Hello,
I'm trying to access a mysql database in a plugin.
-What special compiler flags do I need? I discovered that when I don't explicitly link lib-sql/libsql.a in, then I get an undefind symbol error about sql_init when loading the plugin.
Shouldn't the imap process itself have sql support linked in, rather than each plugin?
-It appears that I need to call sql_drivers_init() and sql_drivers_register_all() before sql_init.
Again, shouldn't the imap process do this, instead of each plugin? It should probably only be called once, so if one plugin already does it, then the second one will create problems.
-When linking libsql.a in, and calling the functions mentioned above, then I get this error when starting dovecot:
undefined symbol: mysql_ssl_set
I'm guessing it's part of the mysql library itself, not dovecot.
Can someone give me some hints on how to use dovecot's mysql library in a plugin?
Thanks,
Alexander
On Sun, 2008-04-20 at 00:36 +0200, Alexander Prinsier wrote:
Hello,
I'm trying to access a mysql database in a plugin.
-What special compiler flags do I need? I discovered that when I don't explicitly link lib-sql/libsql.a in, then I get an undefind symbol error about sql_init when loading the plugin.
Right. Also you need the mysql libraries linked with it.
Shouldn't the imap process itself have sql support linked in, rather than each plugin?
It could, but since IMAP normally doesn't need SQL it would just be extra bloat and slower startup time for >99% of users. That's one of the main reasons why dict-proxy exists, so that SQL support can be linked only to dict process and used by IMAP plugins via the proxy.
I think it would be possible to create a SQL plugin though, which contains lib-sql.a and the sql libraries linked to it as well. Although that would require changes to lib-sql also so that it would build a .la library out of it.
participants (2)
-
Alexander Prinsier
-
Timo Sirainen