I installed postgres 7.1 with --enable-odbc. I then installed
tclodbc (http://sourceforge.net/projects/tclodbc) and libiodbc-2.50.3 (http://www.iodbc.org/dist/libiodbc-2.50.3.tar.gz). I could not get either to work... postgres would not find the global odbcinst.ini file. I traced this to src/interfaces/odbc/gpps.c -- here are the many things I think are wrong: Run tclodbc and do a ``database db <DSNname>'' where ``DSNname'' is one of the DSN's in /usr/local/etc/odbcinst.ini (or wherever the global ini file is installed.) The result is always the error message that ``one of server,port,database,etc. are missing''. Run libiodbc-2.50.3/samples/odbctest <DSNname>. The command fails to connect to the database and just exits. Dave Bodenstab
This commit is contained in:
parent
55abc36e15
commit
13a52c1f03
@ -37,6 +37,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "gpps.h"
|
#include "gpps.h"
|
||||||
|
#include "dlg_specific.h"
|
||||||
|
|
||||||
#ifndef TRUE
|
#ifndef TRUE
|
||||||
#define TRUE ((BOOL)1)
|
#define TRUE ((BOOL)1)
|
||||||
@ -46,6 +47,12 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* theIniFileName is searched for in:
|
||||||
|
* $HOME/theIniFileName
|
||||||
|
* theIniFileName
|
||||||
|
* ODBCINST_INI
|
||||||
|
*/
|
||||||
DWORD
|
DWORD
|
||||||
GetPrivateProfileString(char *theSection, /* section name */
|
GetPrivateProfileString(char *theSection, /* section name */
|
||||||
char *theKey, /* search key name */
|
char *theKey, /* search key name */
|
||||||
@ -70,46 +77,38 @@ GetPrivateProfileString(char *theSection, /* section name */
|
|||||||
size_t aReturnLength = 0;
|
size_t aReturnLength = 0;
|
||||||
BOOL aSectionFound = FALSE;
|
BOOL aSectionFound = FALSE;
|
||||||
BOOL aKeyFound = FALSE;
|
BOOL aKeyFound = FALSE;
|
||||||
int j = 0;
|
size_t aReturnLength = 0;
|
||||||
|
BOOL aSectionFound = FALSE;
|
||||||
|
BOOL aKeyFound = FALSE;
|
||||||
|
|
||||||
j = strlen(theIniFileName) + 1;
|
|
||||||
ptr = (char *) getpwuid(getuid()); /* get user info */
|
ptr = (char *) getpwuid(getuid()); /* get user info */
|
||||||
|
|
||||||
if (ptr == NULL)
|
if (ptr == NULL || (((struct passwd *) ptr)->pw_dir) == NULL || *(((struct passwd *) ptr)->pw_dir) == '\0')
|
||||||
{
|
|
||||||
if (MAXPGPATH - 1 < j)
|
|
||||||
theIniFileName[MAXPGPATH - 1] = '\0';
|
|
||||||
|
|
||||||
sprintf(buf, "%s", theIniFileName);
|
|
||||||
}
|
|
||||||
ptr = ((struct passwd *) ptr)->pw_dir; /* get user home dir */
|
|
||||||
if (ptr == NULL || *ptr == '\0')
|
|
||||||
ptr = "/home";
|
ptr = "/home";
|
||||||
|
else
|
||||||
|
ptr = ((struct passwd *) ptr)->pw_dir; /* get user home dir */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This doesn't make it so we find an ini file but allows normal
|
* If it can't be opened because the paths are too long, then
|
||||||
* processing to continue further on down. The likelihood is that the
|
* skip it, don't just truncate the path string... The truncated path
|
||||||
* file won't be found and thus the default value will be returned.
|
* might accidently be an existing file. The default value will be
|
||||||
|
* returned instead.
|
||||||
*/
|
*/
|
||||||
if (MAXPGPATH - 1 < strlen(ptr) + j)
|
if (MAXPGPATH - 1 >= strlen(ptr) + 1 + strlen(theIniFileName))
|
||||||
{
|
{
|
||||||
if (MAXPGPATH - 1 < strlen(ptr))
|
sprintf(buf, "%s/%s", ptr, theIniFileName);
|
||||||
ptr[MAXPGPATH - 1] = '\0';
|
aFile = (FILE *) fopen(buf, PG_BINARY_R);
|
||||||
else
|
|
||||||
theIniFileName[MAXPGPATH - 1 - strlen(ptr)] = '\0';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(buf, "%s/%s", ptr, theIniFileName);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This code makes it so that a file in the users home dir overrides a
|
* This code makes it so that a file in the users home dir overrides a
|
||||||
* the "default" file as passed in
|
* the "default" file as passed in
|
||||||
*/
|
*/
|
||||||
aFile = (FILE *) (buf ? fopen(buf, PG_BINARY_R) : NULL);
|
|
||||||
if (!aFile)
|
if (!aFile)
|
||||||
{
|
{
|
||||||
sprintf(buf, "%s", theIniFileName);
|
aFile = (FILE *) fopen(theIniFileName, PG_BINARY_R);
|
||||||
aFile = (FILE *) (buf ? fopen(buf, PG_BINARY_R) : NULL);
|
if (!aFile)
|
||||||
|
aFile = (FILE *) fopen(ODBCINST_INI, PG_BINARY_R);
|
||||||
}
|
}
|
||||||
|
|
||||||
aLength = (theDefault == NULL) ? 0 : strlen(theDefault);
|
aLength = (theDefault == NULL) ? 0 : strlen(theDefault);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user