本文整理汇总了Java中com.healthmarketscience.jackcess.Column.getProperties方法的典型用法代码示例。如果您正苦于以下问题:Java Column.getProperties方法的具体用法?Java Column.getProperties怎么用?Java Column.getProperties使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.healthmarketscience.jackcess.Column
的用法示例。
在下文中一共展示了Column.getProperties方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: saveColumnsDefaults
import com.healthmarketscience.jackcess.Column; //导入方法依赖的package包/类
private void saveColumnsDefaults(String[] defaults,Boolean[] required,Table table) throws IOException{
List<? extends Column> cols=table.getColumns();
int j=0;
if(defaults!=null||required!=null)
for(Column cl:cols){
PropertyMap map=cl.getProperties();
if(defaults!=null&&defaults[j]!=null){
map.put(PropertyMap.DEFAULT_VALUE_PROP,DataType.TEXT,defaults[j]);
}
if(required!=null&&required[j]!=null &&required[j]){
map.put(PropertyMap.REQUIRED_PROP,DataType.BOOLEAN,required[j]);
}
map.save();
j++;
}
}
示例2: createSyncrTable
import com.healthmarketscience.jackcess.Column; //导入方法依赖的package包/类
private void createSyncrTable(Table t,boolean systemTable) throws SQLException, IOException {
String tn = t.getName();
String ntn =schema( SQLConverter.escapeIdentifier(tn),systemTable);
StringBuffer sbC = new StringBuffer("CREATE CACHED TABLE ").append(
ntn).append("(");
List<? extends Column> lc = t.getColumns();
String comma = "";
ArrayList<String> arTrigger = new ArrayList<String>();
for (Column cl : lc) {
String htype = cl.getType().equals(DataType.TEXT) ? "VARCHAR("
+ cl.getLengthInUnits() + ")" : TypesMap.map2hsqldb(cl
.getType());
sbC.append(comma)
.append(SQLConverter.escapeIdentifier(cl.getName()))
.append(" ").append(htype);
PropertyMap pm = cl.getProperties();
Object required = pm.getValue(PropertyMap.REQUIRED_PROP);
if (required != null && ((Boolean) required)) {
sbC.append(" NOT NULL ");
}
comma = ",";
}
sbC.append(")");
execCreate(sbC.toString(),true);
for (String trigger : arTrigger) {
execCreate(trigger,true);
}
}
示例3: defaultValues
import com.healthmarketscience.jackcess.Column; //导入方法依赖的package包/类
private void defaultValues(Table t) throws SQLException, IOException {
String tn = t.getName();
String ntn = SQLConverter.escapeIdentifier(tn);
List<? extends Column> lc = t.getColumns();
ArrayList<String> arTrigger = new ArrayList<String>();
for (Column cl : lc) {
PropertyMap pm = cl.getProperties();
String ncn = SQLConverter.escapeIdentifier(cl.getName());
Object defaulT = pm.getValue(PropertyMap.DEFAULT_VALUE_PROP);
if (defaulT != null) {
String cdefaulT = SQLConverter.convertSQL(" "
+ defaulT.toString());
if (cdefaulT.trim().startsWith("=")) {
cdefaulT = cdefaulT.trim().substring(1);
}
if (cl.getType().equals(DataType.BOOLEAN)
&& ("=yes".equalsIgnoreCase(cdefaulT) || "yes"
.equalsIgnoreCase(cdefaulT)))
cdefaulT = "true";
if (cl.getType().equals(DataType.BOOLEAN)
&& ("=no".equalsIgnoreCase(cdefaulT) || "no"
.equalsIgnoreCase(cdefaulT)))
cdefaulT = "false";
if(
(cl.getType().equals(DataType.MEMO)||
cl.getType().equals(DataType.TEXT))&&
(!defaulT.toString().startsWith("\"")||
!defaulT.toString().endsWith("\"")
)
){
cdefaulT="'"+cdefaulT.replaceAll("'","''")+"'";
}
String guidExp = "GenGUID()";
if (!guidExp.equals(defaulT)) {
if (!tryDefault(cdefaulT)) {
Logger.logWarning("Unknown expression:" + defaulT
+ " default value of column "
+ cl.getName() + " table "
+ cl.getTable().getName());
} else {
if (cdefaulT.endsWith(")")) {
arTrigger
.add("CREATE TRIGGER DEFAULT_TRIGGER"
+ (namingCounter++)
+ " BEFORE INSERT ON "
+ ntn
+ " REFERENCING NEW ROW AS NEW FOR EACH ROW IF NEW."
+ ncn + " IS NULL THEN "
+ "SET NEW." + ncn + "= "
+ cdefaulT + " ; END IF");
} else
arTrigger.add("alter table " + ntn
+ " alter column " + ncn
+ " set default " + cdefaulT);
}
}
}
}
for (String trigger : arTrigger) {
execCreate(trigger,true);
}
}