🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.database
Article #220

Re: QueryDataSet: How to do "trial" query and accept or decline

#220
From: John T. Dow
Date: Wed, 19 Jul 2006 16:44
91 lines
3996 bytes
Ok, I added these two statements:

    actualqds = new QueryDataSet();
    actualqds.setQuery(...);

and it works in that it seems to restore everything.

But what if the user doesn't want to restore the qds because he likes the 
new result? To use the newly created qds instead of the original, it is 
necessary to clone all aspects of the original, including columns, the 
resolver, update mode, listeners. I am writing a generic method so this is 
not a trivial task.

I was looking for a technique that wouldn't require recreating every detail 
of the original qds. I was hoping to continue using the original qds and 
just restore the query string and the results of executing it.

John


"Mehmet F. Erten" <mehmet_erten@mblsoft.com> wrote in
news:44be507e$1@newsgroups.borland.com: 

> You must renew the QueryDataSet otherwise it also points the one in
> the hashmap.
> Otherwise it will work; I use this logic many times and works.
> 
> actualqds= new QueryDataSet(with the new Query String).
> Before modifying with any new querystring.
> 
> "John T. Dow" <john@johntdow.com> wrote in message 
> news:Xns980571EA9B000johnjohntdowcom@207.105.83.66...
>> Thanks for the suggestion, which I tried. Unfortunately it's not
>> working. 
>>
>> Before changing the query string, I did this:
>>
>>    HashMap saveqds = new HashMap();
>>    saveqds.put("SAVE", actualqds);
>>
>> When wanting to revert to the original, I did this:
>>
>>    actualqds = (QueryDataSet) saveqds.get("SAVE");
>>
>> Having done this, the query string has not reverted and the row count
>> remains 0.
>>
>> John
>>
>>
>>
>>
>> "Mehmet F. Erten" <mehmet_erten@mblsoft.com> wrote in
>> news:44be3b53$1@newsgroups.borland.com:
>>
>>> Hi,
>>> Try this.
>>>
>>> hasmap or treemap myMap
>>> myMap.put("OLD", currentQueryDataSet)
>>> currentQueryDataSet = new QueryDataSet(with the new Query String).
>>> If you don't like it. (if getRowCouunts == 0)
>>> currentQueryDataSet = (QueryDataSet) myMap.get("OLD");
>>>
>>> "John T. Dow" <jo
>>> hn@johntdow.com> wrote in message
>>> news:Xns98053677CC68Cjohnjohntdowcom@207.105.83.66...
>>>> Is it possible to change a querydataset's query string and execute
>>>> the query, and then revert to the original query string with the
>>>> original rows and cursor position without having to reexecute with
>>>> the original query string?
>>>>
>>>> I have an application where the user can easily create new queries
>>>> on the fly. As I have developed it so far, if the user tries a new
>>>> query, he loses
>>>> the old. I would like to be able to revert to the old query, for
>>>> example if
>>>> the new query fails to find any rows.
>>>>
>>>> Is it possible to do something clever like saving the original
>>>> QueryProvider? Can you clone the entire qds, change the query
>>>> string etc, and then if you like the outcome substitute the new qds
>>>> for the old?
>>>>
>>>> John
>>>
>>>
>> 
> 
> 
> 
Technical Details
Message-ID: <Xns9805818F319CFjohnjohntdowcom@207.105.83.66>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newscon06.news.prodigy.com!newscon02.news.prodigy.com!prodigy.net!news-out.superfeed.net!sp6iad.superfeed.net!in2.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <Xns98053677CC68Cjohnjohntdowcom@207.105.83.66> <44be3b53$1@newsgroups.borland.com> <Xns980571EA9B000johnjohntdowcom@207.105.83.66> <44be507e$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 1073da,3b0213ebece65c18
X-Google-Attributes: gid1073da,public
X-Google-Language: ENGLISH,ASCII-7-bit
Subject: Re: QueryDataSet: How to do "trial" query and accept or decline
From: "John T. Dow" <john@johntdow.com>
Date: 19 Jul 2006 09:44:08 -0700
Message-ID: <Xns9805818F319CFjohnjohntdowcom@207.105.83.66>
References: <Xns98053677CC68Cjohnjohntdowcom@207.105.83.66> <44be3b53$1@newsgroups.borland.com> <Xns980571EA9B000johnjohntdowcom@207.105.83.66> <44be507e$1@newsgroups.borland.com>
Lines: 92
NNTP-Posting-Host: 151.201.53.226
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newscon06.news.prodigy.com!newscon02.news.prodigy.com!prodigy.net!news-out.superfeed.net!sp6iad.superfeed.net!in2.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
Newsgroups: borland.public.jbuilder.database
X-Trace: newsgroups.borland.com 1153327448 151.201.53.226 (19 Jul 2006 09:44:08 -0700)
User-Agent: Xnews/5.04.25