Menu

#30 Segmentation fault if sqlloadfuncs is not called everytime

closed-fixed
nobody
None
5
2010-09-26
2010-08-31
No

I compiled from RexxSQL-2.6B2 for unixODBC with oorexx 4.0.1 (32bit). I can confirm that isql works and even rexxsql works so far. I have run into only one little problem. If I do not take the check [if rxfuncquery('sqlconnect') then] out of the following example, I get a segmentation fault on any run except the first one.

[root@localhost ~]# cat /etc/redhat-release
CentOS release 5.5 (Final)
[root@localhost ~]# uname -a
Linux localhost.localdomain 2.6.18-194.11.1.el5 #1 SMP Tue Aug 10 19:09:06 EDT 2010 i686 i686 i386 GNU/Linux
[root@localhost ~]# service rxapid restart
Stopping rxapi: [ OK ]
Starting rxapi: [ OK ]
[root@localhost ~]# ./test.rex
5 *-* if rxfuncquery('SQLLoadFuncs')
5 *-* then
6 *-* call rxfuncadd 'SQLLoadFuncs', 'rexxsql'
8 *-* if rxfuncquery('sqlconnect')
8 *-* then
9 *-* call sqlloadfuncs
11 *-* say sqlconnect('c1',,,, 'dsn=safedata')
0
[root@localhost ~]# ./test.rex
5 *-* if rxfuncquery('SQLLoadFuncs')
8 *-* if rxfuncquery('sqlconnect')
11 *-* say sqlconnect('c1',,,, 'dsn=safedata')
Segmentation fault

Same code worked fine under windows xp with rexxsql 2.5 and oorexx 4.0.1 (32bit).

Discussion

  • Brandon Cherry

    Brandon Cherry - 2010-08-31
     
  • Mark Hessling

    Mark Hessling - 2010-09-26
    • status: open --> closed-fixed
     
  • Mark Hessling

    Mark Hessling - 2010-09-26

    SQLLoadFuncs() does some necessary initialisation, so SQLLoadFuncs() MUST be called for each Rex/SQL program. Internally, SQLLoadFuncs() checks if the other functions have been loaded, and loads then if not.
    The documentation will be changed to reflect this requirement.