Article View: borland.public.jbuilder.database
Article #222Re: QueryDataSet: How to do "trial" query and accept or decline
From: John T. Dow
Date: Wed, 19 Jul 2006 17:20
Date: Wed, 19 Jul 2006 17:20
126 lines
5517 bytes
5517 bytes
I can't copy statements from jbinit because it's a generic, library
method which has to learn everything at runtime. I have experimented with
get/setmetadataupdate and a couple other properties but haven't yet
looked into copying the listeners. It's looking like too big a project
for the payoff. (The simple solution is to restore the original query
string and reexecute it; the drawback is that it might be slow, depending
on the query.)
John
"Mehmet F. Erten" <mehmet_erten@mblsoft.com> wrote in
news:44be673f@newsgroups.borland.com:
> If the user is not modifying your QueryDataSet attributes,
> it should be a simple method to create the new QueryDataSet with all
> the attributes you wish to have.
> For the setColumns you can use copycolone option.
> The rest it just set statements from jbinit.
>
> if the old query has some user selected attributes, you can copy them
> from it just retrieve the old querydataset with a new name and
> get/set.
>
> Nothing is trivial until it is functional for your purpose.
> But who creates the method you need is another story.
>
>
> "John T. Dow" <john@johntdow.com> wrote in message
> news:Xns9805818F319CFjohnjohntdowcom@207.105.83.66...
>> 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:
<Xns980587BD965F0johnjohntdowcom@207.105.83.66>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!transit3.readnews.com!news-out.readnews.com!news-out.nntp.be!sp6iad.superfeed.net!in2.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<Xns98053677CC68Cjohnjohntdowcom@207.105.83.66> <44be3b53$1@newsgroups.borland.com> <Xns980571EA9B000johnjohntdowcom@207.105.83.66> <44be507e$1@newsgroups.borland.com> <Xns9805818F319CFjohnjohntdowcom@207.105.83.66> <44be673f@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 10:20:35 -0700 Message-ID: <Xns980587BD965F0johnjohntdowcom@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> <Xns9805818F319CFjohnjohntdowcom@207.105.83.66> <44be673f@newsgroups.borland.com> Lines: 127 NNTP-Posting-Host: 151.201.53.226 Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!transit3.readnews.com!news-out.readnews.com!news-out.nntp.be!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 1153329635 151.201.53.226 (19 Jul 2006 10:20:35 -0700) User-Agent: Xnews/5.04.25