[IBPP-DISCUSS] IBPP - Borland C++ 5.02
IBPP is a C++ client class library for FirebirdSQL
Status: Inactive
Brought to you by:
epocman
From: Patrick S. <per...@ho...> - 2010-12-14 06:30:46
|
Hi All, I thought I'd give you a bit of a story and see if it helps anyone or if anyone has anything to add. I've got a fairly ancient and massive Borland C++ 5.02, (BCPP502), OWL, Paradox/BDE project that I'm trying to update. Part of this is to replace the existing Paradox database with Firebird. We have the BCPP502 IDE, but I don't think that there's any difference between it and the free 502 compiler. To achieve this I want to compile IBPP directly in BCPP502, but it didn't want to play nice initially. After a bit of work I managed to get it to compile; mostly it was just includes/objects/functions with a slightly different name. For example: #ifdef __BCPLUSPLUS__ #include <stdarg> #else #include <cstdarg> #endif #ifdef __BCPLUSPLUS__ mString.remove(); #else mString.erase(); #endif #ifdef __BCPLUSPLUS__ ostrstream hexkey; #else std::ostringstream hexkey; #endif (I used the __BCPLUSPLUS__ preprocessor as a conditional, but obviously that would also alter Borland Builder compiles too, so for those that use it, I wouldn't suggest this necessarily). However, whenever I tried to test a simple statement I would get an empty fetch. I compiled up the exact same project in VC++2010 and it worked just fine. The culprit was a little weird, (and I'm not sure I understand it), but when making calls to the Firebird DLL it was putting values in the wrong place in the mOutRow->mDescrArea parameter. To fix it I had to manually insert two dummy bytes in the XSQLDA structure, Here is the revised definition: typedef struct { ISC_SHORT version; ISC_SCHAR sqldaid[8]; #ifdef __BCPLUSPLUS__ char extraTwoBytes[2]; #endif ISC_LONG sqldabc; ISC_SHORT sqln; ISC_SHORT sqld; XSQLVAR sqlvar[1]; } XSQLDA; As far as I can tell/test, the ISC_SCHAR arrays in XSQLVAR and others don't have a problem. Well, if anyone has any thoughts on why, (and I realise that it's more likely to be a compiler issue than an IBPP one), please let me know; I'm not really an expert, and belong to the C# generation for better or for worse. Otherwise I hope this helps someone. I'm going back to test more thoroughly. At this stage I'm almost expecting another gotcha or two, but haven't noticed any yet. Patrick S. per...@ho... |