Package com.webobjects.jdbcadaptor

Examples of com.webobjects.jdbcadaptor.JDBCAdaptor


        if (dumpFile.exists() && ! dumpFile.canWrite()) {
          throw NSForwardException._runtimeExceptionForThrowable(new IllegalArgumentException(SQLDUMP_FILE_NOT_WRITEABLE));
        }
        EOAdaptor adaptor = EOAdaptor.adaptorWithModel(eomodel);
        if (adaptor instanceof JDBCAdaptor) {
          JDBCAdaptor jdbc = (JDBCAdaptor) adaptor;
          ERXSQLHelper helper = ERXSQLHelper.newSQLHelper(jdbc);
          String sql = helper.createSchemaSQLForEntitiesInModelAndOptions(eomodel.entities(), eomodel, helper.defaultOptionDictionary(true, true));
          ERXFileUtilities.writeInputStreamToFile(new ByteArrayInputStream(sql.getBytes()), dumpFile);
          log.info("Wrote Schema SQL to " + dumpFile);
        }
View Full Code Here


        dbServer = (String) dict.objectForKey("URL");
        dbLogin = (String) dict.objectForKey("username");
        dbPassword = (String) dict.objectForKey("password");
       
        if (dbDriver == null || dbDriver.length() == 0) {
          JDBCAdaptor jdbcAdaptor = new JDBCAdaptor("JDBC");
          jdbcAdaptor.setConnectionDictionary(dict);
          JDBCPlugIn plugIn = jdbcAdaptor.plugIn();
          dbDriver = plugIn.defaultDriverName();
        }

        minimumConnections = ERXValueUtilities.intValueWithDefault(dict.objectForKey("minConnections"), ERXProperties.intForKeyWithDefault("er.extensions.ERXJDBCConnectionBroker.minConnections", 1));
    maximumConnections = ERXValueUtilities.intValueWithDefault(dict.objectForKey("maxConnections"), ERXProperties.intForKeyWithDefault("er.extensions.ERXJDBCConnectionBroker.maxConnections", 1));
View Full Code Here

      super.performAdaptorOperations(ops);
      ERXAdaptorOperationWrapper.adaptorOperationsDidPerform(ops);
    }

    private JDBCPlugIn _plugIn() {
      JDBCAdaptor jdbcadaptor = (JDBCAdaptor) adaptorContext().adaptor();
      return jdbcadaptor.plugIn();
    }
View Full Code Here

  public boolean tryLock(EOAdaptorChannel channel, EOModel model, String lockOwnerName) {
    return _tryLock(channel, model, lockOwnerName, createIfMissing());
  }

  public boolean _tryLock(EOAdaptorChannel channel, EOModel model, String lockOwnerName, boolean createTableIfMissing) {
    JDBCAdaptor adaptor = (JDBCAdaptor) channel.adaptorContext().adaptor();
    try {
      // MS: This forces the models to load their jdbc2Info if they aren't already.  This
      // prevents deadlocks from happening further within migrations when the new migration
      // API is used.
      adaptor.externalTypesWithModel(model);
     
      int count;
      boolean wasOpen = true;
      if (!channel.isOpen()) {
        channel.openChannel();
View Full Code Here

      throw new ERXMigrationFailedException("Failed to lock " + migrationTableName(adaptor) + " table.  It might be missing? Try executing:\n" + createTableStatement + ".", e);
    }
  }

  public void unlock(EOAdaptorChannel channel, EOModel model) {
    JDBCAdaptor adaptor = (JDBCAdaptor) channel.adaptorContext().adaptor();
    boolean wasOpen = true;
    if (!channel.isOpen()) {
      channel.openChannel();
      wasOpen = false;
    }
View Full Code Here

      }
    }
  }

  public int versionNumber(EOAdaptorChannel channel, EOModel model) {
    JDBCAdaptor adaptor = (JDBCAdaptor) channel.adaptorContext().adaptor();

    boolean wasOpen = true;
    if (!channel.isOpen()) {
      channel.openChannel();
      wasOpen = false;
View Full Code Here

    }
    return version;
  }

  public void setVersionNumber(EOAdaptorChannel channel, EOModel model, int versionNumber) {
    JDBCAdaptor adaptor = (JDBCAdaptor) channel.adaptorContext().adaptor();

    boolean wasOpen = true;
    if (!channel.isOpen()) {
      channel.openChannel();
      wasOpen = false;
View Full Code Here

      nonJdbcAttribute.setExternalType("nonJdbcAttribute");
    entity.addAttribute(nonJdbcAttribute);
      return nonJdbcAttribute;
    }
   
    JDBCAdaptor adaptor = (JDBCAdaptor)_table.database().adaptor();
    ERXSQLHelper sqlHelper = ERXSQLHelper.newSQLHelper(adaptor);
    String externalType = sqlHelper.externalTypeForJDBCType(adaptor, _jdbcType);
    if (externalType == null) {
      externalType = "IF_YOU_ARE_SEEING_THIS_SOMETHING_WENT_WRONG_WITH_EXTERNAL_TYPES";
    }
    EOAttribute attribute = adaptor.createAttribute(_name, _name, _jdbcType, externalType, _precision, _scale, _allowsNull ? 1 : 0);
    if (_width > 0) {
      attribute.setWidth(_width);
    }
    if (_defaultValue != null) {
      NSDictionary userInfo = attribute.userInfo();
      NSMutableDictionary mutableUserInfo;
      if (userInfo == null) {
        mutableUserInfo = new NSMutableDictionary();
      }
      else {
        mutableUserInfo = userInfo.mutableClone();
      }
      mutableUserInfo.setObjectForKey(_defaultValue, "default");
      attribute.setUserInfo(mutableUserInfo);
    }

    if (_overrideValueType != null) {
      if (ERXMigrationColumn.NULL_VALUE_TYPE.equals(_overrideValueType)) {
        attribute.setValueType(null);
      }
      else {
        attribute.setValueType(_overrideValueType);
      }
      if (sqlHelper.reassignExternalTypeForValueTypeOverride(attribute)) {
        adaptor.assignExternalTypeForAttribute(attribute);
      }
    }

    if (_overrideExternalType != null) {
      attribute.setExternalType(_overrideExternalType);
View Full Code Here

   * @throws SQLException
   *             if the change fails
   */
  @SuppressWarnings("unchecked")
  public void setDataType(int jdbcType, int scale, int precision, int width, NSDictionary options) throws SQLException {
    JDBCAdaptor adaptor = (JDBCAdaptor) _table.database().adaptor();
    String externalType = ERXSQLHelper.newSQLHelper(adaptor).externalTypeForJDBCType(adaptor, jdbcType);
    EOSchemaSynchronization schemaSynchronization = _table.database().synchronizationFactory();
    NSArray<EOSQLExpression> expressions = schemaSynchronization.statementsToConvertColumnType(_name, _table.name(), null, new _ColumnType(externalType, scale, precision, width), options);
    ERXMigrationDatabase._ensureNotEmpty(expressions, "convert column type", true);
    ERXJDBCUtilities.executeUpdateScript(_table.database().adaptorChannel(), ERXMigrationDatabase._stringsForExpressions(expressions));
View Full Code Here

TOP

Related Classes of com.webobjects.jdbcadaptor.JDBCAdaptor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.