pg_fld.h

Go to the documentation of this file.
00001 /* 
00002  * Portions Copyright (C) 2001-2003 FhG FOKUS
00003  * Copyright (C) 2003 August.Net Services, LLC
00004  * Portions Copyright (C) 2005-2008 iptelorg GmbH
00005  *
00006  * This file is part of SER, a free SIP server.
00007  *
00008  * SER is free software; you can redistribute it and/or modify it under the
00009  * terms of the GNU General Public License as published by the Free Software
00010  * Foundation; either version 2 of the License, or (at your option) any later
00011  * version
00012  *
00013  * For a license to use the ser software under conditions other than those
00014  * described here, or to purchase support for this software, please contact
00015  * iptel.org by e-mail at the following addresses: info@iptel.org
00016  *
00017  * SER is distributed in the hope that it will be useful, but WITHOUT ANY
00018  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00019  * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
00020  * details.
00021  *
00022  * You should have received a copy of the GNU General Public License along
00023  * with this program; if not, write to the Free Software Foundation, Inc., 59
00024  * Temple Place, Suite 330, Boston, MA 02111-1307 USA
00025  */
00026 
00027 #ifndef _PG_FLD_H
00028 #define _PG_FLD_H
00029 
00030 
00040 #include "pg_oid.h"
00041 #include "pg_cmd.h"
00042 #include "../../ut.h"
00043 #include "../../lib/srdb2/db_gen.h"
00044 #include "../../lib/srdb2/db_fld.h"
00045 #include <libpq-fe.h>
00046 
00047 struct pg_fld {
00048         db_drv_t gen;
00049 
00055         union {
00056                 int          int4[2]; 
00057                 short        int2[4];
00058                 float        flt;     
00059                 double       dbl;     
00060                 time_t       time;    
00061                 unsigned int bitmap;  
00062                 long long    int8;    
00063                 char         byte[8];
00064         } v;
00065         char buf[INT2STR_MAX_LEN]; 
00066         Oid oid;                   
00067 };
00068 
00069 
00077 int pg_fld(db_fld_t* fld, char* table);
00078 
00079 int pg_resolve_param_oids(db_fld_t* vals, db_fld_t* match, 
00080                                                   int n1, int n2, PGresult* res);
00081 
00082 int pg_resolve_result_oids(db_fld_t* fld, int n, PGresult* res);
00083 
00084 
00100 int pg_fld2pg(struct pg_params* dst, int off, pg_type_t* types, 
00101                           db_fld_t* src, unsigned int flags);
00102 
00103 
00118 int pg_pg2fld(db_fld_t* dst, PGresult* src, int row, pg_type_t* types, 
00119                           unsigned int flags);
00120 
00121 
00131 int pg_check_fld2pg(db_fld_t* fld, pg_type_t* types);
00132 
00142 int pg_check_pg2fld(db_fld_t* fld, pg_type_t* types);
00143 
00144 
00145 #endif /* _PG_FLD_H */