db_postgres.c

Go to the documentation of this file.
00001 /*
00002  * $Id: db_postgres.c 4963 2008-09-19 09:45:51Z henningw $ 
00003  *
00004  * Copyright (C) 2001-2003 FhG Fokus
00005  * Copyright (C) 2008 1&1 Internet AG
00006  *
00007  * This file is part of Kamailio, a free SIP server.
00008  *
00009  * Kamailio is free software; you can redistribute it and/or modify
00010  * it under the terms of the GNU General Public License as published by
00011  * the Free Software Foundation; either version 2 of the License, or
00012  * (at your option) any later version
00013  *
00014  * Kamailio is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  * GNU General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU General Public License 
00020  * along with this program; if not, write to the Free Software 
00021  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00022  */
00023 
00024 /*! \file
00025  *  \brief DB_POSTGRES :: Core
00026  *  \ingroup db_postgres
00027  *  Module: \ref db_postgres
00028  */
00029 
00030 /*! \defgroup db_postgres DB_POSTGRES :: the PostgreSQL driver for Kamailio
00031  *  \brief The Kamailio database interface to the PostgreSQL database
00032  *  - http://www.postgresql.org
00033  *
00034  */
00035 
00036 #include <stdio.h>
00037 #include "../../sr_module.h"
00038 #include "../../db/db_con.h"
00039 #include "../../db/db.h"
00040 #include "dbase.h"
00041 
00042 
00043 MODULE_VERSION
00044 
00045 int db_postgres_bind_api(db_func_t *dbb);
00046 
00047 static int mod_init(void);
00048 
00049 /*
00050  * PostgreSQL database module interface
00051  */
00052 
00053 static cmd_export_t cmds[]={
00054    {"db_bind_api",     (cmd_function)db_postgres_bind_api,     0, 0, 0, 0},
00055    {0,0,0,0,0,0}
00056 };
00057 
00058 
00059 
00060 struct module_exports exports = {
00061    "db_postgres",
00062    DEFAULT_DLFLAGS, /* dlopen flags */
00063    cmds,
00064    0,        /*  module parameters */
00065    0,        /* exported statistics */
00066    0,        /* exported MI functions */
00067    0,        /* exported pseudo-variables */
00068    0,        /* extra processes */
00069    mod_init, /* module initialization function */
00070    0,        /* response function*/
00071    0,        /* destroy function */
00072    0         /* per-child init function */
00073 };
00074 
00075 
00076 static int mod_init(void)
00077 {
00078    return 0;
00079 }
00080 
00081 int db_postgres_bind_api(db_func_t *dbb)
00082 {
00083    if(dbb==NULL)
00084       return -1;
00085 
00086    memset(dbb, 0, sizeof(db_func_t));
00087 
00088    dbb->use_table        = db_postgres_use_table;
00089    dbb->init             = db_postgres_init;
00090    dbb->close            = db_postgres_close;
00091    dbb->query            = db_postgres_query;
00092    dbb->fetch_result     = db_postgres_fetch_result;
00093    dbb->raw_query        = db_postgres_raw_query;
00094    dbb->free_result      = db_postgres_free_result;
00095    dbb->insert           = db_postgres_insert;
00096    dbb->delete           = db_postgres_delete; 
00097    dbb->update           = db_postgres_update;
00098 
00099    return 0;
00100 }

Generated on Tue May 22 14:00:25 2012 for Kamailio - The Open Source SIP Server by  doxygen 1.5.6