Congrats!
Really that old? Why is that?
Only because a problem with ODBC that was identified with later versions (I posted it but I did not check whether it was fixed). Since it works fine, I did not update, but most likely I expect it to run also finely in 8.x.
Do you recall what? Such regressions are fixed unless there is a convincing reason not to fix it (which is rarely the case).
Yes. It was an issue with SQL Server in Windows:
I have just tried the stable version SWI-Prolog 8.0.3 64bit (Windows 10) and the same exception is raised:
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software.
Please run ?- license. for legal details.
For online help and background, visit http://www.swi-prolog.org
For built-in help, use ?- help(Topic). or ?- apropos(Word).
?- odbc_connect('sqlserver', Connection, [open(once)]), odbc_current_table(Connection, Table, arity(Arity)).
% ODBC: State 01000: [Microsoft][SQL Server Native Client 11.0][SQL Server]Se cambió el contexto de la base de datos a 'test'.
ERROR: ODBC: State 07009: [Microsoft][SQL Server Native Client 11.0]Invalid Descriptor Index
ERROR: In:
ERROR: [18] odbc:odbc_column('$odbc_connection'(1131620),dual,_5688)
ERROR: [17] odbc:table_column('$odbc_connection'(1131620),dual,_5726,_5728) at c:/program files/swipl/library/odbc.pl:164
ERROR: [15] '$bags':findall_loop(_5762,odbc:odbc_table_column(...,dual,_5782),_5766,[]) at c:/program files/swipl/boot/bags.pl:98
ERROR: [14] setup_call_catcher_cleanup('$bags':'$new_findall_bag','$bags':findall_loop(_5828,...,_5832,[]),_5810,'$bags':'$destroy_findall_bag') at c:/program files/swipl/boot/init.pl:468
ERROR: [10] odbc:table_facet(arity(_5878),'$odbc_connection'(1131620),row(test,dbo,dual,'TABLE','$null$')) at c:/program files/swipl/library/odbc.pl:153
ERROR: [9] odbc:odbc_current_table('$odbc_connection'(1131620),dual,arity(_5936)) at c:/program files/swipl/library/odbc.pl:145
ERROR: [7] <user>
ERROR:
ERROR: Note: some frames are missing due to last-call optimization.
ERROR: Re-run your program in debug mode (:- debug.) to get more detail.
^ Exception: (14) setup_call_catcher_cleanup('$bags':'$new_findall_bag', '$bags':findall_loop(_4846, odbc:odbc_table_column('$odbc_connection'(1131620), dual, _4846), _4860, []), _6000, '$bags':'$destroy_findall_bag') ?
In SWI-Prolog 7.4.2 it works fine:
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software.
Please run ?- license. for legal details.
For online help and background, visit http://www.swi-prolog.org
For built-in help, use ?- help(Topic). or ?- apropos(Word).
?- odbc_connect('sqlserver', Connection, [open(once)]), odbc_current_table(Connection, Table, arity(Arity)).
% ODBC: State 01000: [Microsoft][SQL Server Native Client 11.0][SQL Server]Se cambió el contexto de la base de datos a 'test'.
Connection = '$odbc_connection'(1070436),
Table = dual,
Arity = 1 .
Following your advice in that thread, I have just replaced odbc4pl.dll in 8.0.3 by the one in 7.4.2 and, again, a similar result as reported there (a dll almost compatible but for a missing predicate):
Welcome to SWI-Prolog (threaded, 64 bits, version 8.0.3)
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software.
Please run ?- license. for legal details.
For online help and background, visit http://www.swi-prolog.org
For built-in help, use ?- help(Topic). or ?- apropos(Word).
?- odbc_connect('sqlserver', Connection, [open(once)]), odbc_current_table(Connection, Table, arity(Arity)).
ERROR: Exported procedure odbc:odbc_cancel_thread/1 is not defined
% ODBC: State 01000: [Microsoft][SQL Server Native Client 11.0][SQL Server]Se cambió el contexto de la base de datos a 'test'.
Connection = '$odbc_connection'(935016),
Table = dual,
Arity = 1 .
I’ll try to get this addressed. Not sure how. Getting the prerequisites is not always easy
Please let me know if I could be of help.