private boolean isRichText(Column c) throws IOException { if (c == null) { return false; } PropertyMap m = c.getProperties(); if (m == null) { return false; } if (c.getType() == null || ! c.getType().equals(DataType.MEMO)) { return false; } Object b = m.getValue(TEXT_FORMAT_KEY); if (b instanceof Byte) { if (((Byte)b).byteValue() == RICH_TEXT_FORMAT) { return true; } } return false; }
private DataType getReturnType(Column cl) throws IOException { if (cl.getProperties().get(PropertyMap.EXPRESSION_PROP) == null || cl.getProperties().get(PropertyMap.RESULT_TYPE_PROP) == null) { return null; } byte pos = (Byte) cl.getProperties().get(PropertyMap.RESULT_TYPE_PROP).getValue(); return DataType.fromByte(pos); }
private String getUpdateConditions(Column cl) throws IOException, SQLException { PropertyMap map = cl.getProperties(); Property exprp = map.get(PropertyMap.EXPRESSION_PROP); if (exprp != null) { Set<String> setu = SQLConverter.getFormulaDependencies(exprp.getValue().toString()); if (setu.size() > 0) { String or = ""; StringBuffer cw = new StringBuffer(); for (String dep : setu) { dep = escapeIdentifier(dep); cw.append(or).append("oldrow.").append(dep).append("<>").append("newrow.").append(dep); or = " OR "; } return cw.toString(); } } return " FALSE "; }
public String defaultValue4SQL(Column cl) throws SQLException, IOException { PropertyMap pm = cl.getProperties(); Object defaulT = pm.getValue(PropertyMap.DEFAULT_VALUE_PROP); if (defaulT == null) { return null; } return this.tablesLoader.defaultValue4SQL(defaulT, cl.getType()); }
private Object readColumnProperty(com.healthmarketscience.jackcess.Column column, String propertyName, Object defaultValue) throws IOException { PropertyMap.Property property = column.getProperties().get(propertyName); if (property != null) return property.getValue(); return defaultValue; }
Table tbl = db.getTable("Donations"); Column col = tbl.getColumn("DonationDate"); PropertyMap pm = col.getProperties(); pm.put("DefaultValue", "Date()"); pm.save();
private void setHsqldbNotNull(String tableName, String columnName, String type, Column cl) throws SQLException, IOException { UcanaccessConnection conn = UcanaccessConnection.getCtxConnection(); Boolean req = (Boolean) cl.getProperties().getValue(PropertyMap.REQUIRED_PROP); req = req != null && req; Statement stNN = null; try { if (req) { stNN = conn.getHSQLDBConnection().createStatement(); stNN.execute(SQLConverter .convertSQL("ALTER TABLE " + tableName + " ALTER COLUMN " + columnName + " SET NOT NULL ") .getSql()); } } finally { if (stNN != null) { stNN.close(); } } }
private boolean isRichText(Column c) throws IOException { if (c == null) { return false; } PropertyMap m = c.getProperties(); if (m == null) { return false; } if (c.getType() == null || ! c.getType().equals(DataType.MEMO)) { return false; } Object b = m.getValue(TEXT_FORMAT_KEY); if (b instanceof Byte) { if (((Byte)b).byteValue() == RICH_TEXT_FORMAT) { return true; } } return false; }
private String getExpression(Column cl) throws IOException { PropertyMap map = cl.getProperties(); Property exprp = map.get(PropertyMap.EXPRESSION_PROP); if (exprp != null) { Table tl = cl.getTable(); String expr = SQLConverter.convertPowOperator((String) exprp.getValue()); for (Column cl1 : tl.getColumns()) { expr = expr.replaceAll("\\[(?i)(" + Pattern.quote(cl1.getName()) + ")\\]", "newrow.$0"); } return expr; } return null; }
private boolean isRichText(Column c) throws IOException { if (c == null) { return false; } PropertyMap m = c.getProperties(); if (m == null) { return false; } if (c.getType() == null || ! c.getType().equals(DataType.MEMO)) { return false; } Object b = m.getValue(TEXT_FORMAT_KEY); if (b instanceof Byte) { if (((Byte)b).byteValue() == RICH_TEXT_FORMAT) { return true; } } return false; }
private void saveColumnsDefaults(String[] defaults, Boolean[] required, Column cl, int j) throws IOException { PropertyMap map = cl.getProperties(); if (defaults != null && j < defaults.length && defaults[j] != null) { map.put(PropertyMap.DEFAULT_VALUE_PROP, DataType.TEXT, defaults[j]); } if (required != null && j < required.length && required[j] != null && !cl.isAutoNumber()) { map.put(PropertyMap.REQUIRED_PROP, DataType.BOOLEAN, required[j]); } map.save(); }
@Override public PropertyMap getProperties() throws IOException { if(_complexInfo.getType() == ComplexDataType.MULTI_VALUE) { if(_mvProps == null) { PropertyMap primaryProps = super.getProperties(); PropertyMap complexProps = ((MultiValueColumnInfoImpl)_complexInfo) .getValueColumn().getProperties(); _mvProps = new MultiValueColumnPropertyMap(primaryProps, complexProps); } return _mvProps; } return super.getProperties(); }
private void setDefaultValue(Column cl, String ntn, List<String> arTrigger) throws IOException, SQLException { PropertyMap pm = cl.getProperties(); String ncn = procedureEscapingIdentifier(cl.getName()); Object defaulT = pm.getValue(PropertyMap.DEFAULT_VALUE_PROP);
sbC.append(comma).append(cn).append(" ").append(htype); PropertyMap pm = cl.getProperties(); Object required = pm.getValue(PropertyMap.REQUIRED_PROP); if (constraints && required != null && required instanceof Boolean && ((Boolean) required)) {
/** * Sets all attributes except name from the given Column template (including * all column properties except GUID). */ public ColumnBuilder setFromColumn(Column template) throws IOException { DataType type = template.getType(); setType(type); setLength(template.getLength()); setAutoNumber(template.isAutoNumber()); if(type.getHasScalePrecision()) { setScale(template.getScale()); setPrecision(template.getPrecision()); } setCalculated(template.isCalculated()); setCompressedUnicode(template.isCompressedUnicode()); setHyperlink(template.isHyperlink()); if(template instanceof ColumnImpl) { setTextSortOrder(((ColumnImpl)template).getTextSortOrder()); } PropertyMap colProps = template.getProperties(); for(PropertyMap.Property colProp : colProps) { // copy everything but guid if(!PropertyMap.GUID_PROP.equalsIgnoreCase(colProp.getName())) { setProperty(colProp.getName(), colProp); } } return this; }