I'm not an objective C expert (or even amateur) -- but it looks to me like your 
use inside the function call is not setting anything in the object but appears 
to be a cast.
 
So your old success would completely depend on the behavior of the memory 
allocator and garbage collector and how it reuses things. 
 
Isn't this:
    sqlite3_bind_text(statement, 3, [self.lemmaRicerca
cStringUsingEncoding:NSUTF8StringEncoding], [self.lemmaRicerca
lengthOfBytesUsingEncoding:NSUTF8StringEncoding], SQLITE_STATIC);

Saying "return self.lemmaRicerca as a cString..."  and not "set 
self.lemmaRicerca..."
So it would be out-of-scope outside the function call as you can't reference 
the UTF8 format again, correct?
 
 
Michael D. Black
Senior Scientist
Advanced Analytics Directorate
Northrop Grumman Information Systems
 

________________________________

From: sqlite-users-boun...@sqlite.org on behalf of Dario Napolitano
Sent: Tue 8/17/2010 5:48 AM
To: General Discussion of SQLite Database
Subject: EXTERNAL:Re: [sqlite] EXTERNAL: Record corruption on Mac OS X 
10.6(SnowLeopard)



Il 17/08/2010 11.21, Dan Kennedy ha scritto:
>> I'm using SQLITE_STATIC since the memory buffer returned by
>> cStringUsingEncoding should be valid until the object is deallocated,
>> which doesn't happen until after the statement is executed.
>>    
> You could try using SQLITE_TRANSIENT instead to verify this.
>  

I tried and it did indeed fix the issue. Since I'm not deallocating any
memory however this means that the garbage collector is. This conflicts
with the Apple documentation, that states that the buffer provided by
NSString objects should persist until the owner object itself is
deallocated... This apparently is not the case in Snow Leopard, or they
have changed something else that broke it.

Thanks for the help!


_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to