简体   繁体   English

TClientDataset 编辑一个包含 100k+ 条记录的表

[英]TClientDataset to edit a table with 100k+ records

A client wants to build a worksheet-like application to show data from a database (presumably on a TDbGrid or similar), allowing free search and edition of all cells, as you would do in a worksheet.客户想要构建一个类似工作表的应用程序来显示来自数据库(大概在 TDbGrid 或类似的数据库上)的数据,允许自由搜索和编辑所有单元格,就像在工作表中所做的那样。 Underlying table will have more than 100k rows.底层表将有超过 10 万行。

The problem with using TClientDataset, is that it tends to load all data into memory, violating user requisites, that are these 3:使用 TClientDataset 的问题在于,它倾向于将所有数据加载到内存中,违反用户要求,即以下 3 个:

  1. User will be able navigate from first to last record at any moment using scroll bar, keyboard, or a search filter (note that TClientDataset will load all records if you go to last record, AFAIK...).用户可以随时使用滚动条、键盘或搜索过滤器从第一条记录导航到最后一条记录(请注意,如果您转到最后一条记录,AFAIK...,TClientDataset 将加载所有记录)。

  2. Connection will be through external VPN / internet (possibly slow), so only the actual visible records on screen should be loaded.连接将通过外部 VPN/互联网(可能很慢),因此应加载屏幕上实际可见的记录。 Never all .从来没有

  3. Editions must be kept inside a transaction , so they can be committed or rollbacked at the end, and reconciling if necessary.版本必须保存在事务中,以便在最后提交或回滚,并在必要时进行协调。

Is it possible to accomplish this 3 points using TClientDataset?是否可以使用 TClientDataset 完成这 3 点? If not, what are the alternatives?如果不是,有哪些替代方案?

I'm answering just by your last line regarding alternatives, I can add some suggestions:我只是在你关于替代品的最后一行回答,我可以添加一些建议:

1- You can use some creativity, provide pagination and fetch let's say 100 rows per page using a thread which is equipped with a nice progress bar in the UI. 1-您可以使用一些创造力,提供分页和获取让我们说每页 100 行使用在 UI 中配备了一个很好的进度条的线程。 in this method you must manage search and filters by some smart queries, reloading data sometimes, etc...在这种方法中,您必须通过一些智能查询来管理搜索和过滤器,有时需要重新加载数据等...

2- Use third party components that optimized for this purpose like SDAC + EhLib Dbgrid. 2- 使用为此目的优化的第三方组件,如 SDAC + EhLib Dbgrid。 SDAC is a dataset that can be useful for cache updates and EhDBGrid has a MemTable component inside it which is very powerful, free search, fuzzy match or approximate search work nicely, possible to revert, undo and redo, etc... SDAC 是一个可用于缓存更新的数据集,EhDBGrid 内部有一个 MemTable 组件,它非常强大,免费搜索、模糊匹配或近似搜索工作得很好,可以还原、撤消和重做等...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 SQL Server表有100k记录,2个内部联接非常慢 - SQL Server table with 100k records, 2 Inner Joins Extremely Slow 在一个更新查询中更新100k记录 - Updating 100k records in one update query 通过保留前100条记录从表中删除记录 - Delete records from table by keeping the first 100 records 从数据库中的每个表获取模式+前100条记录 - getting schema + first 100 records from every table in a db 如何编辑数据库文件并在其表之一中插入多个记录? - How to edit DB file and insert multiple records in one of its table? 如何使用包含 100 条记录的表中的每一行的不同值更新表中所有行的列 - how to update a column for all rows in a table with different values for each row in a table of 100 records 我如何限制数据库用户仅访问表的前100条记录 - how can i restrict a database user to only access top 100 records of a table 最佳优化大型SQL Server表(100-200 Mil记录) - Best optimizing for a large SQL Server table (100-200 Mil records) 如何从一个表中为另一个表中的每个唯一记录选择 100 条记录 - How do I select 100 records from one table for each unique record from another 如何生成脚本以从SQL Server 2005中检索每个表的前100个记录 - How to generate script to retrieve schema and only top 100 records from each table from SQL Server 2005
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM