perlvdb_conv.h

00001 /* 
00002  * $Id: perlvdb_conv.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 
00027 #ifndef _PERLVDB_CONV_H
00028 #define _PERLVDB_CONV_H 
00029 
00030 #include "../../lib/srdb1/db_op.h"
00031 #include "../../lib/srdb1/db_val.h"
00032 #include "../../lib/srdb1/db_key.h"
00033 
00034 #include "perlvdb.h"
00035 
00036 #include <XSUB.h>
00037 
00038 #define PERL_CLASS_VALUE        "OpenSER::VDB::Value"
00039 #define PERL_CLASS_PAIR         "OpenSER::VDB::Pair"
00040 #define PERL_CLASS_REQCOND      "OpenSER::VDB::ReqCond"
00041 
00042 #define PERL_CONSTRUCTOR_NAME   "new"
00043 
00044 /* Converts a set of pairs to perl SVs.
00045  * For insert, and update (second half)
00046  */
00047 AV *pairs2perlarray(db_key_t* keys, db_val_t* vals, int n);
00048 
00049 /* Converts a set of cond's to perl SVs.
00050  * For delete, update (first half), query
00051  */
00052 AV *conds2perlarray(db_key_t* keys, db_op_t* ops, db_val_t* vals, int n);
00053 
00054 /* Converts a set of key names to a perl array.
00055  * Needed in query.
00056  */
00057 AV *keys2perlarray(db_key_t* keys, int n);
00058 
00059 SV *val2perlval(db_val_t* val);
00060 SV *pair2perlpair(db_key_t key, db_val_t* val);
00061 SV *cond2perlcond(db_key_t key, db_op_t op, db_val_t* val);
00062 
00063 int perlresult2dbres(SV *perlres, db1_res_t **r);
00064 
00065 #endif /* _PERLVDB_CONV_H */