home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
SQLSVR.ZIP
/
SQLSVR.TXT
Wrap
Text File
|
1993-04-19
|
4KB
|
173 lines
The following are changes to the SQL Server 4.2 include files
in order to use SQL Server with the IBM C/Set2 compiler.
In the file sqlfront.h change:
Lines 18-22 from
#if !defined(M_I86SM) && !defined(DBNTWIN32)
#define SQLAPI cdecl far
#else
#define SQLAPI cdecl
#endif
to
#if defined(DBOS2_20)
#define SQLAPI _Far16 _Cdecl
#elif !defined(M_I86SM) && !defined(DBNTWIN32)
#define SQLAPI cdecl far
#else
#define SQLAPI cdecl
#endif
Lines 30 from
#define DBUBOOL unsigned int
to
#if !defined(DBOS2_20)
#define DBUBOOL unsigned int
#else
#define DBUBOOL unsigned short
#endif
Lines 36-38 from
#ifndef INT
#define INT int
#endif
to
#if !defined(DBOS2_20)
#ifndef INT
#define INT int
#define INT16 INT
#endif
#else
#if !defined(INT16)
#define INT16 short
#endif
#endif
Lines 60-62 from
#if !defined(OS2_INCLUDED) && !defined(DBMSWIN) && !defined(DBNTWIN32)
typedef DBUBOOL BOOL;
#endif
to
#if !defined(DBOS2_20)
#if !defined(OS2_INCLUDED) && !defined(DBMSWIN) && !defined(DBNTWIN32)
typedef DBUBOOL BOOL;
#endif
#endif
In the DBDATEREC structure change all the 'int's to 'INT16's. They are
on lines 406-416.
Lines 422-423 from
#define RETCODE INT
#define STATUS INT
to
#define RETCODE INT16
#define STATUS INT16
In the file sqldb.h change:
Line 54 from
#ifndef DBNTWIN32
to
#if !defined(DBNTWIN32) && !defined(DBOS2_20)
Line 265 from
#ifdef DBMSOS2
to
#ifdef DBMSOS2 /* 16 bit os2 */
Copy the DBMSOS2 section (lines 265-441) changing the following in
the new section:
'#ifdef DBMSOS2' to '#ifdef DBOS2_20 /* 32 bit OS/2 2.0 */'
'INT' to 'INT16' (don't change DBINT to DBINT16)
'int' to 'INT16'
'far *' to '* _Seg16'
'SQLAPI *' to '* SQLAPI'
'extern BOOL SQLAPI dbiscount' to 'extern DBUBOOL SQLAPI dbiscount'
In the programs you write:
* Define DBOS2_20
ex: #define DBOS2_20
* All pointers (even those inside structures) which are passed to a
16 bit routine needs to be declared _Seg16.
ex: DBPROCESS * _Seg16 dbproc;
LOGINREC * _Seg16 login;
* All other variables passed to a 16 bit routine need a
#pragma seg16(variable).
ex: #pragma seg16(userid)
DBSMALLINT userid;
#pragma seg16(name)
DBCHAR name[PLEN+1];
* For the callbacks to 32 bit code from the 16 bit code, it is best to
have a local variable for each parameter passed in from the 16 bit
routine. You also need to use a pragma which tells the compiler
to install an exception handler in the callback routine.
ex:
#pragma handler(msg_handler)
INT16 SQLAPI msg_handler(DBPROCESS * _Seg16 dbproc,
DBINT msgno,
INT16 msgstate,
INT16 severity,
char * _Seg16 msgtext)
{
DBPROCESS *mydbproc = dbproc;
DBINT mymsgno = msgno;
INT16 mymsgstate = msgstate;
INT16 myseverity = severity;
char *mymsgtext = msgtext;
printf("SQL Server message %ld, state %d, severity %d:\n\t%s\n",
mymsgno, mymsgstate, myseverity, mymsgtext);
return(0);
}
* The library routine dbfcmd takes a variable number of parameters.
As a result, the compiler doesn't perform the necessary conversions
on the optional parms. To correct this, use a cast for all optional
parms.
ex: dbfcmd(dbproc, "values(%s) \n", (char * _Seg16) cmdbuf);