Open alanseiden opened 4 years ago
You may still want multiple "plug" sizes, since that constrains the size of the buffer allocated when binding the parameter from the result set. eg. if you have just one procedure that returns a 2GiB LOB, ibm_db2 will try to allocate 2GiB of data for it since that's the max size.
I believe the current code is constrained by the max size of a space pointer (16MiB - 1024) so we could probably just set it to that. You could still end up allocating a much larger buffer than you need, but in a 64-bit process, it shouldn't affect things that much.
Thanks, @kadler. My suggestion/request would be to start with a single-plug-size-UDF as you described above and see if it's "efficient enough." Doing it this way would reduce the learning curve for users and virtually eliminate the user error of selecting a too-small plug size and receiving accidentally truncated output XML. If peformance is acceptable then this technique would simplify calling XMLSERVICE, even to test program calls via straight SQL without a toolkit.
Agreed. Start with the common case and specialize as-needed.
A review of this issue still finds it a worthy endeavor, both to eliminate the impact of driver differences and to make XMLSERVICE easier to call from within SQL queries.
Stored procedures with in/out parameters have served us fairly well, with a few drawbacks:
A user-defined function (UDF) would be well-suited for XMLSERVICE's parameters: multiple in, a single value out. Other advantages:
SELECT xmlservice(internalKey, controlKey, inputXml) as outputXml