Обсуждение: psqlodbc

Поиск
Список
Период
Сортировка

psqlodbc

От
"Thomas G. Lockhart"
Дата:
I'm trying to build the ODBC driver to use with an iODBC interface for
the upcoming release of ApplixWare on Linux. I notice that in the last
few days the psqlodbc distribution has acquired a Makefile and a
README.Linux, but the build is not going very well.

Has anyone tried to build on a Unix box recently? If so, how?? The first
file fails on a WINAPI-ed typedef...

                      - Tom

golem$ make
gcc -g -c -Wall  -O -fPIC  -I. -I.. -I -I -g -DHAVE_CONFIG_H    -c
info.c -o info.o
In file included from info.c:41:
connection.h:166: parse error before `*'
connection.h:177: parse error before `*'
connection.h:202: parse error before `HINSTANCE'
connection.h:202: warning: no semicolon at end of struct or union
connection.h:203: warning: data definition has no type or storage class
connection.h:204: parse error before `DriverToDataSource'
connection.h:204: warning: data definition has no type or storage class
connection.h:207: parse error before `}'
info.c: In function `SQLGetInfo':
info.c:190: dereferencing pointer to incomplete type
info.c:197: dereferencing pointer to incomplete type
info.c:302: dereferencing pointer to incomplete type
info.c:303: dereferencing pointer to incomplete type
info.c:622: dereferencing pointer to incomplete type
info.c:717: dereferencing pointer to incomplete type
info.c:724: dereferencing pointer to incomplete type
info.c:725: dereferencing pointer to incomplete type
info.c:62: warning: `p' might be used uninitialized in this function
info.c: In function `SQLGetTypeInfo':
info.c:746: warning: left-hand operand of comma expression has no effect
info.c:746: warning: statement with no effect
info.c: In function `SQLTables':
info.c:1007: warning: left-hand operand of comma expression has no
effect
info.c:1007: warning: statement with no effect
info.c:1017: dereferencing pointer to incomplete type
info.c:1180: warning: left-hand operand of comma expression has no
effect
info.c:1180: warning: left-hand operand of comma expression has no
effect
info.c:1180: warning: left-hand operand of comma expression has no
effect
info.c:1180: warning: statement with no effect

Re: [INTERFACES] psqlodbc

От
Aleksey Demakov
Дата:
"Thomas G. Lockhart" <lockhart@alumni.caltech.edu> writes:

>
> I'm trying to build the ODBC driver to use with an iODBC interface for
> the upcoming release of ApplixWare on Linux. I notice that in the last
> few days the psqlodbc distribution has acquired a Makefile and a
> README.Linux, but the build is not going very well.
>
> Has anyone tried to build on a Unix box recently? If so, how?? The first
> file fails on a WINAPI-ed typedef...
>

Try with this patch. Since I doubt anyone needs translation DLLs under
linux I simply ifdefed out some code. Though it's posible to use
dlopen/dlsym/dlclose instead of LoadLibrary/GetProcAddress/FreeLibrary...

Aleksey


diff -c psqlodbc.old/connection.c psqlodbc/connection.c
*** psqlodbc.old/connection.c    Tue Jul 28 13:03:23 1998
--- psqlodbc/connection.c    Tue Jul 28 12:57:17 1998
***************
*** 380,390 ****
--- 380,392 ----
          }
      }

+ #ifndef UNIX
      /*    Check for translation dll */
      if ( self->translation_handle) {
          FreeLibrary (self->translation_handle);
          self->translation_handle = NULL;
      }
+ #endif

      mylog("exit CC_Cleanup\n");
      return TRUE;
***************
*** 393,399 ****
  int
  CC_set_translation (ConnectionClass *self)
  {
!
      if (self->translation_handle != NULL) {
          FreeLibrary (self->translation_handle);
          self->translation_handle = NULL;
--- 395,401 ----
  int
  CC_set_translation (ConnectionClass *self)
  {
! #ifndef UNIX
      if (self->translation_handle != NULL) {
          FreeLibrary (self->translation_handle);
          self->translation_handle = NULL;
***************
*** 424,429 ****
--- 426,432 ----
          self->errormsg = "Could not find translation DLL functions.";
          return FALSE;
      }
+ #endif

      return TRUE;
  }
diff -c psqlodbc.old/connection.h psqlodbc/connection.h
*** psqlodbc.old/connection.h    Tue Jul 28 13:03:10 1998
--- psqlodbc/connection.h    Tue Jul 28 12:36:56 1998
***************
*** 162,167 ****
--- 162,174 ----
      char            name[MAX_TABLE_LEN+1];
  };

+ #ifdef UNIX
+ #define WINAPI CALLBACK
+ #define DLLHANDLE void *
+ #else
+ #define DLLHANDLE HINSTANCE
+ #endif
+
   /* Translation DLL entry points */
  typedef BOOL (FAR WINAPI *DataSourceToDriverProc) (UDWORD,
                      SWORD,
***************
*** 199,205 ****
      int                ntables;
      COL_INFO        **col_info;
      long            translation_option;
!     HINSTANCE       translation_handle;
      DataSourceToDriverProc  DataSourceToDriver;
      DriverToDataSourceProc  DriverToDataSource;
      char            transact_status;        /* Is a transaction is currently in progress */
--- 206,212 ----
      int                ntables;
      COL_INFO        **col_info;
      long            translation_option;
!     DLLHANDLE       translation_handle;
      DataSourceToDriverProc  DataSourceToDriver;
      DriverToDataSourceProc  DriverToDataSource;
      char            transact_status;        /* Is a transaction is currently in progress */


--
Aleksey Demakov
avd@gcom.ru

Re: [INTERFACES] psqlodbc

От
"Thomas G. Lockhart"
Дата:
> > I'm trying to build the ODBC driver to use with an iODBC interface
> > for the upcoming release of ApplixWare on Linux.
> Try with this patch.

OK, that seems to help (though there is still major ugliness with the
macro which disables mylog()).

Anyway, I now have a sharable library, and ApplixWare is running. But I
don't see any candidate servers when I try to select a database to open.
I made a ~/.odbc.ini file, and included entries like:

[Postgres]
Debug = 0
CommLog = 1
Driver = /opt/postgres/current/lib/libpsqlodbc.so

but see nothing in the ApplixWare dialog box. Does anyone have a working
.odbc.ini file, perhaps for MySQL? I guess I expected to see "Postgres"
as a candidate database in the ApplixWare dialog box, even if the rest
of the configuration was screwed up. What else needs to be set up??

TIA

                     - Tom