Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2012 Pursuer (http://pursuer.me).
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Public License v3.0
 * which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/gpl.html
 * 
 * Contributors:
 *     Pursuer - initial API and implementation
 ******************************************************************************/

public class Main {
    private static String sqlCreateIndex(final String tableName, final String[] columnNames) {
        final StringBuilder buff = new StringBuilder(128);
        buff.append("CREATE INDEX IF NOT EXISTS idx_");
        buff.append(tableName);
        for (int i = 0; i < columnNames.length; i++) {
            buff.append('_');
            buff.append(columnNames[i]);
        }
        buff.append(" ON ");
        buff.append(tableName);
        buff.append('(');
        for (int i = 0; i < columnNames.length; i++) {
            if (i > 0) {
                buff.append(',');
            }
            buff.append(columnNames[i]);
        }
        buff.append(')');
        return buff.toString();
    }
}