/** * Remove the given index from the list. * * @param index the index to remove */ public void removeIndex(Index index) { ArrayList<Index> indexes = getIndexes(); if (indexes != null) { remove(indexes, index); if (index.getIndexType().isPrimaryKey()) { for (Column col : index.getColumns()) { col.setPrimaryKey(false); } } } }
column.getName()); column.setPrimaryKey(true);
column.setPrimaryKey(true); column.setPrimaryKey(true); column.setPrimaryKey(true); column.setAutoIncrement(true, start, increment); } else if (readIf("IDENTITY")) { parseAutoIncrement(column); column.setPrimaryKey(true); parseNotNullConstraint();
ErrorCode.COLUMN_MUST_NOT_BE_NULLABLE_1, column.getName()); column.setPrimaryKey(true);
Column column = parseColumnForTable(columnName, true); if (column.isAutoIncrement() && column.isPrimaryKey()) { column.setPrimaryKey(false); IndexColumn[] cols = { new IndexColumn() }; cols[0].columnName = column.getName();
public void removeIndex(Index index) { ObjectArray indexes = getIndexes(); if (indexes != null) { remove(indexes, index); if (index.getIndexType().isPrimaryKey()) { Column[] cols = index.getColumns(); for (int i = 0; i < cols.length; i++) { cols[i].setPrimaryKey(false); } } } }
@Override public Table createTable(CreateTableData data) { if(data.tableEngineParams.isEmpty()) { throw DbException.get(ErrorCode.FILE_NOT_FOUND_1); } File filePath = URIUtilities.fileFromString(StringUtils.javaDecode(data.tableEngineParams.get(0))); if(!filePath.exists()) { // Do not throw an exception as it will prevent the user from opening the database LOGGER.error("File not found:\n"+filePath.getAbsolutePath()+"\nThe table "+data.tableName+" will be empty."); return new DummyTable(data); } try { Driver driver = createDriver(filePath, data.tableEngineParams); if(data.columns.isEmpty()) { feedCreateTableData(driver, data); // Add primary key column String pkColumnName = getUniqueColumnName(H2TableIndex.PK_COLUMN_NAME, data.columns); Column pk = new Column(pkColumnName, Value.LONG); pk.setPrimaryKey(true); pk.setNullable(false); data.columns.add(0, pk); } H2Table shpTable = new H2Table(driver, data); shpTable.init(data.session); return shpTable; } catch (IOException ex) { throw DbException.get(ErrorCode.IO_EXCEPTION_1,ex); } }
@Override public Table createTable(CreateTableData data) { if(data.tableEngineParams.isEmpty()) { throw DbException.get(ErrorCode.FILE_NOT_FOUND_1); } File filePath = URIUtilities.fileFromString(StringUtils.javaDecode(data.tableEngineParams.get(0))); if(!filePath.exists()) { // Do not throw an exception as it will prevent the user from opening the database LOGGER.error("File not found:\n"+filePath.getAbsolutePath()+"\nThe table "+data.tableName+" will be empty."); return new DummyTable(data); } try { Driver driver = createDriver(filePath, data.tableEngineParams); if(data.columns.isEmpty()) { feedCreateTableData(driver, data); // Add primary key column String pkColumnName = getUniqueColumnName(H2TableIndex.PK_COLUMN_NAME, data.columns); Column pk = new Column(pkColumnName, Value.LONG); pk.setPrimaryKey(true); pk.setNullable(false); data.columns.add(0, pk); } H2Table shpTable = new H2Table(driver, data); shpTable.init(data.session); return shpTable; } catch (IOException ex) { throw DbException.get(ErrorCode.IO_EXCEPTION_1,ex); } }
@Override public Table createTable(CreateTableData data) { if(data.tableEngineParams.isEmpty()) { throw DbException.get(ErrorCode.FILE_NOT_FOUND_1); } File filePath = URIUtilities.fileFromString(StringUtils.javaDecode(data.tableEngineParams.get(0))); if(!filePath.exists()) { // Do not throw an exception as it will prevent the user from opening the database LOGGER.error("File not found:\n"+filePath.getAbsolutePath()+"\nThe table "+data.tableName+" will be empty."); return new DummyTable(data); } try { Driver driver = createDriver(filePath, data.tableEngineParams); if(data.columns.isEmpty()) { feedCreateTableData(driver, data); // Add primary key column String pkColumnName = getUniqueColumnName(H2TableIndex.PK_COLUMN_NAME, data.columns); Column pk = new Column(pkColumnName, Value.LONG); pk.setPrimaryKey(true); pk.setNullable(false); data.columns.add(0, pk); } H2Table shpTable = new H2Table(driver, data); shpTable.init(data.session); return shpTable; } catch (IOException ex) { throw DbException.get(ErrorCode.IO_EXCEPTION_1,ex); } }
@Override public Table createTable(CreateTableData data) { if(data.tableEngineParams.isEmpty()) { throw DbException.get(ErrorCode.FILE_NOT_FOUND_1); } File filePath = URIUtility.fileFromString(StringUtils.javaDecode(data.tableEngineParams.get(0))); if(!filePath.exists()) { // Do not throw an exception as it will prevent the user from opening the database LOGGER.error("File not found:\n"+filePath.getAbsolutePath()+"\nThe table "+data.tableName+" will be empty."); return new DummyTable(data); } try { Driver driver = createDriver(filePath, data.tableEngineParams); if(data.columns.isEmpty()) { feedCreateTableData(driver, data); // Add primary key column String pkColumnName = getUniqueColumnName(H2TableIndex.PK_COLUMN_NAME, data.columns); Column pk = new Column(pkColumnName, Value.LONG); pk.setPrimaryKey(true); pk.setNullable(false); data.columns.add(0, pk); } H2Table shpTable = new H2Table(driver, data); shpTable.init(data.session); return shpTable; } catch (IOException ex) { throw DbException.get(ErrorCode.IO_EXCEPTION_1,ex); } }
/** * Remove the given index from the list. * * @param index the index to remove */ public void removeIndex(Index index) { ArrayList<Index> indexes = getIndexes(); if (indexes != null) { remove(indexes, index); if (index.getIndexType().isPrimaryKey()) { for (Column col : index.getColumns()) { col.setPrimaryKey(false); } } } }
/** * Remove the given index from the list. * * @param index the index to remove */ public void removeIndex(Index index) { ArrayList<Index> indexes = getIndexes(); if (indexes != null) { remove(indexes, index); if (index.getIndexType().isPrimaryKey()) { for (Column col : index.getColumns()) { col.setPrimaryKey(false); } } } }
column.getName()); column.setPrimaryKey(true);
column.getName()); column.setPrimaryKey(true);
column.setPrimaryKey(true); column.setPrimaryKey(true); column.setPrimaryKey(true); column.setAutoIncrement(true, start, increment); column.setPrimaryKey(true); if (readIf("NOT")) { read("NULL");
column.setPrimaryKey(true); column.setPrimaryKey(true); column.setPrimaryKey(true); column.setAutoIncrement(true, start, increment); column.setPrimaryKey(true); if (readIf("NOT")) { read("NULL");
ErrorCode.COLUMN_MUST_NOT_BE_NULLABLE_1, column.getName()); column.setPrimaryKey(true);
ErrorCode.COLUMN_MUST_NOT_BE_NULLABLE_1, column.getName()); column.setPrimaryKey(true);
throw Message.getSQLException(ErrorCode.COLUMN_MUST_NOT_BE_NULLABLE_1, column.getName()); column.setPrimaryKey(true);
Column column = parseColumnForTable(columnName, true); if (column.isAutoIncrement() && column.isPrimaryKey()) { column.setPrimaryKey(false); IndexColumn[] cols = { new IndexColumn() }; cols[0].columnName = column.getName();