[ 
https://issues.apache.org/jira/browse/GROOVY-7082?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

John Wagenleitner closed GROOVY-7082.
-------------------------------------
    Resolution: Not A Bug

Closing this as not a bug since it is a documented feature of the MySQL driver. 
 Thanks for providing the reference [~grivas].

> groovy.sql: TINYINT(1) returns boolean instead of numeric
> ---------------------------------------------------------
>
>                 Key: GROOVY-7082
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7082
>             Project: Groovy
>          Issue Type: Bug
>            Reporter: Gordon Myers
>
> I have a column in MySQL that is TINYINT(1) and is used for storing the 
> ISO-8601 "day of week" (i.e. an integer in the range 1 to 7). However, when I 
> run a simple SELECT query using groovy.sql, it always comes back as a boolean 
> true. I don't want groovy typecasting my TINYINT(1) to a boolean. Is this a 
> bug or just a (mis)configuration option?
> Example:
> {code}
> /*
> -- Sample table structure
> CREATE TABLE `records` (`dayOfWeek` TINYINT(1) UNSIGNED NOT NULL, PRIMARY KEY 
> (`dayOfWeek`));
> INSERT INTO `records` (`dayOfWeek`) VALUES (1), (2), (3);
> */
> final String query = "SELECT `dayOfWeek` FROM `records`"
> final results = groovySql.rows(query)
> --> returns true; true; true in Groovy
> --> should return 1; 2; 3
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to