ZQuery RefreshCurrentRow
ZQuery RefreshCurrentRow
Hello,
I am developing under Delphi. In my application, there are a ZQuery1 and a ZQuery2.
the role of this ZQuery2 is to update the ZQuery1. To display the changes to the user of my application, I have to go through "ZQuery1 .Refresh".
The ZQuery2 contains 300000 records, so it takes several seconds to display these changes.
I want to display only the update of row without going through a "refresh" of the ZQuery2 .
I saw that there is the property "RefreshCurrentRow". I wrote :
"ZTable1.RefreshCurrentRow (FALSE);"
But, there is no visible change.
- ZQuery1 SQL (Select... From...).
- ZQuery2 SQL (Update... Set...).
How to display the update of a one row of a ZQuery1 please?
Thank you
Delphi + ZEOSDBO-7.2.4-stable.
I am developing under Delphi. In my application, there are a ZQuery1 and a ZQuery2.
the role of this ZQuery2 is to update the ZQuery1. To display the changes to the user of my application, I have to go through "ZQuery1 .Refresh".
The ZQuery2 contains 300000 records, so it takes several seconds to display these changes.
I want to display only the update of row without going through a "refresh" of the ZQuery2 .
I saw that there is the property "RefreshCurrentRow". I wrote :
"ZTable1.RefreshCurrentRow (FALSE);"
But, there is no visible change.
- ZQuery1 SQL (Select... From...).
- ZQuery2 SQL (Update... Set...).
How to display the update of a one row of a ZQuery1 please?
Thank you
Delphi + ZEOSDBO-7.2.4-stable.
-
- Platinum Boarder
- Posts: 1956
- Joined: 17.01.2011, 14:17
Re: ZQuery RefreshCurrentRow
Hello Bill,
why don't you just do the changes in ZQuery1?
This way ZQuer1 always will know the current state of the record?
Best regards,
Jan
why don't you just do the changes in ZQuery1?
Code: Select all
ZQuery1.Edit;
ZQuery1.FieldByName('foo').AsString := myStringValue;
ZQuery1.FieldByName('bar').AsInteger := MyIntegerValue;
ZQuery1.Post;
Best regards,
Jan
Re: ZQuery RefreshCurrentRow
Hmm, how did you manage to execute this method? I receive "The refreshrow method is only supported with an update object." with query as well as table.
Anyway +1 for trying to implement this method, it could be very useful.
Anyway +1 for trying to implement this method, it could be very useful.
Re: ZQuery RefreshCurrentRow
Hello,
I thank you for your answer.
- marsupilami:
yes, your code does the job but I do not want to go through:
"Edit" and after "Post" because my application works on LAN and many users are connected to it, and for not having much charge in the LAN.
- Fr0sT :
I execute this method : TQuery (with "OpdateObjet" propriety to "ZUpdateSQL") + ZUpdateSQL.
This is normally compiled but, there is no refresh of the Query.
Best regards.
Bill
I thank you for your answer.
- marsupilami:
yes, your code does the job but I do not want to go through:
"Edit" and after "Post" because my application works on LAN and many users are connected to it, and for not having much charge in the LAN.
- Fr0sT :
I execute this method : TQuery (with "OpdateObjet" propriety to "ZUpdateSQL") + ZUpdateSQL.
This is normally compiled but, there is no refresh of the Query.
Best regards.
Bill
Re: ZQuery RefreshCurrentRow
That's weird, things should work. More to say, from the 1st sight I see no reasons why this couldn't work even without UpdateObjectBill74 wrote:I execute this method : TQuery (with "OpdateObjet" propriety to "ZUpdateSQL") + ZUpdateSQL.
This is normally compiled but, there is no refresh of the Query.
Re: ZQuery RefreshCurrentRow
Hi,
Is there a way to fetch only one row from database?
I tried RefreshCurrentRow - with error quoted by Fr0sT.
I would like to avid Edit...Post dataset update method since this post data back to DB and i need to avoid this.
Best regards,
Marek
Is there a way to fetch only one row from database?
I tried RefreshCurrentRow - with error quoted by Fr0sT.
I would like to avid Edit...Post dataset update method since this post data back to DB and i need to avoid this.
Best regards,
Marek
-
- Platinum Boarder
- Posts: 1956
- Joined: 17.01.2011, 14:17
Re: ZQuery RefreshCurrentRow
Hello Marek,
this seems like a job for CachedUpdates? Or is there anything I didn't understand?
Best regards,
Jan
this seems like a job for CachedUpdates? Or is there anything I didn't understand?
Best regards,
Jan
Re: ZQuery RefreshCurrentRow
Jan,
I've got editable grid with a lot rows - 30k+
After editing one row Postgresql trigger changes data on other rows (5 to 10 rows).
Application is then notified of changed rows id's.
I need to fetch data for these rows from DB.
Edit() ... Post() method is sending data to DB again, and i want to avoid it.
Is there a way to change data in TZQuery without sending it to DB?
Ideal would be for me to perform RefreshCurrentRow on each of rows that i need to fetch data from DB.
Best regards,
Marek
I've got editable grid with a lot rows - 30k+
After editing one row Postgresql trigger changes data on other rows (5 to 10 rows).
Application is then notified of changed rows id's.
I need to fetch data for these rows from DB.
Edit() ... Post() method is sending data to DB again, and i want to avoid it.
Is there a way to change data in TZQuery without sending it to DB?
Ideal would be for me to perform RefreshCurrentRow on each of rows that i need to fetch data from DB.
Best regards,
Marek
-
- Platinum Boarder
- Posts: 1956
- Joined: 17.01.2011, 14:17
Re: ZQuery RefreshCurrentRow
Hello Marek,
I am sure, you know that keeping 30k+ rows in a GUI application is usually seen to be bad practice?
Anyway. Currently this will only work using an TZUpdateSQL object. Drop it next to your dataset. Link it and fill out the properties for ModifySQL, DeleteSQL and InsertSQL and for RefreshSQL. Then start praying
Background for others: Currently the method RefreshCurrentRow of the TZGenericCachedResolver will always throw an exception. The only way to circumvent this is the use of the TZUpdateSQL object. A better logic would be nice but we don't have it currently. Ticket #262 tracks this feature request.
Best regards,
Jan
I am sure, you know that keeping 30k+ rows in a GUI application is usually seen to be bad practice?
Anyway. Currently this will only work using an TZUpdateSQL object. Drop it next to your dataset. Link it and fill out the properties for ModifySQL, DeleteSQL and InsertSQL and for RefreshSQL. Then start praying
Background for others: Currently the method RefreshCurrentRow of the TZGenericCachedResolver will always throw an exception. The only way to circumvent this is the use of the TZUpdateSQL object. A better logic would be nice but we don't have it currently. Ticket #262 tracks this feature request.
Best regards,
Jan
Re: ZQuery RefreshCurrentRow
Jan,
In this case rows number is varied, based on parameters that user supplies...
Anyway i've used TZUpdateSQL but in selective way:
i suppky only RefreshSQL to it, and attach it to ZQuery in ZQuery->AfterPost.
Then i locate each ID i neet to refresh, and call ZQuery->RefreshCurrentRow(false).
After refreshing all rows that i need i detach ZUpdateSQL from ZQuery
And it works:)
Best regards,
Marek
In this case rows number is varied, based on parameters that user supplies...
Anyway i've used TZUpdateSQL but in selective way:
i suppky only RefreshSQL to it, and attach it to ZQuery in ZQuery->AfterPost.
Then i locate each ID i neet to refresh, and call ZQuery->RefreshCurrentRow(false).
After refreshing all rows that i need i detach ZUpdateSQL from ZQuery
And it works:)
Best regards,
Marek