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

From: Edgaonkar, Shrirang <Shrirang.Edgaonkar_at_...390...>
Date: Mon, 2 Feb 2015 01:58:34 +0000
Dear Kish,

  Thanks for the reply. I tried it on 32 bit and it works fine. Your conclusion is perfect. Please let me know once the issue is fixed in 64 bit and how can I use the fix on my version of Eclipse. Following is the result of the transcript. 

C:\Program Files (x86)\ECLiPSe 6.1\lib\i386_nt>eclipse -f temp.ecl -l 20000 -g 2
0000
ECLiPSe Constraint Logic Programming System [kernel]
Kernel and basic libraries copyright Cisco Systems, Inc.
and subject to the Cisco-style Mozilla Public Licence 1.1
(see legal/cmpl.txt or http://eclipseclp.org/licence)
Source available at www.sourceforge.org/projects/eclipse-clp
GMP library copyright Free Software Foundation, see legal/lgpl.txt
For other libraries see their individual copyright notices
Version 6.1 #194 (i386_nt), Fri Oct 24 12:21 2014
[eclipse 1]: solve(Result).
dsads
Result = [goodsinfo(101, "laptop", "fdfdsfds", "dadsads")]
Yes (0.03s cpu)
[eclipse 2]:

Thanks and Regards,
Shrirang Edgaonkar
________________________________________
From: Kish Shen [kisshen_at_...5...]
Sent: 31 January 2015 11:22:48
To: Edgaonkar, Shrirang
Subject: Re: [eclipse-clp-users] Dbi Query with more than 1 columns

Hi,

I think I understand the problem, and I think it only affect 64 bit Windows.

I do not expect this specific problem to affect 'Prolog terms column',
i.e. I don't expect it to affect the original problems where you used a
variable in the template specification. As I said, I expect both tbl(A)
and tbl(A, 1) to abort with an error, but not crash or succeed as you
suggested -- remember that aborting with an error without terminating
ECLiPSE (TkECLiPSE in your case) is not a crash. If you did get crashes,
please send me all the details, including any messages you get.

I think the problem is due to the assumption in the dbi code that the C
type long is the same length as the machine word. This is true on all
platform expect 64 bit Windows, where long is 32 bit only (rather than
64 bit as in the word length). This mean that in your example, dbi
mistakenly read the lengths for 2 successive columns (which are 2 32 bit
integers with 64 bit Windows) as a single 64 bit integer, representing
the length of 1 column. This is of course a very large number, and
should lead to the overflow problem you are seeing.

If I am correct, this problem should not exist for 32 bit Windows (as
long and word length are both 32 bit). Can you please download the 32
bit Windows (i386_nt) version of ECLiPSe and run your examples on that.
You should be able to run the 32 bit ECLiPSe on your 64 bit Windows
machine, and I also think it can connect to the 64 bit MySQL server as
well. Please report to me on what happens when you do that.

I will also fix the problem for 64 bit Windows, but I will not check
that in until you confirm that you don't see the problem with 32 bit
Window version of ECLiPSe. Also, again, can you please give details on
your runs with the variable template you initially reported on. If there
is a problem there, I would also want to fix that.

Cheers,

Kish

On 30/01/2015 08:52, Edgaonkar, Shrirang wrote:
> Dear Kish,
>
>    Thanks for the reply.
>
> For the sample script I used DOSEclipse for message. Following is the error message.
>
> ECLiPSe Constraint Logic Programming System [kernel]
> Kernel and basic libraries copyright Cisco Systems, Inc.
> and subject to the Cisco-style Mozilla Public Licence 1.1
> (see legal/cmpl.txt or http://eclipseclp.org/licence)
> Source available at www.sourceforge.org/projects/eclipse-clp
> GMP library copyright Free Software Foundation, see legal/lgpl.txt
> For other libraries see their individual copyright notices
> Version 6.1 #192 (x86_64_nt), Mon Oct  6 12:34 2014
> [eclipse 1]: solve(Result).
> *** Overflow of the global/trail stack in spite of garbage collection!
> You are probably out of virtual memory (swap space).
> Peak sizes were: global stack 13120 kbytes, trail stack 64 kbytes
> Abort
> [eclipse 2]:
>
> Thanks and Regards,
> Shrirang Edgaonkar
> ________________________________________
> From: Kish Shen [kisshen_at_...5...]
> Sent: 30 January 2015 16:36:02
> To: Edgaonkar, Shrirang
> Subject: Re: [eclipse-clp-users] Dbi Query with more than 1 columns
>
> On 30/01/2015 02:11, Edgaonkar, Shrirang wrote:
>
>>     Yes. That was a mistake but the problem is still the same. Even if the template is correct as per the documentation as follows, eclipse still crashes.
>
> Did you or did you not get a crash from using the template with a
> variable, i.e. tbl(A, 3)? If you did, did the test with a tuple with
> only 1 specifying a single Prolog term column (i.e. the one with the
> template like tbl(A)), succeed or not? I expect both of these to lead to
> your program being aborted because dbi will throw a type error in both
> cases. If this is not the case, please let me know what exactly happened
> in both these cases.
>
> Turning to your new examples with the correct template for string
> xolumns, by crashing do you mean the TkECLiPSe window disappearing? If
> so, did you see any messages?
>
> If you did not see any messages, can you try reruning your program with
> DosECLiPSe -- this should be available in the 'all programs' menu where
> you can run TkECLiPSe, as DosECLiPSe is the alternative way of running
> ECLiPSe, from a DOS shell. Hopefully there should be a better chance of
> diaplaying any messages generated during the crash...
>
> Cheers,
>
> Kish
>
>
>> SQL = "select enum, ename, esalary, ejob from employees where esalary > 1000",
>> Template = emp(1234,"some name",1000.0,’some job’),
>> session_sql_query(H, Template, SQL, Cursor),
>> cursor_next_tuple(Cursor,Tuple),
>>
>> Following is the example I am running,.
>>
>> Table Structure:-
>>
>> CREATE TABLE `goodsinfo` (
>>     `goodsid` int(11) NOT NULL,
>>     `goodsname` char(100) DEFAULT NULL,
>>     `price` double DEFAULT NULL,
>>     `salesdate` datetime DEFAULT NULL,
>>     `term` char(100) DEFAULT NULL,
>>     `zaikoamount` double DEFAULT NULL,
>>     `registerdate` datetime DEFAULT NULL,
>>     `categoryid` int(11) DEFAULT NULL,
>>     `searchViews` char(100) DEFAULT NULL,
>>     PRIMARY KEY (`goodsid`)
>> ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
>>
>>
>> Eclipse script:-
>>
>> :- lib(dbi).
>> solve(Result) :-
>>
>> session_start("root", "", [], Session),
>> SQL = "SELECT goodsid, goodsname, term FROM simulator.goodsinfo",
>> Template = goodsinfo1(101, "fdfdfddsdad", "dsdsadsds"),
>> session_sql_query(Session, Template, SQL, Cursor),
>> cursor_all_tuples(Cursor, Result),
>> cursor_close(Cursor),
>> session_close(Session).
>>
>> Since gooodsname and term are character string fields, eclipse will crash, whereas the following code will work.
>>
>>
>> :- lib(dbi).
>> solve(Result) :-
>>
>> session_start("root", "", [], Session),
>> SQL = "SELECT goodsid, goodsname FROM simulator.goodsinfo",
>> Template = goodsinfo1(101, "fdfdfddsdad"),
>> session_sql_query(Session, Template, SQL, Cursor),
>> cursor_all_tuples(Cursor, Result),
>> cursor_close(Cursor),
>> session_close(Session).
>>
>> Please help.
>>
>> 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.
>>
>
> ______________________________________________________________________
> 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.
>

______________________________________________________________________
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 Mon Feb 02 2015 - 01:58:50 CET

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