From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
|
我使用MySQL來將我的資料寫至資料庫中。當我將一個True的布林值寫至資料庫後,若我使用database viewer來查看這個值,其值會顯示為-1。為什麼會有這樣的現象呢?
MySQL的設計並不支援布林的資料型態。然而,在將來的版本中MySQL將會支援這種資料型態。
簡單來說,True的布林值會顯示成-1的緣故是因為MySQL將其解讀成一個signed integer,且所有的位元皆為1。Signed integer的範圍為 -2147483648 到 2147483647。若所有的位元皆為1,則其值為-1。當你從資料庫讀取這樣的數值時你就會收到"true"的顯示,這是因為在TestStand中一個非零整數都會被解讀成是一個true的布林值。
|