« Save the date for MBS… | Home | MBS FileMaker Plugin … »

Upcoming Changes for our SQL Plugin

From talks with clients, we got a few cool ideas for our SQL Plugin to make live easier or give you more flexibility.

We get some new method overloads for SQLValueMBS to pass MemoryBlocks for various blob field types there as value. So if you have a memoryblock and you pass it, the value is not first converted to a string (a copy of the bytes) and passed to the plugin. Now it passes the memoryblock directly. In general we want to have all plugin functions taking a block of bytes should accept either string or memoryblock to avoid extra conversions.

To quickly get the content of a blob field, you can now use asBLobMemory and asBLobString. Next the Prepare command on SQLDatabaseMBS now returns a SQLPreparedStatementMBS object, so you don't need to cast it anymore. For ODBC, we set the ODBCAddLongTextBufferSpace option now by default to false.

For SQLFieldMBS and SQLParamMBS we add ReadLongOrLob methods so you can read a blob value and have it be written directly to a file (folderitem) or to a stream. For the stream, you can pass any object of a class implementing the Writeable interface. So binary stream is fine as well as a socket, serial port or textoutputstream. This saves you may be a line of code, but it may help people looking for such a method.

For SQLValueMBS class, we added new methods to pass folderitem, memoryblock or Readable interface, e.g. a binarystream. So you can have the plugin stream from a file to a blob field for you from a file.

Next you can pass all parameters as a Dictionary to SQLCommandMBS. Also you can use a dictionary with Bind method in SQLPreparedStatementMBS, too. So if you have data for new record already in dictionaries, you can pass them to SQL commands. With SQLValueMBS you can now set it with a variant.

Now as we can set values for parameters by variant, we detect the type from the variant. So if the variant has a string, we set the parameter to be a string parameter. The auto detection works so well here, that now for prepared statement the binding of a type is optional. So if you bind values to a prepared statement with newer plugin without specifying the actual type, the bind will now work.

There is one thing to note: Passing a memoryblock or a string without a defined encoding, we take it as bytes (BLOB). If you pass text or a string with define encoding, we pass it as a text value. Please make sure you pass either explicit type or you make sure encoding is defined or not.
25 08 16 - 21:07
No comments

Remember personal info?

Emoticons / Textile

Hide email:

Small print: All html tags except <b> and <i> will be removed from your comment. You can make links by just typing the url or mail-address.