El Viernes, 2 de Octubre de 2009, Alex Balashov escribió: > Iñaki Baz Castillo wrote: > > El Viernes, 2 de Octubre de 2009, Alex Balashov escribió: > >> � wrote: > >>> El Viernes, 2 de Octubre de 2009, Juha Heinanen escribi�: > >>>> Revision: 5928 > >>>> > >>>> http://openser.svn.sourceforge.net/openser/?rev=5928&view=rev Author: > >>>> juhe > >>>> Date: 2009-10-02 04:51:57 +0000 (Fri, 02 Oct 2009) > >>>> > >>>> Log Message: > >>>> ----------- > >>>> * Check that db connection exists before trying to make query. > >>>> * Do not close db connection if db query fails. > >>> > >>> Isn't this stuf handled by db_xxxxx modules? > >> > >> That's what I thought, but evidently not, because results vary depending > >> on which module is doing the calling. > > > > I really fail to understand why a module using a DB backend should handle > > the DB connection... ¿? > > I haven't looked at the code, but I suspect that the calling module does > not "handle" the DB connection in any direct sense, but rather > indirectly through an interface exposed to it by the DB backend module. > > This problem probably cannot be entirely avoided; even if the mechanics > of database interaction are hidden in db_*, some manipulation of > abstractions - which correspond to underlying database handle and query > states, etc. - by modules that use db_* is probably required, just like > with any API. And just like any caller of an API, it is possible for > the calling module to misbehave on exceptional conditions returned by > the lower-level DB module. > > I would agree, however, that db_* should probably provide enough > containment and error handling to prevent all but the most egregious > database-related fatal runtime errors.
Yes, I just meant basic DB stuf as: - Connection/disconnection to DB. - Re-connect in case of failure. - Regenerate prepared statements (if they were used) automatically after re- coonecting to the database (mysql prepared statements are in server side). IMHO all this stuf should be handled by db_xxxxx module itself. I expect that when Kamailio starts, modules using database backends use the db_xxxx API to initiate the connection, generate prepared statements and basically that's all. During runtime a module function should just do SQL queries, no more. Am I wrong? Regards. -- Iñaki Baz Castillo <[email protected]> _______________________________________________ sr-dev mailing list [email protected] http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
