Provide a hack to let initialization happen on platforms for which
authorTom Lane
Sat, 10 Mar 2001 23:12:28 +0000 (23:12 +0000)
committerTom Lane
Sat, 10 Mar 2001 23:12:28 +0000 (23:12 +0000)
psqlodbc.c's constructor-making techniques do not work.

src/interfaces/odbc/environ.c

index 080a8026d5e6947dc0c3f855766596f467951426..6099ba4d1004758679110c319343b2155b37768c 100644 (file)
 
 #include "environ.h"
 #include "connection.h"
+#include "dlg_specific.h"
 #include "statement.h"
 #include 
 #include 
 
+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) {