/***************************************************************** * bytea-common.h this header file contains common macros and * prototypes functions for test-bytea programm. * * Copyright (C) 2010 Andrey Y. Rjavskov(aka rjaan) * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * *****************************************************************/ #ifndef __TEST_COMMON_H #define __TEST_COMMON_H 1 #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef __cplusplus extern "C" { #endif typedef enum _PngFileMark PngFileMark; extern char *get_progname_from ( char *path ); enum _PngFileMark { FILE_IS_PNG = 0, FILE_IS_NOT_PNG, ERROR_OPEN_PNGFILE, ERROR_READ_PNGFILE, }; #define FILE_IS_NOT_PNG_MSG "is not png file" #define ERROR_OPEN_PNGFILE_MSG "failed to open file" #define ERROR_READ_PNGFILE_MSG "failed to read file" #define UNKNOWN_ERROR_MSG "is unknown error!" extern PngFileMark is_file_png ( const char *file_name ); #define ARRAY_LIMIT_FOR_BYTEA_TYPE 1073741824 extern unsigned char* get_escape_bytea_array ( const char *file_name, size_t *nbytes ); extern PGconn* upg_connect_db ( const char *dbhost, const char *dbport, const char *dbname, const char *dbuser, const char *dbupwd ); extern void upg_disconnect_db ( PGconn* db ); extern int upg_sqlexec ( PGconn* db, const char* format, ... ); extern int bytea_entry_add ( PGconn* db, const char *ptrbytea, const char* ptrdsc, ... ); #define BUFFER_MAXSIZE 1024 #define SQLTYPE_LIMIT_SMALINT 32767 #define SQLTYPE_LIMIT_UNSIGNED_SMALINT 65535 #define SQLTYPE_LIMIT_INTEGER 2147483647 #define SQLTYPE_LIMIT_UNSIGNED_INTEGER 4294967295U extern void test_begin( char *tst_path ); extern void test_go ( int count, int bp_interval ); extern void test_done( void ); #ifdef __cplusplus } #endif #endif/*__TEST_COMMON_H*/