Dal mio script create table, ho definito il campo hasMultipleColors come un po ':MySQL valori sempre tornare altrettanto vuote
hasMultipleColors BIT NOT NULL,
Quando si esegue un INSERT, non ci sono avvertimenti lanciati per questa o l'altra BIT campi, ma selezionando le righe viene mostrato che tutti i valori BIT sono vuoti.
Cercare manualmente di AGGIORNARE questi record dalla riga di comando dà un effetto strano: mostra che il record è stato abbinato e modificato (se appropriato), ma rimane sempre vuoto.
versione Server: 5.5.24-0ubuntu0.12.04.1 (Ubuntu)
mysql> update pumps set hasMultipleColors = 1 where id = 1;
Query OK, 0 rows affected (0.00 sec)
Rows matched: 1 Changed: 0 Warnings: 0
mysql> select hasMultipleColors from pumps where id = 1;
+-------------------+
| hasMultipleColors |
+-------------------+
| |
+-------------------+
1 row in set (0.00 sec)
mysql> update pumps set hasMultipleColors = b'0' where id = 1;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> select hasMultipleColors from pumps where id = 1;
+-------------------+
| hasMultipleColors |
+-------------------+
| |
+-------------------+
1 row in set (0.00 sec)
Qualche idea?
Perché non stai usando 'BOOL' invece di' BIT' per quello? Dalla semantica del nome del tuo campo, avrebbe più senso. – Romain
Ho fatto alcune letture riguardo i tipi di dati BOOL vs. BIT vs. TINYINT, e il take-away che ho preso è stato che MySQL gestisce BOOL in modo molto povero - non portabile ad altre soluzioni RDBMS - quindi è generalmente ideale andare con TINYINT o BIT (più efficiente). – CdrXndr