예제 #1
0
 @Override
 public String toString() {
   if (this.prefixMap != null) {
     StringBuilder sb = new StringBuilder();
     for (Map.Entry<String, String> entry : this.prefixMap.entrySet()) {
       sb.append("SET NAMESPACE '")
           .append(StringUtil.replaceAll(entry.getKey(), "'", "''"))
           .append('\'') // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
           .append(" AS ")
           .append(SQLStringVisitor.escapeSinglePart(entry.getValue()))
           .append(";\n"); // $NON-NLS-1$  //$NON-NLS-2$
     }
     return sb.append("\n").toString() + buffer.toString(); // $NON-NLS-1$
   }
   return buffer.toString();
 }
예제 #2
0
 private void addOption(StringBuilder sb, String key, Object value) {
   if (sb.length() != 0) {
     sb.append(COMMA).append(SPACE);
   }
   if (value != null) {
     value = new Constant(value);
   } else {
     value = Constant.NULL_CONSTANT;
   }
   if (key != null && key.length() > 2 && key.charAt(0) == '{') {
     String origKey = key;
     int index = key.indexOf('}');
     if (index > 1) {
       String uri = key.substring(1, index);
       key = key.substring(index + 1, key.length());
       String prefix = BUILTIN_PREFIXES.get(uri);
       if ((prefix == null && usePrefixes) || createNS) {
         if (prefixMap == null) {
           prefixMap = new LinkedHashMap<String, String>();
         } else {
           prefix = this.prefixMap.get(uri);
         }
         if (prefix == null) {
           prefix = "n" + this.prefixMap.size(); // $NON-NLS-1$					
         }
         this.prefixMap.put(uri, prefix);
       }
       if (prefix != null) {
         key = prefix + ":" + key; // $NON-NLS-1$
       } else {
         key = origKey;
       }
     }
   }
   sb.append(SQLStringVisitor.escapeSinglePart(key)).append(SPACE).append(value);
 }
예제 #3
0
 protected DDLStringVisitor append(Object o) {
   buffer.append(o);
   return this;
 }