Redian新闻
>
[转载] Question 1: refresh view of database?
avatar
[转载] Question 1: refresh view of database?# Java - 爪哇娇娃
j*1
1
【 以下文字转载自 Complain 讨论区 】
发信人: mitbbs (未名空间), 信区: Complain
标 题: Re: [投诉]TrustinJesus版主Dignity两天之内狂删我19篇主题帖
发信站: BBS 未名空间站 (Tue Jun 28 02:58:38 2011, 美东)
由于版内炸版,会引起误删。版主可恢复其误删的帖子
avatar
c*t
2
【 以下文字转载自 Database 讨论区 】
【 原文由 coconut 所发表 】
I have a table view of a table. Since that table is being updated
sometimes in the background and needs to refresh the display. However
I wish to view the table w/o getting the complete full table each time.
What are the things to consider.
BTW, I use JDBC-ODBC bridge driver.
Thanks
avatar
B*z
3
add a new column Modified default to 0
write a store procedure to retrieve only record with Modified!=0
and set the value to 0 in the same transaction
now you only get records that are changed,compare the changed record
with the records you have in memory by primary key, update the values
accordingly. If you can not find the changed record in memroy, that
means it's a newly added record.
to catch deleted record,you might need to another column Deleted default
to 0, when it needs to be

【在 c*****t 的大作中提到】
: 【 以下文字转载自 Database 讨论区 】
: 【 原文由 coconut 所发表 】
: I have a table view of a table. Since that table is being updated
: sometimes in the background and needs to refresh the display. However
: I wish to view the table w/o getting the complete full table each time.
: What are the things to consider.
: BTW, I use JDBC-ODBC bridge driver.
: Thanks

avatar
c*t
4
Wow! Understood. Thank you.

【在 B**z 的大作中提到】
: add a new column Modified default to 0
: write a store procedure to retrieve only record with Modified!=0
: and set the value to 0 in the same transaction
: now you only get records that are changed,compare the changed record
: with the records you have in memory by primary key, update the values
: accordingly. If you can not find the changed record in memroy, that
: means it's a newly added record.
: to catch deleted record,you might need to another column Deleted default
: to 0, when it needs to be

avatar
z*g
5
If you are using the 3-tier structure, which the table view is not
directly get data from the database, instead from a business object.
ane the business object talk to the database.
You could add a listener in the business object, when you update your
business object, update your table view.

【在 B**z 的大作中提到】
: add a new column Modified default to 0
: write a store procedure to retrieve only record with Modified!=0
: and set the value to 0 in the same transaction
: now you only get records that are changed,compare the changed record
: with the records you have in memory by primary key, update the values
: accordingly. If you can not find the changed record in memroy, that
: means it's a newly added record.
: to catch deleted record,you might need to another column Deleted default
: to 0, when it needs to be

avatar
m*t
6

Couldn't he just figure out which records are deleted by comparing
the result set with those he has got on display?

【在 B**z 的大作中提到】
: add a new column Modified default to 0
: write a store procedure to retrieve only record with Modified!=0
: and set the value to 0 in the same transaction
: now you only get records that are changed,compare the changed record
: with the records you have in memory by primary key, update the values
: accordingly. If you can not find the changed record in memroy, that
: means it's a newly added record.
: to catch deleted record,you might need to another column Deleted default
: to 0, when it needs to be

avatar
B*z
7
that's what s/he wants to avoid

【在 m******t 的大作中提到】
:
: Couldn't he just figure out which records are deleted by comparing
: the result set with those he has got on display?

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。