public boolean createSqlTable (Connection connection, String namespace, boolean makeIdSerial, String[] primaryKeyFields) {
        // Optionally join namespace and name to create full table name if namespace is not null (i.e., table object is
        // a spec table).
        String tableName = namespace != null ? String.join(".", namespace, name) : name;
        String fieldDeclarations = Arrays.stream(fields)
                .map(Field::getSqlDeclaration)
                .collect(Collectors.joining(", "));
        if (primaryKeyFields != null) {
            fieldDeclarations += String.format(", primary key (%s)", String.join(", ", primaryKeyFields));
        }
        String dropSql = String.format("drop table if exists %s", tableName);
        // Adding the unlogged keyword gives about 12 percent speedup on loading, but is non-standard.
        String idFieldType = makeIdSerial ? "serial" : "bigint";
        String createSql = String.format("create table %s (id %s not null, %s)", tableName, idFieldType, fieldDeclarations);
        try {
            Statement statement = connection.createStatement();
            LOG.info(dropSql);
            statement.execute(dropSql);
            LOG.info(createSql);
            return statement.execute(createSql);
        } catch (Exception ex) {
            throw new StorageException(ex);
        }
    }
public boolean createSqlTable (Connection connection, String namespace, boolean makeIdSerial, String[] primaryKeyFields) {
        
        
        String tableName = namespace != null ? String.join(".", namespace, name) : name;
        String fieldDeclarations = Arrays.stream(fields)
                .map(Field::getSqlDeclaration)
                .collect(Collectors.joining(", "));
        if (primaryKeyFields != null) {
            fieldDeclarations += String.format(", primary key (%s)", String.join(", ", primaryKeyFields));
        }
        String dropSql = String.format("drop table if exists %s", tableName);
        
        String idFieldType = makeIdSerial ? "serial" : "bigint";
        String createSql = String.format("create table %s (id %s not null, %s)", tableName, idFieldType, fieldDeclarations);
        try {
            Statement statement = connection.createStatement();
            LOG.info(dropSql);
            statement.execute(dropSql);
            LOG.info(createSql);
            return statement.execute(createSql);
        } catch (Exception ex) {
            throw new StorageException(ex);
        }
    }
public boolean createSqlTable ( Connection connection , String namespace , boolean makeIdSerial , String [ ] primaryKeyFields ) { // Optionally join namespace and name to create full table name if namespace is not null (i.e., table object is // a spec table). String tableName = namespace != null ? String . join ( "." , namespace , name ) : name ; String fieldDeclarations = Arrays . stream ( fields ) . map ( Field :: getSqlDeclaration ) . collect ( Collectors . joining ( ", " ) ) ; if ( primaryKeyFields != null ) { fieldDeclarations += String . format ( ", primary key (%s)" , String . join ( ", " , primaryKeyFields ) ) ; } String dropSql = String . format ( "drop table if exists %s" , tableName ) ; // Adding the unlogged keyword gives about 12 percent speedup on loading, but is non-standard. String idFieldType = makeIdSerial ? "serial" : "bigint" ; String createSql = String . format ( "create table %s (id %s not null, %s)" , tableName , idFieldType , fieldDeclarations ) ; try { Statement statement = connection . createStatement ( ) ; LOG . info ( dropSql ) ; statement . execute ( dropSql ) ; LOG . info ( createSql ) ; return statement . execute ( createSql ) ; } catch ( Exception ex ) { throw new StorageException ( ex ) ; } }
Create an SQL table with all the fields specified by this table object,
plus an integer CSV line number field in the first position.
Create an SQL table with all the fields specified by this table object plus an integer CSV line number field in the first position .