Тимофей Даньшин 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 (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

Reply via email to