pg_oid.h

Go to the documentation of this file.
00001 /* 
00002  * $Id$ 
00003  *
00004  * PostgreSQL Database Driver for SER
00005  *
00006  * Portions Copyright (C) 2001-2003 FhG FOKUS
00007  * Copyright (C) 2003 August.Net Services, LLC
00008  * Portions Copyright (C) 2005-2008 iptelorg GmbH
00009  *
00010  * This file is part of SER, a free SIP server.
00011  *
00012  * SER is free software; you can redistribute it and/or modify it under the
00013  * terms of the GNU General Public License as published by the Free Software
00014  * Foundation; either version 2 of the License, or (at your option) any later
00015  * version
00016  *
00017  * For a license to use the ser software under conditions other than those
00018  * described here, or to purchase support for this software, please contact
00019  * iptel.org by e-mail at the following addresses: info@iptel.org
00020  *
00021  * SER is distributed in the hope that it will be useful, but WITHOUT ANY
00022  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00023  * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
00024  * details.
00025  *
00026  * You should have received a copy of the GNU General Public License along
00027  * with this program; if not, write to the Free Software Foundation, Inc., 59
00028  * Temple Place, Suite 330, Boston, MA 02111-1307 USA
00029  */
00030 
00031 #ifndef _PG_OID_H
00032 #define _PG_OID_H
00033 
00043 #include <libpq-fe.h>
00044 
00049 typedef struct pg_type {
00050         Oid oid;    
00051         char* name; 
00052 } pg_type_t;
00053 
00054 
00067 enum pg_type_id {
00068         PG_BOOL = 0,    
00069         PG_BYTE,        
00070         PG_CHAR,        
00071         PG_INT8,        
00072         PG_INT2,        
00073         PG_INT4,        
00074         PG_TEXT,        
00075         PG_FLOAT4,      
00076         PG_FLOAT8,      
00077         PG_INET,        
00078         PG_BPCHAR,      
00079         PG_VARCHAR,     
00080         PG_TIMESTAMP,   
00081         PG_TIMESTAMPTZ, 
00082         PG_BIT,         
00083         PG_VARBIT,      
00084         PG_ID_MAX       
00085 };
00086 
00087 
00096 pg_type_t* pg_new_oid_table(PGresult* res);
00097 
00098 
00102 void pg_destroy_oid_table(pg_type_t* table);
00103 
00104 
00113 int pg_name2oid(Oid* oid, pg_type_t* table, const char* name);
00114 
00115 
00124 int pg_oid2name(const char** name, pg_type_t* table, Oid oid);
00125 
00128 #endif /* _PG_OID_H */