File: drvcfg.c

package info (click to toggle)
unixodbc 2.3.6-0.1
  • links: PTS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 11,476 kB
  • sloc: ansic: 92,148; sh: 11,928; makefile: 1,630; yacc: 969; sql: 1
file content (85 lines) | stat: -rw-r--r-- 3,676 bytes parent folder | download
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
/**************************************************
 *
 *
 **************************************************
 * This code was created by Peter Harvey @ CodeByDesign.
 * Released under LGPL 10.APR.01
 *
 * Contributions from...
 * -----------------------------------------------
 * Peter Harvey		- pharvey@codebydesign.com
 **************************************************/
#include <config.h>
#include <odbcinstext.h>

/**********************************************
 * HELP
 **********************************************/

/**********************************************
 * STATIC LOOKUP VALUES
 **********************************************/
static const char *aColumnSeparators[] =
{
	"|",
    ",",
	NULL
};

static const char *aYesNo[] =
{
	"Yes",
	"No",
	NULL
};


int ODBCINSTGetProperties( HODBCINSTPROPERTY hLastProperty )
{
	hLastProperty->pNext 				= (HODBCINSTPROPERTY)calloc( 1, sizeof(ODBCINSTPROPERTY) );
	hLastProperty 						= hLastProperty->pNext;
	hLastProperty->nPromptType			= ODBCINST_PROMPTTYPE_TEXTEDIT;
	strncpy( hLastProperty->szName, "Directory", INI_MAX_PROPERTY_NAME );
	strncpy( hLastProperty->szValue, "", INI_MAX_PROPERTY_VALUE );
	hLastProperty->pszHelp				= strdup( "Directory where table files can/will be found.\nLeave blank for default (~/.odbctxt)." );

	hLastProperty->pNext 				= (HODBCINSTPROPERTY)calloc( 1, sizeof(ODBCINSTPROPERTY) );
	hLastProperty 						= hLastProperty->pNext;
	hLastProperty->nPromptType			= ODBCINST_PROMPTTYPE_LISTBOX;
	hLastProperty->aPromptData          = malloc( sizeof( aYesNo ) );
	memcpy( hLastProperty->aPromptData, aYesNo, sizeof( aYesNo ) ); 
	strncpy( hLastProperty->szName, "ReadOnly", INI_MAX_PROPERTY_NAME );
	strncpy( hLastProperty->szValue, "No", INI_MAX_PROPERTY_VALUE );
	hLastProperty->pszHelp				= strdup( "Set this to Yes if you do not want anyone changing the data." );

	hLastProperty->pNext 				= (HODBCINSTPROPERTY)calloc( 1, sizeof(ODBCINSTPROPERTY) );
	hLastProperty 						= hLastProperty->pNext;
	hLastProperty->nPromptType			= ODBCINST_PROMPTTYPE_LISTBOX;
	hLastProperty->aPromptData          = malloc( sizeof( aYesNo ) );
	memcpy( hLastProperty->aPromptData, aYesNo, sizeof( aYesNo ) ); 
	strncpy( hLastProperty->szName, "CaseSensitive", INI_MAX_PROPERTY_NAME );
	strncpy( hLastProperty->szValue, "Yes", INI_MAX_PROPERTY_VALUE );
	hLastProperty->pszHelp				= strdup( "Yes if data is compared as case-sensitive." );

	hLastProperty->pNext 				= (HODBCINSTPROPERTY)calloc( 1, sizeof(ODBCINSTPROPERTY) );
	hLastProperty 						= hLastProperty->pNext;
	hLastProperty->nPromptType			= ODBCINST_PROMPTTYPE_LISTBOX;
	hLastProperty->aPromptData          = malloc( sizeof( aYesNo ) );
	memcpy( hLastProperty->aPromptData, aYesNo, sizeof( aYesNo ) ); 
	strncpy( hLastProperty->szName, "Catalog", INI_MAX_PROPERTY_NAME );
	strncpy( hLastProperty->szValue, "No", INI_MAX_PROPERTY_VALUE );
	hLastProperty->pszHelp				= strdup( "Yes if you want to use a special file to describe all tables/columns.\n\nNo if column names on the first row are enough." );

	hLastProperty->pNext 				= (HODBCINSTPROPERTY)calloc( 1, sizeof(ODBCINSTPROPERTY) );
	hLastProperty 						= hLastProperty->pNext;
	hLastProperty->nPromptType			= ODBCINST_PROMPTTYPE_COMBOBOX;
	hLastProperty->aPromptData          = malloc( sizeof( aColumnSeparators ) );
	memcpy( hLastProperty->aPromptData, aColumnSeparators, sizeof( aColumnSeparators ) ); 
	strncpy( hLastProperty->szName, "ColumnSeparator", INI_MAX_PROPERTY_NAME );
	strncpy( hLastProperty->szValue, "|", INI_MAX_PROPERTY_VALUE );
	hLastProperty->pszHelp				= strdup( "Column separator character used in table files.\nCANNOT EXIST IN COLUMN VALUES." );

	return 1;
}