db_cap.h

Go to the documentation of this file.
00001 /*
00002  * $Id: db_cap.h 4518 2008-07-28 15:39:28Z henningw $
00003  *
00004  * Copyright (C) 2001-2004 FhG Fokus
00005  * Copyright (C) 2007-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 /*!
00025  * \file db_cap.h
00026  * \ingroup db
00027  * \brief Data structures that represents capabilities in the database.
00028  *
00029  * This file defines data structures that represents certain database
00030  * capabilities. It also provides some macros for convenient access to this
00031  * values.
00032  */
00033 
00034 #ifndef DB_CAP_H
00035 #define DB_CAP_H
00036 
00037 
00038 /*! \brief
00039  * Represents the capabilities that a database driver supports.
00040  */
00041 typedef enum db_cap {
00042    DB_CAP_QUERY =     1 << 0,  /*!< driver can perform queries                                     */
00043    DB_CAP_RAW_QUERY = 1 << 1,  /*!< driver can perform raw queries                                 */
00044    DB_CAP_INSERT =    1 << 2,  /*!< driver can insert data                                         */
00045    DB_CAP_DELETE =    1 << 3,  /*!< driver can delete data                                         */
00046    DB_CAP_UPDATE =    1 << 4,  /*!< driver can update data                                         */
00047    DB_CAP_REPLACE =   1 << 5,  /*!< driver can replace (also known as INSERT OR UPDATE) data       */
00048    DB_CAP_FETCH   =   1 << 6,  /*!< driver supports fetch result queries                           */
00049    DB_CAP_LAST_INSERTED_ID = 1 << 7,  /*!< driver can return the ID of the last insert operation   */
00050    DB_CAP_INSERT_UPDATE = 1 << 8 /*!< driver can insert data into database and update on duplicate */
00051 
00052 } db_cap_t;
00053 
00054 
00055 /*! \brief
00056  * All database capabilities except raw_query, replace, insert_update and 
00057  * last_inserted_id which should be checked separately when needed
00058  */
00059 #define DB_CAP_ALL (DB_CAP_QUERY | DB_CAP_INSERT | DB_CAP_DELETE | DB_CAP_UPDATE)
00060 
00061 
00062 /*! \brief
00063  * Returns true if all the capabilities in cpv are supported by module
00064  * represented by dbf, false otherwise
00065  */
00066 #define DB_CAPABILITY(dbf, cpv) (((dbf).cap & (cpv)) == (cpv))
00067 
00068 
00069 #endif /* DB_CAP_H */

Generated on Mon May 21 18:00:26 2012 for Kamailio - The Open Source SIP Server by  doxygen 1.5.6