dlg_specific.h 4.61 KB
Newer Older
1

2
/* File:			dlg_specific.h
3
 *
4
 * Description:		See "dlg_specific.c"
5
 *
6
 * Comments:		See "notice.txt" for copyright and license information.
7 8 9 10 11 12
 *
 */

#ifndef __DLG_SPECIFIC_H__
#define __DLG_SPECIFIC_H__

Byron Nikolaidis's avatar
Byron Nikolaidis committed
13
#ifdef HAVE_CONFIG_H
14
#include "config.h"
Byron Nikolaidis's avatar
Byron Nikolaidis committed
15 16
#endif

17 18
#include "psqlodbc.h"
#include "connection.h"
Byron Nikolaidis's avatar
Byron Nikolaidis committed
19

20
#ifdef WIN32
21 22 23 24
#include  <windows.h>
#include  <windowsx.h>
#include  <odbcinst.h>
#include "resource.h"
Byron Nikolaidis's avatar
Byron Nikolaidis committed
25
#endif
26 27 28 29 30 31 32

/*	Unknown data type sizes */
#define UNKNOWNS_AS_MAX				0
#define UNKNOWNS_AS_DONTKNOW		1
#define UNKNOWNS_AS_LONGEST			2

/* INI File Stuff */
33
#ifndef WIN32
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
#define ODBC_INI		".odbc.ini"
#ifdef ODBCINSTDIR
#define ODBCINST_INI	ODBCINSTDIR "/odbcinst.ini"
#else
#define ODBCINST_INI	"/etc/odbcinst.ini"
#warning "location of odbcinst.ini file defaulted to /etc"
#endif
#else							/* WIN32 */
#define ODBC_INI		"ODBC.INI"		/* ODBC initialization file */
#define ODBCINST_INI	"ODBCINST.INI"	/* ODBC Installation file */
#endif	 /* WIN32 */


#define INI_DSN			  DBMS_NAME		/* Name of default Datasource in
										 * ini file (not used?) */
#define INI_KDESC		  "Description" /* Data source description */
#define INI_SERVER		  "Servername"	/* Name of Server running the
										 * Postgres service */
#define INI_PORT		  "Port"/* Port on which the Postmaster is
								 * listening */
#define INI_DATABASE	  "Database"	/* Database Name */
#define INI_USER		  "Username"	/* Default User Name */
#define INI_PASSWORD	  "Password"	/* Default Password */
#define INI_DEBUG		  "Debug"		/* Debug flag */
#define INI_FETCH		  "Fetch"		/* Fetch Max Count */
#define INI_SOCKET		  "Socket"		/* Socket buffer size */
#define INI_READONLY	  "ReadOnly"	/* Database is read only */
#define INI_COMMLOG		  "CommLog"		/* Communication to backend
										 * logging */
#define INI_PROTOCOL	  "Protocol"	/* What protocol (6.2) */
#define INI_OPTIMIZER	  "Optimizer"	/* Use backend genetic optimizer */
#define INI_KSQO		  "Ksqo"/* Keyset query optimization */
#define INI_CONNSETTINGS  "ConnSettings"		/* Anything to send to
												 * backend on successful
												 * connection */
#define INI_UNIQUEINDEX   "UniqueIndex" /* Recognize unique indexes */
#define INI_UNKNOWNSIZES  "UnknownSizes"		/* How to handle unknown
												 * result set sizes */
72

73 74
#define INI_CANCELASFREESTMT  "CancelAsFreeStmt"

75 76
#define INI_USEDECLAREFETCH "UseDeclareFetch"	/* Use Declare/Fetch
												 * cursors */
77 78 79 80 81 82 83 84 85 86

/*	More ini stuff */
#define INI_TEXTASLONGVARCHAR		"TextAsLongVarchar"
#define INI_UNKNOWNSASLONGVARCHAR	"UnknownsAsLongVarchar"
#define INI_BOOLSASCHAR				"BoolsAsChar"
#define INI_MAXVARCHARSIZE			"MaxVarcharSize"
#define INI_MAXLONGVARCHARSIZE		"MaxLongVarcharSize"

#define INI_FAKEOIDINDEX			"FakeOidIndex"
#define INI_SHOWOIDCOLUMN			"ShowOidColumn"
Byron Nikolaidis's avatar
Byron Nikolaidis committed
87
#define INI_ROWVERSIONING			"RowVersioning"
88
#define INI_SHOWSYSTEMTABLES		"ShowSystemTables"
89
#define INI_LIE						"Lie"
Byron Nikolaidis's avatar
Byron Nikolaidis committed
90
#define INI_PARSE					"Parse"
91 92
#define INI_EXTRASYSTABLEPREFIXES	"ExtraSysTablePrefixes"

93 94 95
#define INI_TRANSLATIONNAME		  "TranslationName"
#define INI_TRANSLATIONDLL		  "TranslationDLL"
#define INI_TRANSLATIONOPTION	  "TranslationOption"
Byron Nikolaidis's avatar
Byron Nikolaidis committed
96 97


98 99 100
/*	Connection Defaults */
#define DEFAULT_PORT					"5432"
#define DEFAULT_READONLY				1
101 102
#define DEFAULT_PROTOCOL				"6.4"	/* the latest protocol is
												 * the default */
103
#define DEFAULT_USEDECLAREFETCH			0
104 105 106
#define DEFAULT_TEXTASLONGVARCHAR		1
#define DEFAULT_UNKNOWNSASLONGVARCHAR	0
#define DEFAULT_BOOLSASCHAR				1
107 108 109 110
#define DEFAULT_OPTIMIZER				1		/* disable */
#define DEFAULT_KSQO					1		/* on */
#define DEFAULT_UNIQUEINDEX				0		/* dont recognize */
#define DEFAULT_COMMLOG					0		/* dont log */
111
#define DEFAULT_DEBUG					0
112 113 114 115 116
#define DEFAULT_UNKNOWNSIZES			UNKNOWNS_AS_MAX


#define DEFAULT_FAKEOIDINDEX			0
#define DEFAULT_SHOWOIDCOLUMN			0
Byron Nikolaidis's avatar
Byron Nikolaidis committed
117
#define DEFAULT_ROWVERSIONING			0
118
#define DEFAULT_SHOWSYSTEMTABLES		0		/* dont show system tables */
119
#define DEFAULT_LIE						0
Byron Nikolaidis's avatar
Byron Nikolaidis committed
120
#define DEFAULT_PARSE					0
121

122 123
#define DEFAULT_CANCELASFREESTMT		0

124 125
#define DEFAULT_EXTRASYSTABLEPREFIXES	"dd_;"

126 127
/*	prototypes */
void		getGlobalDefaults(char *section, char *filename, char override);
128

129
#ifdef WIN32
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149
void		SetDlgStuff(HWND hdlg, ConnInfo * ci);
void		GetDlgStuff(HWND hdlg, ConnInfo * ci);

int CALLBACK driver_optionsProc(HWND hdlg,
				   WORD wMsg,
				   WPARAM wParam,
				   LPARAM lParam);
int CALLBACK ds_optionsProc(HWND hdlg,
			   WORD wMsg,
			   WPARAM wParam,
			   LPARAM lParam);

#endif	 /* WIN32 */

void		updateGlobals(void);
void		writeDSNinfo(ConnInfo * ci);
void		getDSNdefaults(ConnInfo * ci);
void		getDSNinfo(ConnInfo * ci, char overwrite);
void		makeConnectString(char *connect_string, ConnInfo * ci);
void		copyAttributes(ConnInfo * ci, char *attribute, char *value);
150 151 152


#endif