Environment: VC6 SP4, Windows 98, 2000
In my last project I had to implement transparent access (via ADO) to huge dataset that had more than 2,700,000 rows (it is displayed on the image above). This table was located on MS SQL Server 6.5 and had size 1.9 GB. I was attempting to use virtual CListCtrl, dynamic cursors, static cursors, multithreading, etc, etc. Really nothing could help me. Response time was endless, or server was hung up because of too heavy loading.
So I made this CTableView class. Access was implemented with really good response time (server platform was very modest - PPro/256MB/SCSI). The CTableView class is derived from CListView and implements simple sequential dataset access algorithm (which can be found in file TableView.cpp, section "Grid engine"). Seeking through dataset is also available. Class dynamically creates corresponding SELECT statements. These statements is used for retrieving data from your dataset. CTableView dynamically inserts these data into embedded CListCtrl and deletes the obsolete data from it. So CListCtrl is not virtual and contains only the items that are visible in the window. Class doesn't use any sizeable internal cache (only tiny map-type collection).
Scrolling through dataset is implemented by scrollbar's substitution - "iterator bar". Really it is right-aligned vertical toolbar with six buttons. Rejection of scrollbar caused by the features of the sequential dataset access.
Of course, for normal response time your dataset (table) MUST be indexed (see documentation).If you will need to solve similar problems then pay your attention to this class. Maybe it really can help you.
All the documentation is located in file TableView.rtf. I was trying to make documentation as clear as possible, but in some topics it is not enough comprehensible. You may have questions after reading about "ORDER BY value", etc. Please look at example on the last page of the documentation. Then you will make all these questions clear as these topics are NOT really complicated, simply I had difficulties when I was describing them. Good luck!
DownloadsDownload demo project (SQLView for MS SQL Server/ADO) - 106 Kb
Download source - 17 Kb