1 /*
2  * $Id: perlvdb_conv.h 770 2007-01-22 10:16:34Z bastian $
3  *
4  * Perl virtual database module interface
5  *
6  * Copyright (C) 2007 Collax GmbH
7  *                    (Bastian Friedrich <bastian.friedrich@collax.com>)
8  *
9  * This file is part of Kamailio, a free SIP server.
10  *
11  * Kamailio is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version
15  *
16  * Kamailio is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
24  *
25  */
26 
27 #ifndef _PERLVDB_CONV_H
28 #define _PERLVDB_CONV_H
29 
30 #include "../../lib/srdb1/db_op.h"
31 #include "../../lib/srdb1/db_val.h"
32 #include "../../lib/srdb1/db_key.h"
33 
34 #include "db_perlvdb.h"
35 
36 #include <XSUB.h>
37 
38 #define PERL_CLASS_VALUE	"Kamailio::VDB::Value"
39 #define PERL_CLASS_PAIR		"Kamailio::VDB::Pair"
40 #define PERL_CLASS_REQCOND	"Kamailio::VDB::ReqCond"
41 
42 #define PERL_CONSTRUCTOR_NAME	"new"
43 
44 /* Converts a set of pairs to perl SVs.
45  * For insert, and update (second half)
46  */
47 AV *pairs2perlarray(const db_key_t* keys, const db_val_t* vals, const int n);
48 
49 /* Converts a set of cond's to perl SVs.
50  * For delete, update (first half), query
51  */
52 AV *conds2perlarray(const db_key_t* keys, const db_op_t* ops, const db_val_t* vals, const int n);
53 
54 /* Converts a set of key names to a perl array.
55  * Needed in query.
56  */
57 AV *keys2perlarray(const db_key_t* keys, const int n);
58 
59 SV *val2perlval(const db_val_t* val);
60 SV *pair2perlpair(const db_key_t key, const db_val_t* val);
61 SV *cond2perlcond(const db_key_t key, const db_op_t op, const db_val_t* val);
62 
63 int perlresult2dbres(SV *perlres, db1_res_t **r);
64 
65 #endif /* _PERLVDB_CONV_H */
66