Thread View: borland.public.jbuilder.database
7 messages
7 total messages
Started by John T. Dow
Wed, 19 Jul 2006 09:21
QueryDataSet: How to do "trial" query and accept or decline
Author: John T. Dow
Date: Wed, 19 Jul 2006 09:21
Date: Wed, 19 Jul 2006 09:21
15 lines
1483 bytes
1483 bytes
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
Re: QueryDataSet: How to do "trial" query and accept or decline
Author: Mehmet F. Erten
Date: Wed, 19 Jul 2006 14:01
Date: Wed, 19 Jul 2006 14:01
29 lines
2216 bytes
2216 bytes
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
Re: QueryDataSet: How to do "trial" query and accept or decline
Author: John T. Dow
Date: Wed, 19 Jul 2006 15:11
Date: Wed, 19 Jul 2006 15:11
54 lines
2517 bytes
2517 bytes
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
>
>
Re: QueryDataSet: How to do "trial" query and accept or decline
Author: Mehmet F. Erten
Date: Wed, 19 Jul 2006 15:32
Date: Wed, 19 Jul 2006 15:32
64 lines
3357 bytes
3357 bytes
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
>>
>>
>
Re: QueryDataSet: How to do "trial" query and accept or decline
Author: John T. Dow
Date: Wed, 19 Jul 2006 16:44
Date: Wed, 19 Jul 2006 16:44
91 lines
3996 bytes
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
>>>
>>>
>>
>
>
>
Re: QueryDataSet: How to do "trial" query and accept or decline
Author: Mehmet F. Erten
Date: Wed, 19 Jul 2006 17:09
Date: Wed, 19 Jul 2006 17:09
108 lines
5003 bytes
5003 bytes
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
>>>>
>>>>
>>>
>>
>>
>>
>
Re: QueryDataSet: How to do "trial" query and accept or decline
Author: 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
>>>>>
>>>>>
>>>>
>>>
>>>
>>>
>>
>
>
>
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads