InterviewSolution
| 1. |
How Do You Insert Booleans Into A Mysql Database, Pdi Encodes A Boolean As ‘y’ Or ‘n’ And This Can’t Be Insert Into A Bit(1) Column In Mysql.? |
|
Answer» BIT is not a standard SQL data type. It’s not even standard on MySQL as the meaning (core definition) CHANGED from MySQL version 4 to 5. Also a BIT USES 2 bytes on MySQL. That’s why in PDI we made the SAFE choice and went for a CHAR(1) to store a boolean. There is a simple workaround available: change the data type with a Select Values step to “INTEGER” in the metadata tab. This converts it to 1 for “true” and 0 for “false”, just like MySQL expects. BIT is not a standard SQL data type. It’s not even standard on MySQL as the meaning (core definition) changed from MySQL version 4 to 5. Also a BIT uses 2 bytes on MySQL. That’s why in PDI we made the safe choice and went for a char(1) to store a boolean. There is a simple workaround available: change the data type with a Select Values step to “Integer” in the metadata tab. This converts it to 1 for “true” and 0 for “false”, just like MySQL expects. |
|