aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2001-03-10 23:12:28 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2001-03-10 23:12:28 +0000
commit5ab642fdf1a75d29e0b78e1430550e0d190d67fe (patch)
tree0c9587e747c60ac473362a26e311d202d628d4b3
parenteb9033ce95008d186fddd1a2a329f27ba0d56813 (diff)
downloadpostgresql-5ab642fdf1a75d29e0b78e1430550e0d190d67fe.tar.gz
postgresql-5ab642fdf1a75d29e0b78e1430550e0d190d67fe.zip
Provide a hack to let initialization happen on platforms for which
psqlodbc.c's constructor-making techniques do not work.
-rw-r--r--src/interfaces/odbc/environ.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/interfaces/odbc/environ.c b/src/interfaces/odbc/environ.c
index 080a8026d5e..6099ba4d100 100644
--- a/src/interfaces/odbc/environ.c
+++ b/src/interfaces/odbc/environ.c
@@ -15,19 +15,31 @@
#include "environ.h"
#include "connection.h"
+#include "dlg_specific.h"
#include "statement.h"
#include <stdlib.h>
#include <string.h>
+extern GLOBAL_VALUES globals;
+
/* The one instance of the handles */
ConnectionClass *conns[MAX_CONNECTIONS];
RETCODE SQL_API SQLAllocEnv(HENV FAR *phenv)
{
-static char *func = "SQLAllocEnv";
-
-mylog("**** in SQLAllocEnv ** \n");
+ static char *func = "SQLAllocEnv";
+
+ mylog("**** in SQLAllocEnv ** \n");
+
+ /*
+ * Hack for systems on which none of the constructor-making techniques
+ * in psqlodbc.c work: if globals appears not to have been initialized,
+ * then cause it to be initialized. Since this should be the first
+ * function called in this shared library, doing it here should work.
+ */
+ if (globals.socket_buffersize <= 0)
+ getGlobalDefaults(DBMS_NAME, ODBCINST_INI, FALSE);
*phenv = (HENV) EN_Constructor();
if ( ! *phenv) {