code: protected String constructQuery(String table, String[] fieldNames) {
      if(fieldNames == null) {
        throw new IllegalArgumentException("Field names may not be null");
      }
  
      StringBuilder query = new StringBuilder();
      query.append("INSERT INTO ").append(table);
  
      if (fieldNames.length > 0 && fieldNames[0] != null) {
        query.append(" (");
        for (int i = 0; i < fieldNames.length; i++) {
          query.append(fieldNames[i]);
          if (i != fieldNames.length - 1) {
            query.append(",");
          }
        }
        query.append(")");
      }
      query.append(" VALUES (");
  
      for (int i = 0; i < fieldNames.length; i++) {
        query.append("?");
        if(i != fieldNames.length - 1) {
          query.append(",");
        }
      }
      query.append(");");
  
      return query.toString();
    }
docs: Constructs the query used as the prepared statement to insert data.
  
  @param table
  the table to insert into
  @param fieldNames
  the fields to insert into. If field names are unknown, supply an
  array of nulls.