CXTPCalendarCustomDataProvider vs raw insertions |
Post Reply |
Author | |
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
Posted: 26 October 2006 at 5:52pm |
Hi!
I'm using the CXTPCalendarControl together with a custom SQLite database. Since I did not know how to use the CXTPCalendarCustomDataProvider interface, I simply inserted all events upon creation. This causes all events to be stored in RAM at all times. My question is; will the CXTPCalendarCustomDataProvider interface somehow improve the performance in my application compared with my current insertion method?
Thanks.
|
|
sserge
Moderator Group Joined: 01 December 2004 Status: Offline Points: 1297 |
Post Options
Thanks(0)
|
Hi,
Yes, the idea of using Custom Data Provider is not to store all events in the memory, but provide them to Calendar control by request. See also an article: http://codejock.com/support/articles/com/calendar/cp_3.asp Let me know if you do have any more questions. -- WBR, Serge |
|
JohnCrenshaw
Groupie Joined: 08 September 2006 Status: Offline Points: 65 |
Post Options
Thanks(0)
|
I have been working on binding a database of my own to the calendar control. It is actually fairly easy and well worth it. Here are the advantages(as I see it) to binding the data: Improved performance, since the database is accessed on an "as needed" basis, rather than loading everything up front. Improved data integrigty, since the datasource is notified of changes to the calendar as they happen, these changes can be sent to the database, eliminating the possibility of data loss from a crash or something. Cleaner code, since loading things up when you start and cleaning them out later certainly requires a couple of ugly loops, something feels much cleaner about responding to a request for events for a certain day and giving them then. Basically, binding the datasource is the "right" way and loading to memory is the "easy" way. Binding will take you a couple of days, but is very easy and well worth it. If you intend for anyone else to ever use this, bind it |
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
Ok, thanks for your information. I will take a closer look on the data provider class.
|
|
sserge
Moderator Group Joined: 01 December 2004 Status: Offline Points: 1297 |
Post Options
Thanks(0)
|
BTW. couple more notes.
CXTPCalendarCustomDataProvider is a default implementation of Custom Data Provider. It is created if you use a connection string: 'Provider=Custom' And its implementation fires notifications for DoXXX virtual functions calls. This is an universal way. It is quite usefull for our ActiveX CalendarControl implementation. But for a C++ you can also create an own class dirived from CXTPCalendarData (or CXTPCalendarCustomDataProvider) and override DoXXX virtual functions and others if needed (like Open, Close ...). In this case just use CXTPCalendarCustomDataProvider as example. Also use CXTPCalendarControl::SetDataProvider(CXTPCalendarData* pDataProvider, BOOL bCloseDataProviderWhenDestroy) method to set data provider. This way looks more convenient for C++. But anyway, you can use any of them if you like it more... -- WBR, Serge |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |