1 /* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB 2 3 This program is free software; you can redistribute it and/or modify 4 it under the terms of the GNU General Public License as published by 5 the Free Software Foundation; either version 2 of the License, or 6 (at your option) any later version. 7 8 This program is distributed in the hope that it will be useful, 9 but WITHOUT ANY WARRANTY; without even the implied warranty of 10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 GNU General Public License for more details. 12 13 You should have received a copy of the GNU General Public License 14 along with this program; if not, write to the Free Software 15 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ 16 17 #include "../config.h" 18 19 #ifndef PG_CLIENT_H 20 #define PG_CLIENT_H 21 22 #ifdef HAVE_PGSQL 23 24 #include <libpq-fe.h> 25 26 class Pg_client: public Client 27 { 28 protected: 29 PGconn* con; 30 PGresult* res; 31 public: Pg_client()32 Pg_client():Client(),con(0),res(0){} ~Pg_client()33 ~Pg_client() { clean_up(); } 34 void do_connect(); 35 int safe_query(const char* query, int abort_on_error = 1); 36 void lose_result(); 37 void disconnect(); 38 int check_error(int fatal = 1); 39 int compare_result(const char* cmp_file, int abort_on_error = 1) ; 40 int dump_result(const char* dump_file, int abort_on_error = 1); 41 int get_table_info(Table& t); 42 int load_table_data(string& table_name, const char* data_file_name); 43 }; 44 45 Client *pg_new(); 46 47 #endif /* HAVE_PGSQL */ 48 49 #endif /* PG_CLIENT_H */ 50