Package com.webobjects.eoaccess

Examples of com.webobjects.eoaccess.EOSQLExpression


    public String _columnCreationClauseForAttribute(EOAttribute attribute) {
      return addCreateClauseForAttribute(attribute).toString();
    }
   
    public StringBuffer addCreateClauseForAttribute(EOAttribute attribute) {
      EOSQLExpression expression = _expressionForEntity(attribute.entity());
      expression.addCreateClauseForAttribute(attribute);
      return new StringBuffer(expression.listString());
    }
View Full Code Here


     */
    public static NSArray selectObjectsOfEntityForSqlWithBindings( EOEditingContext ec, String entityName, String query, boolean refreshesCache, Integer fetchLimit, ERXSQLBinding... bindings ) {
        EODatabaseContext context = databaseContextForEntityName(ec,entityName);
        EOEntity entity = EOUtilities.entityNamed(ec, entityName);

        EOSQLExpression expression = context.adaptorContext().adaptor().expressionFactory().expressionForEntity( entity );

        String proceccedQuery = processedQueryString(query, expression, bindings);
        expression.setStatement(proceccedQuery);

        EOFetchSpecification spec = new EOFetchSpecification( entityName, null, null );
        spec.setRefreshesRefetchedObjects(refreshesCache);
        if( fetchLimit != null ) {
            spec.setFetchLimit( fetchLimit );
View Full Code Here

        if( entity.primaryKeyAttributes().count() > 1 ) {
            throw new RuntimeException("Multiple primary keys not supported.");
        }

        EOSQLExpression expression = databaseContext.adaptorContext().adaptor().expressionFactory().expressionForEntity( entity );
        expression.setStatement(processedQueryString(query, expression, bindings));

        EOFetchSpecification pkSpec = new EOFetchSpecification( entityName, null, null );
        pkSpec.setRefreshesRefetchedObjects(refreshesCache);
        pkSpec.setFetchesRawRows(true);
        pkSpec.setRawRowKeyPaths(entity.primaryKeyAttributeNames());
View Full Code Here

           
            if (!adaptorChannel.isOpen()) {
                adaptorChannel.openChannel();
            }

            EOSQLExpression expression = adaptorChannel.adaptorContext().adaptor().expressionFactory().expressionForString( query );

            String proceccedQuery = processedQueryString(query, expression, bindings);
            expression.setStatement(proceccedQuery);

            try {
                adaptorChannel.evaluateExpression( expression );
            } finally {
                databaseChannel.cancelFetch();
View Full Code Here

    public static NSArray rawRowsForSqlWithBindings( EOEditingContext ec, String entityName, String query, ERXSQLBinding... bindings ) {
        EODatabaseChannel databaseChannel = databaseContextForEntityName(ec,entityName).availableChannel();
        EOAdaptorChannel adaptorChannel = databaseChannel.adaptorChannel();
        EOEntity entity = EOUtilities.entityNamed(ec, entityName);

        EOSQLExpression expression = adaptorChannel.adaptorContext().adaptor().expressionFactory().expressionForEntity( entity );
        expression.setStatement( processedQueryString( query, expression, bindings ) );

        EOFetchSpecification spec = new EOFetchSpecification( entityName, null, null );
        spec.setFetchesRawRows(true);
        spec.setHints( new NSDictionary( expression, EODatabaseContext.CustomQueryExpressionHintKey ) );
View Full Code Here

      throw NSForwardException._runtimeExceptionForThrowable(e);
    }
  }

  protected NSArray noopExpressions() {
    EOSQLExpression expression = new ERMemoryExpression(null); // until adaptor().expressionFactory() returns a real expression factory, just hardcode it ...
    expression.setStatement("--");
    return new NSArray(expression);
  }
View Full Code Here

      // AK: the (Object) cast is needed, because in 5.4 new NSArray(obj)
      // != new NSArray(array).
      NSArray pkSupportExpressions = syncFactory.primaryKeySupportStatementsForEntityGroups(new NSArray((Object) eomodel.entities()));
      Enumeration enumeration = pkSupportExpressions.objectEnumerator();
      while (enumeration.hasMoreElements()) {
        EOSQLExpression expression = (EOSQLExpression) enumeration.nextElement();
        channel.evaluateExpression(expression);
      }
    } catch (Exception e) {
    }
  }
View Full Code Here

      throw NSForwardException._runtimeExceptionForThrowable(e);
    }
  }

  protected NSArray noopExpressions() {
    EOSQLExpression expression = new ERLuceneExpression(null); // until
                                  // adaptor().expressionFactory()
                                  // returns a
                                  // real
                                  // expression
                                  // factory,
                                  // just
                                  // hardcode
                                  // it ...
    expression.setStatement("--");
    return new NSArray(expression);
  }
View Full Code Here

        clonedFetchSpec.setRawRowKeyPaths(pkNames);
        if (clonedFetchSpec instanceof ERXFetchSpecification) {
            // remove any range setting as we will explicitly set start and end limit
            ((ERXFetchSpecification)clonedFetchSpec).setFetchRange(null);
        }
        EOSQLExpression sql = ERXEOAccessUtilities.sqlExpressionForFetchSpecification(ec, clonedFetchSpec, start, end);
        NSDictionary<String, EOSQLExpression> hints = new NSDictionary<String, EOSQLExpression>(sql, EODatabaseContext.CustomQueryExpressionHintKey);
        clonedFetchSpec.setHints(hints);
        return ec.objectsWithFetchSpecification(clonedFetchSpec);
    }
View Full Code Here

            return ERXArrayUtilities.arrayWithoutDuplicateKeyValue(array, attributeName).count();
          }
          throw new UnsupportedOperationException("Unable to perform aggregate function for attribute " + aggregateAttribute.name());
        }
       
        EOSQLExpression sqlExpr = sqlFactory.expressionForEntity(entity);
        sqlExpr.prepareSelectExpressionWithAttributes(new NSArray<EOAttribute>(aggregateAttribute), false, fetchSpec);

        EOAdaptorChannel adaptorChannel = databaseContext.availableChannel().adaptorChannel();
        if (!adaptorChannel.isOpen()) {
            adaptorChannel.openChannel();
        }
View Full Code Here

TOP

Related Classes of com.webobjects.eoaccess.EOSQLExpression

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.