protected String getWhereClause(
      InsertOrUpdateStatement insertOrUpdateStatement, Database database) {
    StringBuffer where = new StringBuffer();

    String[] pkColumns = insertOrUpdateStatement.getPrimaryKey().split(",");

    for (String thisPkColumn : pkColumns) {
      where
          .append(
              database.escapeColumnName(
                  insertOrUpdateStatement.getSchemaName(),
                  insertOrUpdateStatement.getTableName(),
                  thisPkColumn))
          .append(" = ");
      Object newValue = insertOrUpdateStatement.getColumnValues().get(thisPkColumn);
      if (newValue == null || newValue.toString().equals("NULL")) {
        where.append("NULL");
      } else if (newValue instanceof String && database.shouldQuoteValue(((String) newValue))) {
        where.append("'").append(database.escapeStringForDatabase((String) newValue)).append("'");
      } else if (newValue instanceof Date) {
        where.append(database.getDateLiteral(((Date) newValue)));
      } else if (newValue instanceof Boolean) {
        if (((Boolean) newValue)) {
          where.append(
              TypeConverterFactory.getInstance()
                  .findTypeConverter(database)
                  .getBooleanType()
                  .getTrueBooleanValue());
        } else {
          where.append(
              TypeConverterFactory.getInstance()
                  .findTypeConverter(database)
                  .getBooleanType()
                  .getFalseBooleanValue());
        }
      } else {
        where.append(newValue);
      }

      where.append(" AND ");
    }

    where.delete(where.lastIndexOf(" AND "), where.lastIndexOf(" AND ") + " AND ".length());
    return where.toString();
  }
  @Override
  protected List<? extends SqlStatement> setupStatements(Database database) {
    ArrayList<CreateTableStatement> statements = new ArrayList<CreateTableStatement>();
    CreateTableStatement table = new CreateTableStatement(null, TABLE_NAME);
    table.addColumn(
        "id",
        TypeConverterFactory.getInstance().findTypeConverter(database).getDataType("int", false),
        null,
        new NotNullConstraint());
    statements.add(table);

    if (database.supportsSchemas()) {
      table = new CreateTableStatement(DatabaseTestContext.ALT_SCHEMA, TABLE_NAME);
      table.addColumn(
          "id",
          TypeConverterFactory.getInstance().findTypeConverter(database).getDataType("int", false),
          null,
          new NotNullConstraint());
      statements.add(table);
    }
    return statements;
  }