Re: release static pointers
It looked like a good tutorial :) Thanks, I'll check better the Apple way. Cheers, chr On Mon, Jan 26, 2009 at 1:59 PM, Peter Blazejewicz wrote: > hi Christian, > > On Jan 26, 2009, at 11:25 AM, Christian Giordano wrote: > >> I'm wondering if and how >> the pointer to the statement will be released. In the code samples I >> saw there is no trace of the releasing (in this case, >> sqlite3_finalize(statement)). >> >> This is the example: >> >> http://icodeblog.com/wp-content/uploads/2008/08/9-todom.png > > It looks like you started in wrong place. The sample code is certainly based > on official Apple's sqlite integration sample: > http://developer.apple.com/iphone/library/samplecode/SQLiteBooks/ > (go there, registration for online type of ADC account is free), > which is far more better place to start I think. To finalize statements > there is dedicated class method defined in entity class that gets called > when application is to be closed (in blog sample that could be implemented > as: > @interface ... > +(void)finalizeStatements; > > @implementation > +(void)finalizeStatements > { >if(stmt){ >sqlite3_finalize(stmt); >stmt = NULL; >}; > } > > called as: > > [Todo finalizeStatements] > > from one of controllers. > > regards, > Peter > ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: release static pointers
hi Christian, On Jan 26, 2009, at 11:25 AM, Christian Giordano wrote: I'm wondering if and how the pointer to the statement will be released. In the code samples I saw there is no trace of the releasing (in this case, sqlite3_finalize(statement)). This is the example: http://icodeblog.com/wp-content/uploads/2008/08/9-todom.png It looks like you started in wrong place. The sample code is certainly based on official Apple's sqlite integration sample: http://developer.apple.com/iphone/library/samplecode/SQLiteBooks/ (go there, registration for online type of ADC account is free), which is far more better place to start I think. To finalize statements there is dedicated class method defined in entity class that gets called when application is to be closed (in blog sample that could be implemented as: @interface ... +(void)finalizeStatements; @implementation +(void)finalizeStatements { if(stmt){ sqlite3_finalize(stmt); stmt = NULL; }; } called as: [Todo finalizeStatements] from one of controllers. regards, Peter ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
release static pointers
Hi guys, I'm using sqlite3 library and a common technique is to cache the statement. In some examples I found the statement is set as static in the model which gets instantiated lazily. I'm wondering if and how the pointer to the statement will be released. In the code samples I saw there is no trace of the releasing (in this case, sqlite3_finalize(statement)). This is the example: http://icodeblog.com/wp-content/uploads/2008/08/9-todom.png I'm new to objective-c and sometimes I wonder if when to use static pointers or singletons. Thanks, chr ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com