/** * Append a CREATE TABLE statement that would create this table and its columns. Users should not call * this method and instead let {@link com.yahoo.squidb.data.SquidDatabase} build tables automatically. */ public void appendCreateTableSql(CompileContext compileContext, StringBuilder sql, PropertyVisitor<Void, StringBuilder> propertyVisitor) { sql.append("CREATE TABLE IF NOT EXISTS ").append(getExpression()).append('('); boolean needsComma = false; for (Property<?> property : properties) { if (TableModel.ROWID.equals(property.getExpression())) { continue; } if (needsComma) { sql.append(", "); } property.accept(propertyVisitor, sql); needsComma = true; } if (!SqlUtils.isEmpty(getTableConstraint())) { sql.append(", ").append(getTableConstraint()); } sql.append(')'); }
/** * Append a CREATE TABLE statement that would create this table and its columns. Users should not call * this method and instead let {@link com.yahoo.squidb.data.SquidDatabase} build tables automatically. */ public void appendCreateTableSql(CompileContext compileContext, StringBuilder sql, PropertyVisitor<Void, StringBuilder> propertyVisitor) { sql.append("CREATE TABLE IF NOT EXISTS ").append(getExpression()).append('('); boolean needsComma = false; for (Property<?> property : properties) { if (TableModel.ROWID.equals(property.getExpression())) { continue; } if (needsComma) { sql.append(", "); } property.accept(propertyVisitor, sql); needsComma = true; } if (!SqlUtils.isEmpty(getTableConstraint())) { sql.append(", ").append(getTableConstraint()); } sql.append(')'); }