Aaron Stone wrote:
To immeaditely simplify this, I used the magic of the preprocessor. See attachment.If the code is changed to authdb->this() and msgdb->that(), then using two different databases is *not* any more complicated *at all*. Just check the config file, and either open up two libraries or open one and copy the struct.I'm not enthused by the wrapper functions, can't we just import the symbol db_whatever directly? Granted that means that you'd have to call the libtool dl functions one at a time, it's uglier, imho, to have these wrappers.
Dan Weber
Aaron Paul J Stevens <[EMAIL PROTECTED]> said:Allowing people to use different sql backends for auth and storage was my idea iirc. It was more a logical conclusion following from clean separation of both code bases - implied by the auth-ldap code, rather than a serious feature request.Dan Weber wrote:On Sat, May 29, 2004 at 08:33:10AM -0000, Aaron Stone wrote:This is probably the cleanest way to do it. Renaming all of the function calls to reference struct members shouldn't be too hard. I believe that you could instead load in the symbols for each function one at a time, but then it's not clear that you're working with an external symbol within the code. Since some people also suggested being able to use a different sql database for auth a storage, the struct would make it much easier to separate them.Having people use a different sql database for auth, adds a lot of complexity. I personally don't think it is a good idea. So for making compatibility functions, something like this. int db_check_connection(void) foo->db_check_connect(void);Good call, that way we can create compatibility versioning scheme.Don't forget to define a versioning scheme. The library should export a dbmail_api_version symbol with some kind of major.minor.micro scheme or rev.compat scheme so that before you import the structure with all of the functions you know that it will be the size and signature you're expecting.Dan Weber ------------------------------------------------------------------------ _______________________________________________ Dbmail-dev mailing list Dbmail-dev@dbmail.org http://twister.fastxs.net/mailman/listinfo/dbmail-dev-- ________________________________________________________________ Paul Stevens mailto:[EMAIL PROTECTED] NET FACILITIES GROUP PGP: finger [EMAIL PROTECTED] The Netherlands________________________________http://www.nfg.nl _______________________________________________ Dbmail-dev mailing list Dbmail-dev@dbmail.org http://twister.fastxs.net/mailman/listinfo/dbmail-dev
#if !defined(DBCOMPAT_H) && !defined(NO_DBCOMPAT_MACROS) #define DBCOMPAT_H #include "dbmailtypes.h" #include "dbapi.h" #include "dbmail.h" extern struct db_api *dbcalls; #define TO_CHAR (dbcalls->TO_CHAR) #define TO_DATE (dbcalls->TO_DATE) #define db_check_connection() (dbcalls->db_check_connection()) #define db_connect() (dbcalls->db_connect()) #define db_num_rows() (dbcalls->db_num_rows()) #define db_num_fields() (dbcalls->db_num_fields()) #define db_free_result() (dbcalls->db_free_result()) #define db_get_result(r,f) (dbcalls->db_get_result(r,f)) #define db_disconnect() (dbcalls->db_disconnect()) #define db_insert_result(x) (dbcalls->db_insert_result(x)) #define db_query(q) (dbcalls->db_query(q)) #define db_escape_string(to,from,len) (dbcalls->db_escape_string(to,from,len)) #define db_do_cleanup(tables,num) (dbcalls->db_do_cleanup(tables,num)) #define db_get_length(r,f) (dbcalls->db_get_length(r,f)) #define db_get_affected_rows() (dbcalls->db_get_affected_rows()) #define db_use_msgbuf_result() (dbcalls->db_use_msgbuf_result()) #define db_store_msgbuf_result() (dbcalls->db_store_msgbuf_result()) #define db_get_result_set() (dbcalls->db_get_result_set()) #define db_set_result_set(set) (dbcalls->db_set_result_set(set)) #endif
signature.asc
Description: OpenPGP digital signature