pg_cmd.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_CMD_H
00028 #define _PG_CMD_H
00029 
00030 
00041 #include "pg_oid.h"
00042 
00043 #include "../../lib/srdb2/db_drv.h"
00044 #include "../../lib/srdb2/db_cmd.h"
00045 #include "../../lib/srdb2/db_res.h"
00046 #include "../../str.h"
00047 
00048 #include <stdarg.h>
00049 #include <libpq-fe.h>
00050 
00051 struct pg_params {
00052         int n;
00053         const char** val;
00054         int* len;
00055         int* fmt;
00056 };
00057 
00058 
00063 struct pg_cmd {
00064         db_drv_t gen; 
00065         char* name;   
00066         str sql_cmd;  
00068         struct pg_params params;
00069         PGresult* types;
00070 };
00071 
00072 
00080 int pg_cmd(db_cmd_t* cmd);
00081 
00082 
00096 int pg_cmd_exec(db_res_t* res, db_cmd_t* cmd);
00097 
00098 
00110 int pg_cmd_first(db_res_t* res);
00111 
00112 
00124 int pg_cmd_next(db_res_t* res);
00125 
00126 
00137 int pg_getopt(db_cmd_t* cmd, char* optname, va_list ap);
00138 
00139 
00150 int pg_setopt(db_cmd_t* cmd, char* optname, va_list ap);
00151 
00152 #endif /* _PG_CMD_H */