perlvdbfunc.h

00001 /* 
00002  * $Id: perlvdbfunc.h 770 2007-01-22 10:16:34Z bastian $
00003  *
00004  * Perl virtual database module interface
00005  *
00006  * Copyright (C) 2007 Collax GmbH
00007  *                    (Bastian Friedrich <bastian.friedrich@collax.com>)
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 #ifndef _PERLVDBFUNC_H
00027 #define _PERLVDBFUNC_H
00028 
00029 #include "../../lib/srdb1/db_val.h"
00030 #include "../../lib/srdb1/db_key.h"
00031 #include "../../lib/srdb1/db_op.h"
00032 #include "../../lib/srdb1/db_con.h"
00033 #include "../../lib/srdb1/db_res.h"
00034 #include "../../str.h"
00035 
00036 
00037 /*
00038  * Initialize/close database module
00039  * No function should be called before/after this
00040  */
00041 db1_con_t* perlvdb_db_init(const char* _url);
00042 void perlvdb_db_close(db1_con_t* h);
00043 
00044 /*
00045  * Store name of table that will be used by
00046  * subsequent database functions
00047  */
00048 int perlvdb_use_table(db1_con_t* h, const str* t);
00049 
00050 int perlvdb_db_insert(db1_con_t* h, db_key_t* k, db_val_t* v, int n);
00051 int perlvdb_db_replace(db1_con_t* h, db_key_t* k, db_val_t* v, int n);
00052 int perlvdb_db_delete(db1_con_t* h, db_key_t* k, db_op_t* o, db_val_t* v, int n);
00053 int perlvdb_db_update(db1_con_t* h, db_key_t* k, db_op_t* o, db_val_t* v,
00054               db_key_t* uk, db_val_t* uv, int n, int un);
00055 
00056 int perlvdb_db_query(db1_con_t* h, db_key_t* k, db_op_t* op, db_val_t* v,
00057                         db_key_t* c, int n, int nc,
00058                         db_key_t o, db1_res_t** r);
00059 
00060 int perlvdb_db_free_result(db1_con_t* _h, db1_res_t* _r);
00061 
00062 #endif /* _PERLVDBFUNC_H */