コード例 #1
0
ファイル: _MySQLPlugIn.java プロジェクト: pgrbnsn/wonder
 // Shameless stolen from PostresqlSynchronizationFactory - davidleber
 //
 // I blame statementstToConvertColumnType for not taking a damn EOAttribute for
 // having to steal this from EOSQLExpression
 public String columnTypeStringForAttribute(EOAttribute attribute) {
   if (attribute.precision() != 0) {
     String precision = String.valueOf(attribute.precision());
     String scale = String.valueOf(attribute.scale());
     return _NSStringUtilities.concat(attribute.externalType(), "(", precision, ",", scale, ")");
   }
   if (attribute.width() != 0) {
     String width = String.valueOf(attribute.width());
     return _NSStringUtilities.concat(attribute.externalType(), "(", width, ")");
   }
   return attribute.externalType();
 }
コード例 #2
0
 // [PJYF Oct 19 2004]
 // We need to prepend the question mark with a type attribute to get the jdbc driver to do the
 // right thing.
 // only for B (Binary)
 public NSMutableDictionary bindVariableDictionaryForAttribute(
     EOAttribute attribute, Object value) {
   String prepend = "";
   String externalType =
       (attribute.externalType() != null ? attribute.externalType().toLowerCase() : "");
   if ("binary".equals(externalType)) {
     prepend = "B";
   }
   return new NSMutableDictionary(
       new Object[] {attribute.name(), prepend + "?", attribute, value},
       new Object[] {
         BindVariableNameKey,
         BindVariablePlaceHolderKey,
         BindVariableAttributeKey,
         BindVariableValueKey
       });
 }
コード例 #3
0
    public EOSchemaSynchronizationColumnChanges objectStoreChangesFromAttributeToAttribute(
        EOAttribute schemaAttribute, EOAttribute modelAttribute) {
      EOSchemaSynchronizationColumnChanges objectStoreChanges =
          super.objectStoreChangesFromAttributeToAttribute(schemaAttribute, modelAttribute);
      if (objectStoreChanges.valueForKey("precision") != null
          || objectStoreChanges.valueForKey("scale") != null) {
        objectStoreChanges.clearPrecision();
        objectStoreChanges.clearScale();
      }
      if (!modelAttribute.externalType().equals(schemaAttribute.externalType())) {
        if (modelAttribute.externalType().equals("varchar")
            && schemaAttribute.externalType().equals("char"))
          objectStoreChanges.clearExternalType();
      } else {
        if (schemaAttribute.externalType().equals("object")
            && objectStoreChanges.valueForKey("width") != null) objectStoreChanges.clearWidth();
      }
      if ((modelAttribute.externalType().equals("char")
              || modelAttribute.externalType().equals("varchar"))
          && modelAttribute.width() == 1024
          && schemaAttribute.width() == 1023) objectStoreChanges.clearWidth();

      return objectStoreChanges;
    }