db_mysql/dbase.h

Go to the documentation of this file.
00001 /*
00002  * $Id: dbase.h 5425 2009-01-07 08:43:22Z henningw $
00003  *
00004  * MySQL module core functions
00005  *
00006  * Copyright (C) 2001-2003 FhG Fokus
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 /*! \file
00027  *  \brief DB_MYSQL :: Core
00028  *  \ingroup db_mysql
00029  *  Module: \ref db_mysql
00030  */
00031 
00032 
00033 
00034 #ifndef DBASE_H
00035 #define DBASE_H
00036 
00037 
00038 #include "../../db/db_con.h"
00039 #include "../../db/db_res.h"
00040 #include "../../db/db_key.h"
00041 #include "../../db/db_op.h"
00042 #include "../../db/db_val.h"
00043 #include "../../str.h"
00044 
00045 /*! \brief
00046  * Initialize database connection
00047  */
00048 db_con_t* db_mysql_init(const str* _sqlurl);
00049 
00050 
00051 /*! \brief
00052  * Close a database connection
00053  */
00054 void db_mysql_close(db_con_t* _h);
00055 
00056 
00057 /*! \brief
00058  * Free all memory allocated by get_result
00059  */
00060 int db_mysql_free_result(db_con_t* _h, db_res_t* _r);
00061 
00062 
00063 /*! \brief
00064  * Do a query
00065  */
00066 int db_mysql_query(const db_con_t* _h, const db_key_t* _k, const db_op_t* _op,
00067         const db_val_t* _v, const db_key_t* _c, const int _n, const int _nc,
00068         const db_key_t _o, db_res_t** _r);
00069 
00070 
00071 /*! \brief
00072  * fetch rows from a result
00073  */
00074 int db_mysql_fetch_result(const db_con_t* _h, db_res_t** _r, const int nrows);
00075 
00076 
00077 /*! \brief
00078  * Raw SQL query
00079  */
00080 int db_mysql_raw_query(const db_con_t* _h, const str* _s, db_res_t** _r);
00081 
00082 
00083 /*! \brief
00084  * Insert a row into table
00085  */
00086 int db_mysql_insert(const db_con_t* _h, const db_key_t* _k, const db_val_t* _v, const int _n);
00087 
00088 
00089 /*! \brief
00090  * Delete a row from table
00091  */
00092 int db_mysql_delete(const db_con_t* _h, const db_key_t* _k, const 
00093    db_op_t* _o, const db_val_t* _v, const int _n);
00094 
00095 
00096 /*! \brief
00097  * Update a row in table
00098  */
00099 int db_mysql_update(const db_con_t* _h, const db_key_t* _k, const db_op_t* _o,
00100    const db_val_t* _v, const db_key_t* _uk, const db_val_t* _uv, const int _n,
00101    const int _un);
00102 
00103 
00104 /*! \brief
00105  * Just like insert, but replace the row if it exists
00106  */
00107 int db_mysql_replace(const db_con_t* handle, const db_key_t* keys, const db_val_t* vals, const int n);
00108 
00109 /*! \brief
00110  * Returns the last inserted ID
00111  */
00112 int db_last_inserted_id(const db_con_t* _h);
00113 
00114 /*! \brief
00115  * Insert a row into table, update on duplicate key
00116  */
00117 int db_insert_update(const db_con_t* _h, const db_key_t* _k, const db_val_t* _v,
00118    const int _n);
00119 
00120 
00121 /*! \brief
00122  * Store name of table that will be used by
00123  * subsequent database functions
00124  */
00125 int db_mysql_use_table(db_con_t* _h, const str* _t);
00126 
00127 
00128 #endif /* DBASE_H */

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