SqueakDBX - Mapings from String to specific squeak types in selects
Last updated at 4:03 pm UTC on 7 May 2009
As any sql-driver, OpenDBX return a collection of strings on each row selected. SqueakDBX handles this data converting any supported type into it's Squeak corresponding type, using resultset column description, which is provided in any execution answer.
Currently supported types
|SQL TYPE||Maps to...|
This table is the standard all backends. However, not all backends supports the same SQL types. For example, oracle supports TIMESTAMP but MySQL doesn't (you have to use DATETIME). This is not a SqueakDBX limitation but an openDBX one (or even client libraries). To see which SQL types are supported for a particular backend see http://www.linuxnetworks.de/doc/index.php/OpenDBX/DBMS_Datatypes.
To see how they are mapped you can see DBXPlatform #createDataTypesMap. DBXPlatform has a subclass per backend. Each of this subclasses can override methods.This is one of those methods. See for example, DBXSqlitePlatform #createDataTypesMap.
What happen if you are retrieving a row that has a not supported field?
You will get the error DBXTypeNotSupported with a message like this: 'SqueakDBXError: SqueakDBX: Unsupported data type: UNKNOWN, trying to parse: 2006-01-26 17:15:52'.
Suppose we are in MySQL and the column with value 2006-01-26 17:15:52 is a TIMESTAMP. This is not supported. You must use a DATETIME.
Currently NOT supported types
- Any not ANSI, platform specific type
Large objects support
As you can read above, large objects like CLOB, NCLOB and BLOB are not still supported. However, this is actually not true. OpenDBX has several functions to use a RDBMS. And, it also has another functions to specially manage large objects. But OpenDBX doesn't ALWAYS use those special functions for large objects. It depends on the backend. Some backends need to use those functions, and with others you can just use the standard functions. So, what SqueakDBX actually doesn't support right now are those special functions for large objects. Thus, it doesn't support large objects for the backends that need the special functions. For more information, see http://www.linuxnetworks.de/doc/index.php/OpenDBX/C_API/1.2.
Example: If you see DBXPlatform #createDataTypesMap you will see that CLOB is not supported. But for Sqlite3 you can use the normal functions, so, actually squeakDBX supports that. DBXSqlitePlatform overrides that method and map a CLOB to a String.
For more examples, information and usage, you can see the tests we have related with this. These tests are: DBXTypeTest.