On 15 Mar 2018, at 4:43pm, Pavan Paolo <pavan.pa...@genomnia.it> wrote:

> I use in a view the following snip of code to force the results to be 
> considered as Boolean:

SQLite does not have a BOOLEAN type.  If you use the word BOOLEAN where it 
expects to see a type name it will use an affinity of NUMBER.  See sections 2.1 
and 3.1.1 of

<https://www.sqlite.org/datatype3.html>

> I need this solution since in this way I can detect in java the Boolean data 
> type by querying the ResultSet metadata rs.getMetaData().getColumnType() and 
> trigger a proper visualization in a table.

I presume you want to display the words 'TRUE' or "FALSE' rather than a number.

It's possible, with a lot of work, to figure out whether the columns in a table 
were defined as having type BOOLEAN.  IF you want to do this tell us and we'll 
tell you how.  However, if you are doing a calculation in a SELECT like

    SELECT name,(membershipType == 'y') FROM Members

The values returned will be 0 or 1 and there will be no way to tell that SQLite 
did a boolean calculation to return that result.

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to