MS_sqlda value returns "<UNSUPPORTED TYPE>" for NULL column

We're working on a huge project porting all our code from MicroStation V8i SS10 to Connect Edition.

When we extract data from our (Oracle) database, we use something like this:

wchar_t  sql[1000];
CursorID cursor;
MS_sqlda sqldaID;
wcscpy(sql, ...);
mdlDB_openCursorWithID(&cursor, sql);
while (mdlDB_fetchRowByID(&sqldaID, cursor) != QUERY_FINISHED)
{
  ...
}
mdlDB_closeCursorByID(cursor);
mdlDB_freeSQLDADescriptor(&sqldaID);

In case a column value appears to be NULL, the corresponding sqlda.value returns an empty string.

So far so good.

It may occur however that we explicitly need an empty column (for instance, if the query to execute depends on a some other condition). Something like this:

SELECT col_a AS column_1,
       col_b AS column_2,
       ''    AS column_3
FROM   my_table

In that case, sqlda.value[2] returns the string "<UNSUPPORTED TYPE>".

This does not happen in the MicroStation V8i SS10 version.

Am I doing something wrong or is there a way to avoid this?

I know I could check the value of sqlda.type[2]. It appears to be 7 in that case. However, I prefer to avoid this since I would need to verify thousands of queries.

Thanks,

Robert

Parents
  • Hi ,

    The largest changes I see to the MicroStation CONNECT database APIs were with respect to working with wide characters internally and dropping "generic" handling of the DB_RAW (5) case to better support: DB_BINARY(6) and DB_OBJECT(7) use case needs. Both MicroStation V8i SS10 and MicroStation CONNECT calling mdlDB_fetchRowByID() return "<UNSUPPORTED TYPE>" when encountering a column of type DB_OBJECT(7).

    Since I do not know all your use case conditions, here are two possible conditions to test, consider and confirm to help resolve your issue:

    1. If you wish to alias a column type who's data will certainly be NULL and include that in your output results you can consider doing something like this:
      select col1, col2, col3, null as col4 from table;
    2. More often than not, we recommend developers use mdlDB_fetchRowByID for various isolation, flexibility and performance reasons; however it may be worth performing a quick test of your code using the more generic mdlDB_fetchRow() method; since it does not attempt to fill sqlda.value with "<UNSUPPORTED TYPE>.

    HTH,
    Bob



  • Hi Bob,

    First of all, thanks for the reply.

    As far as your suggestion go, I tried the first one (SELECT NULL instead of SELECT '') before but I get the same result. Furthermore, also mdlDB_fetchRow returns <UNSUPPORTED TYPE>.

    I guess I'll have to implemented something like this:

    wcscpy(column_value, (sqlda.type[0] == 7) ? L"" : sqlda.value[0]);

    Bye,

    Robert

Reply Children
No Data