Options

Using a custom UDParser to store binary data

Hey, lately I was trying to develop my own UDParser to load binary data into a varbinary column. Unfortunately the Streamwriter of the JavaAPI do not have any method to pass a binary object. Is there any work around or did I miss something in the documentation?

Comments

  • Options
    Hi Tobias,

    Glad to hear you're trying to write a UDParser!  If it's generally useful, I hope you'll consider sharing or distributing it somehow.

    Regarding binary objects -- the getStringWriter() method can be used on (VAR)BINARY fields as well as VARCHAR fields.  It returns a VString object; VString's copy() method has several overrides, including one that accepts a byte[] as its argument.

    This is admittedly confusing in Java...  The Java API was written to look as similar as possible to the existing C++ API.  In Java, the "string" class is an abstract string; but in C++, the std::string class can be an arbitrary array of bytes.

    Adam
  • Options
    Hello Adam,

    thanks a lot! This is exactly what I searched for the last days.

    Tobias

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file