Package org.h2.jaqu.util

Examples of org.h2.jaqu.util.StatementBuilder.appendExceptFirst()


    long insert(Db db, Object obj, boolean returnKey) {
        SQLStatement stat = new SQLStatement(db);
        StatementBuilder buff = new StatementBuilder("INSERT INTO ");
        buff.append(db.getDialect().getTableName(schemaName, tableName)).append('(');
        for (FieldDefinition field : fields) {
            buff.appendExceptFirst(", ");
            buff.append(field.columnName);
        }
        buff.append(") VALUES(");
        buff.resetCount();
        for (FieldDefinition field : fields) {
View Full Code Here


            buff.append(field.columnName);
        }
        buff.append(") VALUES(");
        buff.resetCount();
        for (FieldDefinition field : fields) {
            buff.appendExceptFirst(", ");
            buff.append('?');
            Object value = getValue(obj, field);
            stat.addParameter(value);
        }
        buff.append(')');
View Full Code Here

        SQLStatement stat = new SQLStatement(db);
        StatementBuilder buff = new StatementBuilder("MERGE INTO ");
        buff.append(db.getDialect().getTableName(schemaName, tableName)).append(" (");
        buff.resetCount();
        for (FieldDefinition field : fields) {
            buff.appendExceptFirst(", ");
            buff.append(field.columnName);
        }
        buff.append(") KEY(");
        buff.resetCount();
        for (FieldDefinition field : fields) {
View Full Code Here

        }
        buff.append(") KEY(");
        buff.resetCount();
        for (FieldDefinition field : fields) {
            if (field.isPrimaryKey) {
                buff.appendExceptFirst(", ");
                buff.append(field.columnName);
            }
        }
        buff.append(") ");
        buff.resetCount();
View Full Code Here

        }
        buff.append(") ");
        buff.resetCount();
        buff.append("VALUES (");
        for (FieldDefinition field : fields) {
            buff.appendExceptFirst(", ");
            buff.append('?');
            Object value = getValue(obj, field);
            stat.addParameter(value);
        }
        buff.append(')');
View Full Code Here

        buff.append(db.getDialect().getTableName(schemaName, tableName)).append(" SET ");
        buff.resetCount();

        for (FieldDefinition field : fields) {
            if (!field.isPrimaryKey) {
                buff.appendExceptFirst(", ");
                buff.append(field.columnName);
                buff.append(" = ?");
                Object value = getValue(obj, field);
                stat.addParameter(value);
            }
View Full Code Here

        }

        buff.append(dialect.getTableName(schemaName, tableName)).append('(');

        for (FieldDefinition field : fields) {
            buff.appendExceptFirst(", ");
            buff.append(field.columnName).append(' ').append(field.dataType);
            if (field.maxLength > 0) {
                buff.append('(').append(field.maxLength).append(')');
            }
View Full Code Here

        // primary key
        if (primaryKeyColumnNames != null && primaryKeyColumnNames.size() > 0) {
            buff.append(", PRIMARY KEY(");
            buff.resetCount();
            for (String n : primaryKeyColumnNames) {
                buff.appendExceptFirst(", ");
                buff.append(n);
            }
            buff.append(')');
        }
        buff.append(')');
View Full Code Here

            buff.append(index.indexName);
            buff.append(" ON ");
            buff.append(table);
            buff.append("(");
            for (String col:index.columnNames) {
                buff.appendExceptFirst(", ");
                buff.append(col);
            }
            buff.append(")");
            return buff.toString();
        }
View Full Code Here

        }

        public String getColumnsString() {
            StatementBuilder sb = new StatementBuilder();
            for (String col : columns) {
                sb.appendExceptFirst(", ");
                sb.append(col);
            }
            return sb.toString().trim();
        }
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.