I'm having a problem with function sqlite_exec. I call sqlite_exec with
the followinf SQL query with the SHOW_DATATYPE pragma set ON:
SELECT T0.OBJECTS_ID, T0.OBJECTS_COLTYPE, T0.OBJECTS_OBJTYPE,
T0.OBJECTS_ORIGIN, T0.OBJECTS_DATE, T1.OBJECTS_CONCAT_VALUE
FROM OBJECTS AS T0 LEFT JOIN
      (
         SELECT *
         FROM OBJECTS_CONCAT
         WHERE ( OBJECTS_CONCAT_FIELD_ID = 'OBJECTS_ARTIST' )
      ) AS T1
   ON T1.OBJECTS_ID = T0.OBJECTS_ID
WHERE T0.OBJECTS_DELETED = 0
   AND T0.OBJECTS_ID IN (1,2)
ORDER BY 2 ASC;

When my callback fct is called I get the good column types for all
"T0.*" columns but NULL from the "T1.OBJECTS_CONCAT_VALUE" column type.
I would have understood if the given column was a constant value or the
value returned by a SQL fct call, but this is a direct map of an inner
query column.

I know I could write the query differently, but this query is generated
by C++ code and not hand written. If we alter the code, some more (much
more!) complex queries will either not work or be slow as hell due to
the tedious amount of JOIN and the number of records in each table. By
using inner queries, we found the performance to be much greater and we
understand it may come at the expense of RAM usage. So please no comment
on how I could re-write the query.

If anyone can tell me why sqlite_exec behaves like that, it would be
appreciated.


Simon Berthiaume

Reply via email to