forked from FirebirdSQL/firebird-odbc-driver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
OdbcInstGetProp.cpp
205 lines (180 loc) · 9.9 KB
/
OdbcInstGetProp.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
#ifndef _WINDOWS
#ifdef unixODBC
#include <stdlib.h>
#include <memory.h>
#include <stdio.h>
#include <string.h>
#include <odbcinstext.h>
#include "SetupAttributes.h"
#ifndef TRUE
#define FALSE 0
#define TRUE 1
#endif
static const char *charsets []=
{
"NONE", "ASCII", "BIG_5", "CYRL", "DOS437", "DOS850", "DOS852", "DOS857", "DOS860",
"DOS861", "DOS863", "DOS865", "DOS866", "EUCJ_0208", "GB_2312", "ISO8859_1",
"ISO8859_2", "KSC_5601", "OCTETS", "SJIS_0208", "UNICODE_FSS", "UTF8",
"WIN1250", "WIN1251", "WIN1252", "WIN1253", "WIN1254", NULL
};
static const char *aYesNo[] =
{
"Yes",
"No",
NULL
};
static const char *d3_1[] =
{
"3",
"1",
NULL
};
static const char *useshemas []=
{
"0 - Set null field SCHEMA",
"1 - Remove SCHEMA from SQL query",
"2 - Use full SCHEMA",
NULL
};
static const char *szHelpPassword = "Your Password will be used to gain additional information from the DBMS and will not be saved anywhere.";
static const char *szHelpReadOnly = "Init transaction (default Write)";
static const char *szHelpNoWait = "Init transaction (default Wait)";
static const char *szHelpQuotedIdentifier = "Quoted identifier (default Yes)";
static const char *szHelpSensitiveIdentifier = "Sensitive identifier (default No)";
static const char *szHelpAutoQuotedIdentifier = "On auto quoted identifier (default No)";
static const char *szHelpUseSchemaIdentifier = "Init use SCHEMA (default SCHEMA set NULL)";
static const char *szHelpUseLockTimeoutWaitTransactions = "Init value Lock Timeout for WAIT Transactions (default LOCKTIMEOUT set 0)";
static const char *szHelpSafeThread = "Safe Thread (default Yes)";
int ODBCINSTGetProperties( HODBCINSTPROPERTY hLastProperty )
{
hLastProperty->pNext = (HODBCINSTPROPERTY)malloc( sizeof(ODBCINSTPROPERTY) );
hLastProperty = hLastProperty->pNext;
memset( hLastProperty, 0, sizeof(ODBCINSTPROPERTY) );
hLastProperty->nPromptType = ODBCINST_PROMPTTYPE_TEXTEDIT;
strncpy( hLastProperty->szName, SETUP_DBNAME, INI_MAX_PROPERTY_NAME );
strncpy( hLastProperty->szValue, "localhost:", INI_MAX_PROPERTY_VALUE );
hLastProperty->pNext = (HODBCINSTPROPERTY)malloc( sizeof(ODBCINSTPROPERTY) );
hLastProperty = hLastProperty->pNext;
memset( hLastProperty, 0, sizeof(ODBCINSTPROPERTY) );
hLastProperty->nPromptType = ODBCINST_PROMPTTYPE_TEXTEDIT;
strncpy( hLastProperty->szName, SETUP_CLIENT, INI_MAX_PROPERTY_NAME );
strncpy( hLastProperty->szValue, "", INI_MAX_PROPERTY_VALUE );
hLastProperty->pNext = (HODBCINSTPROPERTY)malloc( sizeof(ODBCINSTPROPERTY) );
hLastProperty = hLastProperty->pNext;
memset( hLastProperty, 0, sizeof(ODBCINSTPROPERTY) );
hLastProperty->nPromptType = ODBCINST_PROMPTTYPE_TEXTEDIT;
strncpy( hLastProperty->szName, SETUP_USER, INI_MAX_PROPERTY_NAME );
strncpy( hLastProperty->szValue, "", INI_MAX_PROPERTY_VALUE );
hLastProperty->pNext = (HODBCINSTPROPERTY)malloc( sizeof(ODBCINSTPROPERTY) );
hLastProperty = hLastProperty->pNext;
memset( hLastProperty, 0, sizeof(ODBCINSTPROPERTY) );
hLastProperty->nPromptType = ODBCINST_PROMPTTYPE_TEXTEDIT;
hLastProperty->pszHelp = (char *)strdup( szHelpPassword );
strncpy( hLastProperty->szName, SETUP_PASSWORD, INI_MAX_PROPERTY_NAME );
strncpy( hLastProperty->szValue, "", INI_MAX_PROPERTY_VALUE );
hLastProperty->pNext = (HODBCINSTPROPERTY)malloc( sizeof(ODBCINSTPROPERTY) );
hLastProperty = hLastProperty->pNext;
memset( hLastProperty, 0, sizeof(ODBCINSTPROPERTY) );
hLastProperty->nPromptType = ODBCINST_PROMPTTYPE_TEXTEDIT;
strncpy( hLastProperty->szName, SETUP_ROLE, INI_MAX_PROPERTY_NAME );
strncpy( hLastProperty->szValue, "", INI_MAX_PROPERTY_VALUE );
hLastProperty->pNext = (HODBCINSTPROPERTY)malloc( sizeof(ODBCINSTPROPERTY) );
hLastProperty = hLastProperty->pNext;
memset( hLastProperty, 0, sizeof(ODBCINSTPROPERTY) );
hLastProperty->nPromptType = ODBCINST_PROMPTTYPE_COMBOBOX;
hLastProperty->bRefresh = TRUE;
hLastProperty->aPromptData = (char**)malloc( sizeof(charsets) );
memcpy( hLastProperty->aPromptData, charsets, sizeof(charsets) );
strncpy( hLastProperty->szName, SETUP_CHARSET, INI_MAX_PROPERTY_NAME );
strcpy( hLastProperty->szValue, "NONE" );
hLastProperty->pNext = (HODBCINSTPROPERTY)malloc( sizeof(ODBCINSTPROPERTY) );
hLastProperty = hLastProperty->pNext;
memset( hLastProperty, 0, sizeof(ODBCINSTPROPERTY) );
hLastProperty->pszHelp = (char *)strdup( szHelpReadOnly );
hLastProperty->nPromptType = ODBCINST_PROMPTTYPE_COMBOBOX;
hLastProperty->bRefresh = TRUE;
hLastProperty->aPromptData = (char**)malloc( sizeof(aYesNo) );
memcpy( hLastProperty->aPromptData, aYesNo, sizeof(aYesNo) );
strncpy( hLastProperty->szName, SETUP_READONLY_TPB, INI_MAX_PROPERTY_NAME );
strcpy( hLastProperty->szValue, "No" );
hLastProperty->pNext = (HODBCINSTPROPERTY)malloc( sizeof(ODBCINSTPROPERTY) );
hLastProperty = hLastProperty->pNext;
memset( hLastProperty, 0, sizeof(ODBCINSTPROPERTY) );
hLastProperty->pszHelp = (char *)strdup( szHelpNoWait );
hLastProperty->nPromptType = ODBCINST_PROMPTTYPE_COMBOBOX;
hLastProperty->bRefresh = TRUE;
hLastProperty->aPromptData = (char**)malloc( sizeof(aYesNo) );
memcpy( hLastProperty->aPromptData, aYesNo, sizeof(aYesNo) );
strncpy( hLastProperty->szName, SETUP_NOWAIT_TPB, INI_MAX_PROPERTY_NAME );
strcpy( hLastProperty->szValue, "No" );
hLastProperty->pNext = (HODBCINSTPROPERTY)malloc( sizeof(ODBCINSTPROPERTY) );
hLastProperty = hLastProperty->pNext;
memset( hLastProperty, 0, sizeof(ODBCINSTPROPERTY) );
hLastProperty->pszHelp = (char *)strdup( szHelpNoWait );
hLastProperty->nPromptType = ODBCINST_PROMPTTYPE_COMBOBOX;
hLastProperty->bRefresh = TRUE;
hLastProperty->aPromptData = (char**)malloc( sizeof(d3_1) );
memcpy( hLastProperty->aPromptData, d3_1, sizeof(d3_1) );
strncpy( hLastProperty->szName, SETUP_DIALECT, INI_MAX_PROPERTY_NAME );
strcpy( hLastProperty->szValue, "3" );
hLastProperty->pNext = (HODBCINSTPROPERTY)malloc( sizeof(ODBCINSTPROPERTY) );
hLastProperty = hLastProperty->pNext;
memset( hLastProperty, 0, sizeof(ODBCINSTPROPERTY) );
hLastProperty->pszHelp = (char *)strdup( szHelpQuotedIdentifier );
hLastProperty->nPromptType = ODBCINST_PROMPTTYPE_COMBOBOX;
hLastProperty->bRefresh = TRUE;
hLastProperty->aPromptData = (char**)malloc( sizeof(aYesNo) );
memcpy( hLastProperty->aPromptData, aYesNo, sizeof(aYesNo) );
strncpy( hLastProperty->szName, SETUP_QUOTED, INI_MAX_PROPERTY_NAME );
strcpy( hLastProperty->szValue, "Yes" );
hLastProperty->pNext = (HODBCINSTPROPERTY)malloc( sizeof(ODBCINSTPROPERTY) );
hLastProperty = hLastProperty->pNext;
memset( hLastProperty, 0, sizeof(ODBCINSTPROPERTY) );
hLastProperty->pszHelp = (char *)strdup( szHelpSensitiveIdentifier );
hLastProperty->nPromptType = ODBCINST_PROMPTTYPE_COMBOBOX;
hLastProperty->bRefresh = TRUE;
hLastProperty->aPromptData = (char**)malloc( sizeof(aYesNo) );
memcpy( hLastProperty->aPromptData, aYesNo, sizeof(aYesNo) );
strncpy( hLastProperty->szName, SETUP_SENSITIVE, INI_MAX_PROPERTY_NAME );
strcpy( hLastProperty->szValue, "No" );
hLastProperty->pNext = (HODBCINSTPROPERTY)malloc( sizeof(ODBCINSTPROPERTY) );
hLastProperty = hLastProperty->pNext;
memset( hLastProperty, 0, sizeof(ODBCINSTPROPERTY) );
hLastProperty->pszHelp = (char *)strdup( szHelpAutoQuotedIdentifier );
hLastProperty->nPromptType = ODBCINST_PROMPTTYPE_COMBOBOX;
hLastProperty->bRefresh = TRUE;
hLastProperty->aPromptData = (char**)malloc( sizeof(aYesNo) );
memcpy( hLastProperty->aPromptData, aYesNo, sizeof(aYesNo) );
strncpy( hLastProperty->szName, SETUP_AUTOQUOTED, INI_MAX_PROPERTY_NAME );
strcpy( hLastProperty->szValue, "No" );
hLastProperty->pNext = (HODBCINSTPROPERTY)malloc( sizeof(ODBCINSTPROPERTY) );
hLastProperty = hLastProperty->pNext;
memset( hLastProperty, 0, sizeof(ODBCINSTPROPERTY) );
hLastProperty->pszHelp = (char *)strdup( szHelpUseSchemaIdentifier );
hLastProperty->nPromptType = ODBCINST_PROMPTTYPE_COMBOBOX;
hLastProperty->bRefresh = TRUE;
hLastProperty->aPromptData = (char**)malloc( sizeof(useshemas) );
memcpy( hLastProperty->aPromptData, useshemas, sizeof(useshemas) );
strncpy( hLastProperty->szName, SETUP_USESCHEMA, INI_MAX_PROPERTY_NAME );
strcpy( hLastProperty->szValue, useshemas[0] );
hLastProperty->pNext = (HODBCINSTPROPERTY)malloc( sizeof(ODBCINSTPROPERTY) );
hLastProperty = hLastProperty->pNext;
memset( hLastProperty, 0, sizeof(ODBCINSTPROPERTY) );
hLastProperty->nPromptType = ODBCINST_PROMPTTYPE_TEXTEDIT;
hLastProperty->pszHelp = (char *)strdup( szHelpUseLockTimeoutWaitTransactions );
strncpy( hLastProperty->szName, SETUP_LOCKTIMEOUT, INI_MAX_PROPERTY_NAME );
strncpy( hLastProperty->szValue, "0", INI_MAX_PROPERTY_VALUE );
hLastProperty->pNext = (HODBCINSTPROPERTY)malloc( sizeof(ODBCINSTPROPERTY) );
hLastProperty = hLastProperty->pNext;
memset( hLastProperty, 0, sizeof(ODBCINSTPROPERTY) );
hLastProperty->pszHelp = (char *)strdup( szHelpSafeThread );
hLastProperty->nPromptType = ODBCINST_PROMPTTYPE_COMBOBOX;
hLastProperty->bRefresh = TRUE;
hLastProperty->aPromptData = (char**)malloc( sizeof(aYesNo) );
memcpy( hLastProperty->aPromptData, aYesNo, sizeof(aYesNo) );
strncpy( hLastProperty->szName, SETUP_SAFETHREAD, INI_MAX_PROPERTY_NAME );
strcpy( hLastProperty->szValue, "Yes" );
return 1;
}
#endif
#endif