Christoph,
> The behavior stems from the fact that when
> SQLite3Result::fetchArray() is called, it is first checked
> whether the related stmt_obj is initialised[1]. When
> SQLite3Stmt::close() is called, the stmt_obj is, however,
> destroyed[2], so the warning is raised[3].
Thanks for this specific answer.
> Of course, it would be possible to check for existing results, and to
> not close the statement when ::close() is called (maybe raising a
> notice/warning) in this case,
That is what happens with COM/OCX objects: a reference count is incremented
when a dependant "child" object is created, and decremented when such a
"child" object is destroyed. And an object ofcourse only gets destroyed
when that reference (dependancy) count reaches Zero.
>but that would require the programmer to call
> SQLite3Result::finalize() before calling SQLite3Stmt::close(),
> what appears to be too tedious.
Well, calling $statement->close() seems to be rather normal, so why would
$result->close() than suddenly be tedious ?
Also, the object could be auto-closing when all data is read. Furthermore,
currently it looks like the $statement->close() does actually also close (in
a way) the $result (enumerator), but without actually releasing it (which I
would consider to be a "bad thing") ...
And that makes me wonder: who does actually take care of releasing the
$results objects resources still there when $statement object is
closed/destroyed ? Shouldn't I be prepared to do that anyway ? (note to
self: check if $restults->close() or something similar exists)
And no, in case of a COM/OCX object with its reference count the "parent"
object can be told to terminate before all its "childs" are closed. It
will ofcourse not actually *do* so until the above-mentioned reference count
reaches zero (though variable holding the object reference will (/should)
get set to NULL).
> It might have been best not to offer SQLite3Stmt::close() in the
> first place, and simply close the statement when the statement
> object will be destroyed (as it's done by PDO),
That could, in circumstances, create a problem. Although its a good idea
to have the language destroy an object when it scope ends, there might be
cases where destroying an object before that might be a good idea.
> but removing the close() method now would cause major
> BC issues, so that doesn't appear to be an option.
In that case just do what MS always does in cases like that: keep the
method, but just don't let it actually *do* anything. :-)
> I didn't suggest that this is a bug, but rather a *doc*
> bug, i.e. something important that the documentation
> is missing.
Ackkk... I misunderstood. Yep, that could be considered a bug too.
Thanks.
Just one request: please do not shift the blame to me when the documentation
has been available all this time. :-D
Regards,
Rudy Wieser
-- Origional message:
nkr1i3$av4$1...@solani.org...
> On 27.06.2016 at 11:44, R.Wieser wrote:
>
> > Christoph M. Becker <
cmbec...@arcor.de> schreef in berichtnieuws
> > nkponn$fii$1...@solani.org...
> >
> >> I presume you mean something like: [snip]
> >
> > Something like that, but instead of INSERTing I was SELECTing data. [.]