Monday, 24 April 2017

1/0 should be output as true/false in MySQL and Postman

I have a column named snapshot_push which have the data type tinyint(1) in a table named app_user_has_views in MySQL.

When I insert values I use true/false but it is inserted as 1/0. That is due to the tinyint(1) datatype I know.

When I use SELECT snapshot_push from app_user_has_views it output as 1/0

When I use SELECT IF(snapshot_push = 1, 'true', 'false') as snapshot_push FROM app_user_has_views it produces true/ false in MySQL Workbench.

But in Postman it shows 'true/false' as string because I have used 'true', 'false' in the above mentioned query. I am using mysql-promise and Node JS for connecting the database. I just want to know if there is any other way to show it true/false as values in both Postman and MySQL Workbench ?



via Anijit

No comments:

Post a Comment