db_postgres/dbase.h

Go to the documentation of this file.
00001 /*
00002  * $Id: dbase.h 4963 2008-09-19 09:45:51Z henningw $
00003  *
00004  * Copyright (C) 2003 August.Net Services, LLC
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  * History
00024  * -------
00025  * 2003-04-06 initial code written (Greg Fausak/Andy Fullford)
00026  */
00027 
00028 /*! \file
00029  *  \brief DB_POSTGRES :: Core
00030  *  \ingroup db_postgres
00031  *  Module: \ref db_postgres
00032  */
00033 
00034 #ifndef DBASE_H
00035 #define DBASE_H
00036 
00037 #include "../../db/db_con.h"
00038 #include "../../db/db_res.h"
00039 #include "../../db/db_key.h"
00040 #include "../../db/db_op.h"
00041 #include "../../db/db_val.h"
00042 
00043 
00044 /*
00045  * Initialize database connection
00046  */
00047 db_con_t* db_postgres_init(const str* _url);
00048 
00049 /*
00050  * Close a database connection
00051  */
00052 void db_postgres_close(db_con_t* _h);
00053 
00054 /*
00055  * Return result of previous query
00056  */
00057 int db_postgres_store_result(const db_con_t* _h, db_res_t** _r);
00058 
00059 
00060 /*
00061  * Free all memory allocated by get_result
00062  */
00063 int db_postgres_free_result(db_con_t* _h, db_res_t* _r);
00064 
00065 
00066 /*
00067  * Do a query
00068  */
00069 int db_postgres_query(const db_con_t* _h, const db_key_t* _k, const db_op_t* _op,
00070       const db_val_t* _v, const db_key_t* _c, const int _n, const int _nc,
00071       const db_key_t _o, db_res_t** _r);
00072 
00073 /*
00074  * Raw SQL query
00075  */
00076 int db_postgres_raw_query(const db_con_t* _h, const str* _s, db_res_t** _r);
00077 
00078 
00079 /*
00080  * Insert a row into table
00081  */
00082 int db_postgres_insert(const db_con_t* _h, const db_key_t* _k, const db_val_t* _v,
00083       const int _n);
00084 
00085 
00086 /*
00087  * Delete a row from table
00088  */
00089 int db_postgres_delete(const db_con_t* _h, const db_key_t* _k, const db_op_t* _o,
00090       const db_val_t* _v, const int _n);
00091 
00092 
00093 /*
00094  * Update a row in table
00095  */
00096 int db_postgres_update(const db_con_t* _h, const db_key_t* _k, const db_op_t* _o,
00097       const db_val_t* _v, const db_key_t* _uk, const db_val_t* _uv, const int _n,
00098       const int _un);
00099 
00100 /*
00101  * fetch rows from a result
00102  */
00103 int db_postgres_fetch_result(const db_con_t* _h, db_res_t** _r, const int nrows);
00104 
00105 
00106 /*
00107  * Store name of table that will be used by
00108  * subsequent database functions
00109  */
00110 int db_postgres_use_table(db_con_t* _h, const str* _t);
00111 
00112 
00113 #endif /* DBASE_H */

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