title: Working with boolean values in an SQLite database
body: <p>I read that SQLite databases support a <code>boolean</code> value. Here's my query to create the table:</p>
  
  <pre><code>private static final String CREATE_TABLE_PROMEMORIE_RSI = "CREATE TABLE IF NOT EXIXSTS "
              + promemorieRSI.PROMEMORIE_RSI_TABLE + " ("
              + promemorieRSI.ID + " integer primary key autoincrement, "
              + promemorieRSI.GIORNO + " integer, "
              + promemorieRSI.MESE + " integer, "
              + promemorieRSI.ANNO + " integer, "
              + promemorieRSI.NOT_RIP_RSI + " boolean, "
              + promemorieRSI.RIP_VAL_RSI + " integer, "
              + promemorieRSI.UNIT_RIP_VAL_RSI + " text, "
              + promemorieRSI.NOT_FISSA_RSI + " boolean, "
              + promemorieRSI.ETICHETTA_RSI + " text, "
              + promemorieRSI.REQUEST_CODE_RSI + " integer);";
  </code></pre>
  
  <p>As you can see, I set the <code>not_rip_rsi</code> and <code>not_fissa_rsi</code> columns to be of <code>boolean</code> values. I read that the database stores the <code>true</code> and <code>false</code> values as, respectively, <code>1</code> and <code>0</code> integer values, but now I can't understand this:</p>
  
  <ul>
  <li>When I add a record to the database, what value should I use for these columns?</li>
  </ul>
  
  <p>For better explanation, here's my insert method:</p>
  
  <pre><code>public void inserisciPromemoriaRSI(Integer giorno, Integer mese, Integer anno, Boolean not_rip, Integer rip_val, String unit_rip_val, Boolean not_fissa, String etichetta, Integer request_code){
          ContentValues val = new ContentValues();
          val.put(promemorieRSI.GIORNO, giorno);
          val.put(promemorieRSI.MESE, mese);
          val.put(promemorieRSI.ANNO, anno);
          val.put(promemorieRSI.NOT_RIP_RSI, not_rip);
          val.put(promemorieRSI.RIP_VAL_RSI, rip_val);
          val.put(promemorieRSI.UNIT_RIP_VAL_RSI, unit_rip_val);
          val.put(promemorieRSI.NOT_FISSA_RSI, not_fissa);
          val.put(promemorieRSI.ETICHETTA_RSI, etichetta);
          val.put(promemorieRSI.REQUEST_CODE_RSI, request_code);
          mDb.insert(promemorieRSI.PROMEMORIE_RSI_TABLE, null, val);
      }
  </code></pre>
  
  <p>As you can see, to add the record I use a <code>boolean</code> value for these columns. Even if I set the value of the entries of those columns to be of type <code>boolean</code>, when I add a record, should I use an integer value of <code>1</code> or <code>0</code>  instead of a <code>boolean</code> value, or will the database automatically store <code>true</code> as <code>1</code> and <code>false</code> as 0? Will I have to use a <code>cursor.getInt(column_index) == 1</code> to get the boolean value? Am I making a mistake in my code? If so, how do I solve this problem. Any suggestions? </p>