List of usage examples for java.util.prefs Preferences MAX_NAME_LENGTH
int MAX_NAME_LENGTH
To view the source code for java.util.prefs Preferences MAX_NAME_LENGTH.
Click Source Link
From source file:org.openconcerto.sql.preferences.SQLPreferences.java
static private SQLCreateTable[] getCreateTables(final DBRoot root) throws SQLException { final SQLCreateTable createNodeT = new SQLCreateTable(root, PREF_NODE_TABLENAME); // don't need ORDER and ARCHIVE createNodeT.setPlain(true);/*from w w w. ja va 2 s . c om*/ createNodeT.addColumn(SQLSyntax.ID_NAME, createNodeT.getSyntax().getPrimaryIDDefinition()); // cannot use addForeignColumn() since it's a self-reference createNodeT.addColumn("ID_PARENT", createNodeT.getSyntax().getIDType() + " NULL"); createNodeT.addVarCharColumn("NAME", Preferences.MAX_NAME_LENGTH); createNodeT.addForeignConstraint("ID_PARENT", new SQLName(createNodeT.getName()), SQLSyntax.ID_NAME); createNodeT.addUniqueConstraint("uniqNamePerParent", Arrays.asList("ID_PARENT", "NAME")); final SQLCreateTable createValueT = new SQLCreateTable(root, PREF_VALUE_TABLENAME); createValueT.setPlain(true); createValueT.addColumn("ID_NODE", createValueT.getSyntax().getIDType() + " NOT NULL"); createValueT.addVarCharColumn("NAME", Preferences.MAX_KEY_LENGTH); createValueT.addVarCharColumn("VALUE", Preferences.MAX_VALUE_LENGTH, true); // unique name per node createValueT.setPrimaryKey("ID_NODE", "NAME"); createValueT.addForeignConstraint("ID_NODE", new SQLName(createNodeT.getName()), SQLSyntax.ID_NAME); return new SQLCreateTable[] { createNodeT, createValueT }; }