Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!ukc!axion!vision!chris From: chris@vision.uucp (Chris Davies) Newsgroups: comp.databases Subject: Re: RDBMS Portability Isses Keywords: RDBMS Portability, X-Windows Message-ID: <1991Jan30.123942.13058@vision.uucp> Date: 30 Jan 91 12:39:42 GMT References: <1991Jan28.180523.28946@lgc.com> Reply-To: chris@vision.UUCP (Chris Davies) Organization: VisionWare Ltd., Leeds, UK Lines: 57 In article <1991Jan28.180523.28946@lgc.com> rubi@lgc.com ( Ernest Rubi) writes: >[...] I am particularly interested in >portability issues between Oracle and Ingres, with additional >interests in Sybase and Informix. Ideally, I would like to be >able to take a C program containg embedded SQL and X-Window calls, >run it through the preprocesssor of whichever RDBMS, and have the >expectation that the program will function the same regardless of >the RDBMS. Given the constraints of an industry that has not yet [...] (I cannot comment on the portability of X (although I would expect that to be not too much of a problem.) However, for the embedded SQL part - certainly not! Trivial statements such as EXEC SQL SELECT ... INTO :a might work for both ORACLE and INGRES (but not INFORMIX), but anything more, including the actual connection to the database, is not truly portable. I would suggest that the easiest route for you to take is to separate out the database-specific sections into a separate source module, wrapped up in your own functions which perform well-defined actions in a generic-looking way. This way your program can request such things as connection to a database with generic-looking calls such as boolean ConnectToDatabase(ConnStr) char *ConnStr; { /* * Connect to database using db-specific string. Return * TRUE or FALSE to indicate success (or otherwise). */ EXEC SQL CONNECT ... ; } This is the route that VisionWare took. I found it easiest to have a separate module for each of the databases Ingres, Informix and Oracle, rather than use constructs such as #ifdef ORACLE6 ... #else #ifdef INGRES6 ... #else #ifdef INFORMIX4 ... #else # error "No database type specified" #endif Hope this is useful, Chris -- VISIONWARE LTD | UK: chris@vision.uucp JANET: chris%vision.uucp@ukc 57 Cardigan Lane | US: chris@vware.mn.org BANGNET: ...!ukc!vision!chris LEEDS LS4 2LE, England | VOICE: +44 532 788858 FAX: +44 532 304676 -------------- "VisionWare: The home of DOS/UNIX/X integration" -------------