Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Calendar
  New Posts New Posts RSS Feed - CXTPCalendarCustomDataProvider vs raw insertions
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

CXTPCalendarCustomDataProvider vs raw insertions

 Post Reply Post Reply
Author
Message
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Topic: CXTPCalendarCustomDataProvider vs raw insertions
    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.
Back to Top
sserge View Drop Down
Moderator Group
Moderator Group


Joined: 01 December 2004
Status: Offline
Points: 1297
Post Options Post Options   Thanks (0) Thanks(0)   Quote sserge Quote  Post ReplyReply Direct Link To This Post Posted: 27 October 2006 at 3:02am
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
Back to Top
JohnCrenshaw View Drop Down
Groupie
Groupie
Avatar

Joined: 08 September 2006
Status: Offline
Points: 65
Post Options Post Options   Thanks (0) Thanks(0)   Quote JohnCrenshaw Quote  Post ReplyReply Direct Link To This Post Posted: 27 October 2006 at 9:41am

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

Back to Top
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Posted: 27 October 2006 at 7:39pm
Ok, thanks for your information. I will take a closer look on the data provider class.
Back to Top
sserge View Drop Down
Moderator Group
Moderator Group


Joined: 01 December 2004
Status: Offline
Points: 1297
Post Options Post Options   Thanks (0) Thanks(0)   Quote sserge Quote  Post ReplyReply Direct Link To This Post Posted: 28 October 2006 at 10:47am
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
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.125 seconds.