"Williams, Ken" <[EMAIL PROTECTED]>
24/03/2004 09:19 AM

 
        To:     "'Rubens Jr.'" <[EMAIL PROTECTED]>
        cc:     [EMAIL PROTECTED]
        Subject:        RE: [sqlite] Diferent behavior in 2.8.12 and 2.8.13

> That's probably a good idea, but if I were passing a char* to ANY C
> function, not just the SQLite interface routines, I'd be pretty scared 
to
> modify it in a callback before that function is finished running.
> If the function doesn't expect to modify it, it can declare it "const". 
If
> it does expect to modify it, then you shouldn't ALSO modify it. =)

Regardless of whether you expect a function to modify the char* you pass 
it, it's probably bad manners to start fiddling with that string before 
the function is finished. It may simply have not finished processing it, 
yet. It's hardly surprising that sqlite would execute the query in the 
string, perform necessary callbacks, then go looking for a second query. 
Sqlite is designed to handle multiple queries in the same string, each 
separated by a semi-colon.

Sqlite could make a copy of the string as soon as you call it, but that 
would make the common case less efficient to allow for a programming model 
that is at the very least, odd. Reusing a buffer in this way is probably a 
premature optimisation, and is certainly foolhardy when you can't 
guarantee its old incarnation is no longer being used.

Benjamin


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to