SqueakDBX - Special options
Last updated at 11:41 pm UTC on 4 April 2009
SqueakDBX supports special options that are associated to a connection. Most of them must be enable after the connect, but before the open. The special options are: multistatments queries, compression, encrypting, paged results and mysql modes.
The problem is that not all database supports all these features. So, before trying to enable an option, you must check the current RDBMS associated with the connection, supports that option. Here are some examples:
result := conn enableMultipleStatements.
[ conn open.
Transcript show: 'MultipleStatments supported'; cr.
self shouldnt: (conn execute: 'select nombre from alumno; select nombre from alumno;') raise: Error ].
[ conn open.
Transcript show: 'MultipleStatments doesnt supported'; cr.
self should: (conn execute: 'select nombre from alumno; select nombre from alumno;') raise: Error ].
When you do conn enableXXX, this method will check if the current RDBMS supports the feature XXX and will return true or false. If true, XXX feature is supported and you can use it. If false, it is not supported and you cannot use it. Take into consideration that this depends on lots of things: database backend, version, and so on.
For more examples you can see DBXOptionTest.
You must call DBXConnection #enableCompression. Compressed network traffic between database client and server. This can maximize the throughput if the network is the bottleneck.
You must call DBXConnection #enableEncryption.
You must call DBXConnection #enableMultipleStatements. This let you execute multiples queries on one single query.
All database servers and client libraries are able to transfer the records row by row. Some of them can also transfer multiple rows or even all at once to minimize server load, network traffic and latency. The downside of this is an increased memory consumption.
After enabling this feature you will be able to use DBXConnection #execute: aString querySettings: aQuerySettings
For more examples, information and usage, you can see the tests we have related with this. These tests are: DBXOptionsTest.