[eclipse-clp-users] Dbi Query with more than 1 columns

From: Edgaonkar, Shrirang <Shrirang.Edgaonkar_at_...390...>
Date: Wed, 28 Jan 2015 08:53:05 +0000
Dear Clp users,





   I have an observation with the Dbi query. If the underlying table has a Varchar then we can have only one column in the select query.



Check the following example which fails since tbl has two columns and first one is a Varchar(cityname). Eclipse tool crashes after execution of the script.

:- lib(dbi).
solve(Hosts, IN, Y, Tuple) :-



 % Connect to DB  user/password
 session_start("root", "", [], Session),

 % SQL
 SQL = "select  c1.cityname, c1.cityid from simulator.city c1",

 % Template
 Template = tbl(A, 1),

 % Execute SQL
 session_sql_query(Session, Template, SQL, Cursor),

 % Get Results
 cursor_all_tuples(Cursor, Tuple),

 % Close Cursor
 cursor_close(Cursor),

 % Close DB Connection
 session_close(Session).





Following is the matrix for different values and their execution result.





 Template = tbl(A),   % Success



 Template = tbl(0, 1),   % Success where 0 and 1 are integer fields(not displayed in the above script)



Template = tbl(0),   % Success



Please confirm if this is right and if you have any solution.



Thanks and Regards,

Shrirang Edgaonkar







______________________________________________________________________
Disclaimer: This email and any attachments are sent in strictest confidence
for the sole use of the addressee and may contain legally privileged,
confidential, and proprietary data. If you are not the intended recipient,
please advise the sender by replying promptly to this email and then delete
and destroy this email and any attachments without any further use, copying
or forwarding.
Received on Wed Jan 28 2015 - 08:53:17 CET

This archive was generated by hypermail 2.3.0 : Thu Feb 22 2024 - 18:13:20 CET