How to compile sqlrdd in Harbour

407 views
Skip to first unread message

Francesco Perillo

unread,
Aug 21, 2023, 6:12:33 PM8/21/23
to harbou...@googlegroups.com
I did a simple test and could compile sqlrdd. I DO NOT test it, just compile the library.

The compile process can probably be streamlined, I REPEAT, IT IS JUST A PROOF OF CONCEPT

I installed mingw compiler from msys2 (installed msys2, updated, installed mingw-i686, installed bison . bison executable is in c:\msys64\usr\bin)

1. Download xharbour sources, unzip, copy sqlrdd directory in some other directory so that you have a pristine copy of the sources
2. cd in source directory
2bis. IMPORTANT: from the unzipped xHarbour source code, copy hbcompat.ch from include directory to the source directory of sqlrdd, see the note at the end
3. set your environment to your harbour... as I said, I use mingw from msys2
3. set HB_BISONPATH=c:\msys64\usr\bin  (it's not in my PATH, you may have it)
4. open sqlrdd.hbp and add a line to include contrib/xhb directory in the include search path, in my setup it is:
   -Id:\cvs\harbour\contrib\xhb
5. open exprrelation.prg and change (I don't know why that like is not recognized by the pre-processor):
- if(::aIndex[i,10] like "^\w+$")
+ if(hb_regexLike( "^\w+$", ::aIndex[i,10] ) )
6. run hbmk2 -xhb sqlrdd.hbp
There will be errors, modify the lines like this sample (add :: in front of Super...)
-return Super:End()
+return ::Super:End()
6bis. repeat another 4 times since there are 5 files to be modified
7. the 6th time you run hbmk2. It should go ahead, call bison, list a lot of warnings that I didn't care at the moment and finally:

hbmk2: Creazione della libreria statica... libsqlrdd.a

Note:
You have4 to do step 2bis...
in harbour\contrib\xhb\hbcompat.ch I have this line
#translate ( <exp1> LIKE <exp2> )   => hb_regexLike( <exp2>, <exp1> )

in xharbour\include\hbcompat.ch I have this line
#translate ( <exp1> LIKE <exp2> )   => ( HB_REGEXLIKE( (<exp2>), (<exp1>) ) )

With xHarbour version the code is compiled correctly, with harbour version it is not and I have no time and no knowledge to investigate the reason.

Have fun


Mario H. Sabado

unread,
Aug 21, 2023, 9:52:44 PM8/21/23
to harbou...@googlegroups.com
Thank you for sharing Francesco.  This is greatly appreciated and would surely help others wanting to try and evaluate SQLRDD in Harbour.

Best regards,
Mario

--
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
Unsubscribe: harbour-user...@googlegroups.com
Web: https://groups.google.com/group/harbour-users
---
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to harbour-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/harbour-users/CADPHLr8YrnxvFzyyfySoi8M%2BKBpbOabR2BJuKqv44y3LQyph5w%40mail.gmail.com.

prg...@gmail.com

unread,
Aug 23, 2023, 5:31:11 PM8/23/23
to Harbour Users
Here is a sqlrdd.hbp that I am using:
-i..\Include
#-incpath=..\..\..\..\harbour\include{win}
-incpath=..\..\..\..\harbour\contrib\xhb{win}
-incpath=..\..\..\harbour\contrib\hbtip{win}
-incpath=..\..\..\..\harbour\contrib\hbcurl{win}
-incpath=..\..\..\harbour\contrib\hbwin{win}
-i_HB\win\mingw64\sqlrdd{win}
-incpath=..\..\gg_hlib\include
-incpath=/usr/local/share/harbour/contrib/xhb{linux}
-incpath=../../../../harbour/contrib/hbcurl{linux}

-L/usr/local/lib/harbour{linux}
-L../../../harbour/contrib/hbcurl{linux}
-L\harbour\lib\{win}


-workdir=_HB/${hb_plat}/${hb_comp}/${hb_targetname}
-o${hb_name}_${hb_plat}

-DHB_THREAD_SUPPORT
-plugin=hbmk2_bison.hbs
-I${hb_work}/${hb_plat}/${hb_comp}
-bisonflag=--update

-hblib
-inc
# -p

-o${hb_name}

-n
-w
-es2

-I.

# sqlodbc.prg
sqlconnection.prg
sqlrdd0.prg
sqlrdd2.prg
utils.prg
sqlgen1.prg
utilslang.prg
# sqlmy.prg
sqlpgs.prg
# sqlfirebird.prg
# sqloracle.prg
exprtransl.prg
exprparser.prg
exprsimpl.prg
exprobjs.prg
exprrelation.prg
exprudf.prg
sqlnames.prg

sql.y
#sqly.c

compat.c
sqlact.c
# firebird.c
sqllex.c
# mysql.c
pgs.c
# sqlsrodbc.c
sqlrdd1.c
# sqlora.c
# sqlorax.c
# sqlex1.c
# sqlex2.c
# sqlex3.c

{!xhb}-hbx=sqlrdd.hbx
{!xhb}sqlrdd.hbx

Mario H. Sabado

unread,
Aug 23, 2023, 9:51:58 PM8/23/23
to harbou...@googlegroups.com
Hi Gerald,

Thank you for sharing.  I noticed that sqly.c was commented out but I got the following error when building the library.  Anything I may have missed? 

*******************************
cc1.exe: fatal error: /harbour64/win/mingw64/hb_sqlrdd/sqly.c: No such file or directory
compilation terminated.
hbmk2[hb_sqlrdd]: Error: Running C/C++ compiler. 1
*********************************

Best regards,
Mario





--
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
Unsubscribe: harbour-user...@googlegroups.com
Web: https://groups.google.com/group/harbour-users
---
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to harbour-user...@googlegroups.com.

Gerald Drouillard

unread,
Aug 23, 2023, 10:14:41 PM8/23/23
to harbou...@googlegroups.com
Did you have a bison warming before that?

Mario H. Sabado

unread,
Aug 23, 2023, 11:03:55 PM8/23/23
to harbou...@googlegroups.com
Hi Gerald,

Yes, I had the bison warning then I set the HB_BISONPATH=<bison_bin_path>.  When I commented out the -workdir, the sqlrdd lib was compiled. Trying the demo01.prg, I got the following error.
*******************
hbmk2: Error: Referenced, missing, but unknown function(s): SR_PGS(),
       SR_MYSQL(), SR_ORACLE(), SR_ALLOCCO(), SR_ALLOCEN(), SR_COLATTRIBUTE(),
       SR_DESCRIB(), SR_DISCONN(), SR_ERROR(), SR_FREECON(), SR_FREEENV(),
       SR_FREESTM(), SR_GETCONNECTOPTION(), SR_GETINFO(), SR_NUMRES(),
       SR_SETCONNECTATTR(), SR_SETSTMTOPTION(), SR_TABLES(), SR_COMMIT(),
       SR_INSTALLDSN(), SR_INSTALLERROR(), SR_DRIVERC(), SR_MORERESULTS(),
       FBGETDATA()
************************

Just curious why I got the above even though I only left FB and ODBC related prg/c files.
*********************************************
sqlodbc.prg
sqlconnection.prg
sqlrdd0.prg
sqlrdd2.prg
utils.prg
sqlgen1.prg
utilslang.prg
#sqlmy.prg
#sqlpgs.prg
sqlfirebird.prg
#sqloracle.prg

exprtransl.prg
exprparser.prg
exprsimpl.prg
exprobjs.prg
exprrelation.prg
exprudf.prg
sqlnames.prg

sql.y
#sqly.c

compat.c
sqlact.c
firebird.c
sqllex.c
#mysql.c
#pgs.c
sqlsrodbc.c
sqlrdd1.c
#sqlora.c
#sqlorax.c
sqlex1.c
sqlex2.c
sqlex3.c
**********************************


Gerald Drouillard

unread,
Aug 24, 2023, 9:44:15 AM8/24/23
to harbou...@googlegroups.com
Look at the examples.  You may need to "request" some of the modules

Francesco Perillo

unread,
Aug 24, 2023, 10:00:31 AM8/24/23
to harbou...@googlegroups.com
gmail, after years of being a subscriber of this mailing, still moves some messages into spam forlder... sgruntt...

Anyway,

there is only ONE change that should be done to sqlrdd.hbp, adding the include directive for xhb library.
In my case:
-Id:\cvs\harbour\contrib\xhb

In Gerard sample:
-incpath=..\..\..\..\harbour\contrib\xhb{win}
-incpath=/usr/local/share/harbour/contrib/xhb{linux}

but they still depend on HIS specific harbour installation, so they should be modified (I'm quite sure there is a variable to point to harbour directory but I can't remember now). All those other include directives are not needed for compiling this library,

Please, don't comment source files. There is a trick in sqlrdd0.prg that prevents linking of unused classes and in this way all databases are supported out of the box. It will also allows us to experiment with the same code...

This is just my idea, of course.



   /* The macro execution is used to NOT link the connection class if we don't need it
      The programmer MUST declare the needed connection class using REQUEST in PRG source */


   Switch nType
   Case CONNECT_ODBC
   Case CONNECT_ODBC_NOEXLOCK
#ifndef MYSQLRDD
      oConnect  := &( "SR_ODBC()" )
      oConnect2 := &( "SR_ODBC()" )
#endif
      Exit





Reply all
Reply to author
Forward
0 new messages