Hi,

We add a few nice features to our SQL Plugin to make live easier.

see
http://www.mbs-plugins.de/archive/2016-08-25/Upcoming_Changes_for_our_SQL_P/monkeybreadsoftware_blog_xojo



>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.


Sincerely
Christian

-- 
Read our blog about news on our plugins:

http://www.mbsplugins.de/

_______________________________________________
Mbsplugins_monkeybreadsoftware.info mailing list
[email protected]
https://ml01.ispgateway.de/mailman/listinfo/mbsplugins_monkeybreadsoftware.info

Reply via email to