db_unixodbc.c

Go to the documentation of this file.
00001 /* 
00002  * $Id: db_unixodbc.c 5049 2008-10-08 17:40:59Z henningw $ 
00003  *
00004  * UNIXODBC module interface
00005  *
00006  * Copyright (C) 2005-2006 Marco Lorrai
00007  * Copyright (C) 2008 1&1 Internet AG
00008  *
00009  * This file is part of Kamailio, a free SIP server.
00010  *
00011  * Kamailio is free software; you can redistribute it and/or modify
00012  * it under the terms of the GNU General Public License as published by
00013  * the Free Software Foundation; either version 2 of the License, or
00014  * (at your option) any later version
00015  *
00016  * Kamailio is distributed in the hope that it will be useful,
00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  * GNU General Public License for more details.
00020  *
00021  * You should have received a copy of the GNU General Public License 
00022  * along with this program; if not, write to the Free Software 
00023  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00024  *
00025  *
00026  * History:
00027  * --------
00028  *  2005-12-01  initial commit (chgen)
00029  */
00030 
00031 #include "../../sr_module.h"
00032 #include "../../db/db.h"
00033 #include "dbase.h"
00034 #include "db_unixodbc.h"
00035 
00036 int ping_interval = 5 * 60; /* Default is 5 minutes */
00037 int auto_reconnect = 1;     /* Default is enabled */
00038 int use_escape_common = 0;  /* Enable common escaping */
00039 
00040 MODULE_VERSION
00041 
00042 int db_unixodbc_bind_api(db_func_t *dbb);
00043 
00044 /*
00045  * MySQL database module interface
00046  */
00047 static cmd_export_t cmds[] = {
00048    {"db_bind_api",    (cmd_function)db_unixodbc_bind_api,    0, 0, 0, 0},
00049    {0, 0, 0, 0, 0, 0}
00050 };
00051 
00052 
00053 /*
00054  * Exported parameters
00055  */
00056 static param_export_t params[] = {
00057    {"ping_interval",     INT_PARAM, &ping_interval},
00058    {"auto_reconnect",    INT_PARAM, &auto_reconnect},
00059    {"use_escape_common", INT_PARAM, &use_escape_common},
00060    {0, 0, 0}
00061 };
00062 
00063 
00064 struct module_exports exports = {   
00065    "db_unixodbc",
00066    DEFAULT_DLFLAGS, /* dlopen flags */
00067    cmds,
00068    params,     /*  module parameters */
00069    0,          /* exported statistics */
00070    0,          /* exported MI functions */
00071    0,          /* exported pseudo-variables */
00072    0,          /* extra processes */
00073    0,          /* module initialization function */
00074    0,          /* response function*/
00075    0,          /* destroy function */
00076    0           /* per-child init function */
00077 };
00078 
00079 int db_unixodbc_bind_api(db_func_t *dbb)
00080 {
00081    if(dbb==NULL)
00082       return -1;
00083 
00084    memset(dbb, 0, sizeof(db_func_t));
00085 
00086    dbb->use_table        = db_unixodbc_use_table;
00087    dbb->init             = db_unixodbc_init;
00088    dbb->close            = db_unixodbc_close;
00089    dbb->query            = db_unixodbc_query;
00090    dbb->fetch_result     = db_unixodbc_fetch_result;
00091    dbb->raw_query        = db_unixodbc_raw_query;
00092    dbb->free_result      = db_unixodbc_free_result;
00093    dbb->insert           = db_unixodbc_insert;
00094    dbb->delete           = db_unixodbc_delete; 
00095    dbb->update           = db_unixodbc_update;
00096    dbb->replace          = db_unixodbc_replace;
00097 
00098    return 0;
00099 }
00100 

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