[freetds] porting a windows program

ZIGLIO, Frediano, VF-IT Frediano.Ziglio at vodafone.com
Wed Jul 25 05:00:17 EDT 2007


> Thomas Stover wrote:
> > The first problem is that I don't seem to be including the 
> > correct header for the PDBPROCESS structure. I looked around in the 
> > FreeTDS headers and saw DBPROCESS all over the place, so I tried a 
> > "#define PDBPROCESS DBPROCESS" to no avail. The other big 
> thing is that 
> > I'm going from the MS doc's version of what error and 
> message handlers 
> > should look like. Clearly that part needs some work. 
> 
> Thomas, 
> 
> I recommend you add any such Sybase->Microsoft changes to 
> sqldb.h, because
> that's what Microsoft calls that file.  For instance, PDBPROCESS is a
> pointer to a DBPROCESS, so something like:
> 
> 
> #define PDBPROCESS DBPROCESS*
> 
> should help.  
> 
> If -- and only if -- you have real conflicts, wrap them:
> 
> 	#ifndef MSDBLIB
> 		/* the usual */
> 	#else
> 		/* one microsoft way */ 
> 	#endif
> 
> I would think the handlers could be defined something like:
> 
> typedef INT (DBERRHANDLER)(DBPROCESS*, INT, INT, INT, const 
> char *, const
> char *);
> typedef INT (DBMSGHANDLER)(DBPROCESS*, DBINT, INT, INT, const char *,
> const char *, const char *, DBUSMALLINT);
> 
> extern DBERRHANDLER dberrhandle(DBERRHANDLER);
> extern DBMSGHANDLER dbmsghandle(DBMSGHANDLER);
> 
> HTH.
> 

I think a small patch like this:



Index: include/sqlfront.h
===================================================================
RCS file: /cvsroot/freetds/freetds/include/sqlfront.h,v
retrieving revision 1.3
diff -u -1 -0 -r1.3 sqlfront.h
--- include/sqlfront.h  28 Oct 2004 12:42:12 -0000      1.3
+++ include/sqlfront.h  25 Jul 2007 08:59:13 -0000
@@ -18,12 +18,15 @@
  */

 #ifndef SQLFRONT_h
 #define SQLFRONT_h

 #include <sybfront.h>

 static const char rcsid_sqlfront_h[] = "$Id: sqlfront.h,v 1.3
2004/10/28 12:42:12 freddy77 Exp $";
 static const void *const no_unused_sqlfront_h_warn[] = {
rcsid_sqlfront_h, no_unused_sqlfront_h_warn };

+typedef DBPROCESS * PDBPROCESS;
+typedef LOGINREC  * PLOGINREC;
+typedef DBCURSOR  * PDBCURSOR;

 #endif



could help

bye
  freddy77



More information about the FreeTDS mailing list