• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
(no subject)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

(no subject)


  • Subject: (no subject)
  • From: Greg Guerin <email@hidden>
  • Date: Tue, 7 Apr 2009 11:49:42 -0700

Тимофей Даньшин wrote:

[string2 release];
sqlite3_reset(sentence_insert_statement);

I'm looking more closely at the code, and those statements seem mis- ordered to me.


I would not release something if someone else (sqlite, in this case) might be holding onto a reference to a buffer that's inside that thing.

This order seems safer:

sqlite3_reset(sentence_insert_statement);
[string2 release];

Or even move the release later, before it returns.


if (sqlite3_prepare_v2(db, sql, -1, &sentence_insert_statement, NULL) != SQLITE_OK)

It may or may not be relevant, but if this fails, it logs a message, then continues with the remainder of the method, rather than returning. Probably not what you want.



sqlite3_bind_int(sentence_insert_statement, 2, string.length);

Is the expression string.length correct here? I would think the correct length should be from the utf8 C string, probably using strlen ().



Finally, what is the value of 'success'? Does it indicate success or an error condition?


  -- GG

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
This email sent to email@hidden


  • Prev by Date: Re: Core data migration question
  • Next by Date: Re: SQLite and Unicode
  • Previous by thread: Re: Check box to indicate more than 2 states
  • Next by thread: (no subject)
  • Index(es):
    • Date
    • Thread