PDO already has support for large objects (LOBs)[1]. I don't know if
and how these are supported by the pdo_sqlite driver, but wouldn't it
make sense to use the existing API instead of introducing a new
method?
[1] <http://www.php.net/manual/en/pdo.lobs.php>
Very interesting indeed, didn't know about that feature, I was
expecting the creation of a new method was the only way, as this was
the way PGSQL was doing it.
There's even a bug report about it:
https://bugs.php.net/bug.php?id=57691
I will look into that next week and see if it can fit and replace my
RFC
then.
OK, I took some time to look into that feature and the fact is that it
doesn't work at all currently with SQLite, it is not returning a
resource handle but a string, and it is consuming a large amount of
memory as it is just dumping the LOB in memory. The code seems to be
there to handle it though so I don't know what's going on, if the person
who implemented that could come forward and tell me more about the
implementation.
But I tried it and it doesn't cover one of the use of openBlob that I
have which is to open, read, and write at the same time.
The current way it's done in PDO is that you can either fetch a LOB from
a result of a query and read from it, or bind a file resource handler to
a statement for writing, but you cannot open a LOB, read from it and
write from it without performing a query.
So for me the use case is quite different here, and openBlob allows
stuff that PDO::PARAM_LOB with bindColumn and bindParam cannot allow
currently. In conclusion openBlob is still useful as it allows accessing
a BLOB outside of a statement and allows to read and write at the same
time without having to load the blob in memory.
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php