 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
John T. Dow Guest
|
Posted: Wed Jul 19, 2006 2:21 pm Post subject: QueryDataSet: How to do "trial" query and accept or decline |
|
|
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 |
|
| Back to top |
|
 |
Mehmet F. Erten Guest
|
Posted: Wed Jul 19, 2006 7:01 pm Post subject: Re: QueryDataSet: How to do "trial" query and accept or decl |
|
|
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 (AT) johntdow (DOT) com> wrote in message
news:Xns98053677CC68Cjohnjohntdowcom (AT) 207 (DOT) 105.83.66...
| Quote: | 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 |
|
|
| Back to top |
|
 |
John T. Dow Guest
|
Posted: Wed Jul 19, 2006 8:11 pm Post subject: Re: QueryDataSet: How to do "trial" query and accept or decl |
|
|
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 (AT) mblsoft (DOT) com> wrote in
news:44be3b53$1 (AT) newsgroups (DOT) borland.com:
| Quote: | 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 (AT) johntdow (DOT) com> wrote in message
news:Xns98053677CC68Cjohnjohntdowcom (AT) 207 (DOT) 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
|
|
|
| Back to top |
|
 |
Mehmet F. Erten Guest
|
Posted: Wed Jul 19, 2006 8:32 pm Post subject: Re: QueryDataSet: How to do "trial" query and accept or decl |
|
|
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 (AT) johntdow (DOT) com> wrote in message
news:Xns980571EA9B000johnjohntdowcom (AT) 207 (DOT) 105.83.66...
| Quote: | 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 (AT) mblsoft (DOT) com> wrote in
news:44be3b53$1 (AT) newsgroups (DOT) 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 (AT) johntdow (DOT) com> wrote in message
news:Xns98053677CC68Cjohnjohntdowcom (AT) 207 (DOT) 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
|
|
|
| Back to top |
|
 |
John T. Dow Guest
|
Posted: Wed Jul 19, 2006 9:44 pm Post subject: Re: QueryDataSet: How to do "trial" query and accept or decl |
|
|
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 (AT) mblsoft (DOT) com> wrote in
news:44be507e$1 (AT) newsgroups (DOT) borland.com:
| Quote: | 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 (AT) johntdow (DOT) com> wrote in message
news:Xns980571EA9B000johnjohntdowcom (AT) 207 (DOT) 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 (AT) mblsoft (DOT) com> wrote in
news:44be3b53$1 (AT) newsgroups (DOT) 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 (AT) johntdow (DOT) com> wrote in message
news:Xns98053677CC68Cjohnjohntdowcom (AT) 207 (DOT) 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
|
|
|
| Back to top |
|
 |
Mehmet F. Erten Guest
|
Posted: Wed Jul 19, 2006 10:09 pm Post subject: Re: QueryDataSet: How to do "trial" query and accept or decl |
|
|
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 (AT) johntdow (DOT) com> wrote in message
news:Xns9805818F319CFjohnjohntdowcom (AT) 207 (DOT) 105.83.66...
| Quote: | 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 (AT) mblsoft (DOT) com> wrote in
news:44be507e$1 (AT) newsgroups (DOT) 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 (AT) johntdow (DOT) com> wrote in message
news:Xns980571EA9B000johnjohntdowcom (AT) 207 (DOT) 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 (AT) mblsoft (DOT) com> wrote in
news:44be3b53$1 (AT) newsgroups (DOT) 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 (AT) johntdow (DOT) com> wrote in message
news:Xns98053677CC68Cjohnjohntdowcom (AT) 207 (DOT) 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
|
|
|
| Back to top |
|
 |
John T. Dow Guest
|
Posted: Wed Jul 19, 2006 10:20 pm Post subject: Re: QueryDataSet: How to do "trial" query and accept or decl |
|
|
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 (AT) mblsoft (DOT) com> wrote in
news:44be673f (AT) newsgroups (DOT) borland.com:
| Quote: | 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 (AT) johntdow (DOT) com> wrote in message
news:Xns9805818F319CFjohnjohntdowcom (AT) 207 (DOT) 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 (AT) mblsoft (DOT) com> wrote in
news:44be507e$1 (AT) newsgroups (DOT) 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 (AT) johntdow (DOT) com> wrote in message
news:Xns980571EA9B000johnjohntdowcom (AT) 207 (DOT) 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 (AT) mblsoft (DOT) com> wrote in
news:44be3b53$1 (AT) newsgroups (DOT) 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 (AT) johntdow (DOT) com> wrote in message
news:Xns98053677CC68Cjohnjohntdowcom (AT) 207 (DOT) 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
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|