Examples of SQLResult


Examples of org.apache.cayenne.map.SQLResult

        query.setTemplate(
                OpenBaseAdapter.class.getName(),
                "SELECT COUNT(ARTIST_ID) AS X FROM ARTIST");
        query.setColumnNamesCapitalization(CapsStrategy.UPPER);

        SQLResult rsMap = new SQLResult();
        rsMap.addColumnResult("X");
        query.setResult(rsMap);

        Object object = Cayenne.objectForQuery(context, query);
        assertNotNull(object);
        assertTrue(object instanceof Number);
View Full Code Here

Examples of org.apache.cayenne.map.SQLResult

        EntityResult artistResult = new EntityResult(Artist.class);
        artistResult.addDbField(Artist.ARTIST_ID_PK_COLUMN, "X");
        artistResult.addObjectField(Artist.ARTIST_NAME_PROPERTY, "Y");
        artistResult.addObjectField(Artist.DATE_OF_BIRTH_PROPERTY, "Z");

        SQLResult rsMap = new SQLResult();
        rsMap.addEntityResult(artistResult);
        rsMap.addColumnResult("C");
        query.setResult(rsMap);

        List<?> objects = context.performQuery(query);
        assertEquals(4, objects.size());
View Full Code Here

Examples of org.apache.cayenne.map.SQLResult

        query.setTemplate(
                OpenBaseAdapter.class.getName(),
                "SELECT COUNT(ARTIST_ID) X FROM ARTIST");
        query.setColumnNamesCapitalization(CapsStrategy.UPPER);

        SQLResult rsMap = new SQLResult();
        rsMap.addColumnResult("X");
        query.setResult(rsMap);

        List<?> objects = context.performQuery(query);
        assertEquals(1, objects.size());
View Full Code Here

Examples of org.apache.cayenne.map.SQLResult

        query.setTemplate(
                OpenBaseAdapter.class.getName(),
                "SELECT COUNT(ARTIST_ID) X, 77 Y FROM ARTIST GROUP BY 77");
        query.setColumnNamesCapitalization(CapsStrategy.UPPER);

        SQLResult rsMap = new SQLResult();
        rsMap.addColumnResult("X");
        rsMap.addColumnResult("Y");
        query.setResult(rsMap);

        List<?> objects = context.performQuery(query);
        assertEquals(1, objects.size());
View Full Code Here

Examples of weave.utils.SQLResult

      query = String.format(
          "select count(*) from %s group by " + Strings.mult(",", "%s", keyColumns.length) + " having count(*)>1",
          formatArgs
        );

      SQLResult result = SQLUtils.getResultFromQuery(conn, query, null, false);
      if (result.rows.length > 0)
        throw new RemoteException(String.format(
            "Values in the selected column%s do not uniquely identify rows in the table.",
            keyColumns.length == 1 ? "" : "s"
          ));
View Full Code Here

Examples of weave.utils.SQLResult

     
      // generate and test each query before modifying config file
      List<ColumnInfo> columnInfoList = new Vector<ColumnInfo>();
      boolean foundMatchingColumnIds = false;
     
      SQLResult filteredValues = null;
      if (filterColumnIndices != null && filterColumnIndices.length > 0)
      {
        // get a list of unique combinations of filter values
        String columnList = "";
        for (int i = 0; i < filterColumnIndices.length; i++)
View Full Code Here

Examples of weave.utils.SQLResult

      try
      {
        query = entity.privateMetadata.get(PrivateMetadata.SQLQUERY);
        String connName = entity.privateMetadata.get(PrivateMetadata.CONNECTION);
        String sqlParams = entity.privateMetadata.get(PrivateMetadata.SQLPARAMS);
        SQLResult result;
        Connection conn = getConnectionConfig().getConnectionInfo(connName).getStaticReadOnlyConnection();

        String[] sqlParamsArray = null;
        if (!Strings.isEmpty(sqlParams))
          sqlParamsArray = CSVParser.defaultParser.parseCSV(sqlParams, true)[0];
View Full Code Here

Examples of weave.utils.SQLResult

      {
        String sqlParamsString = entity.privateMetadata.get(PrivateMetadata.SQLPARAMS);
        sqlParams = CSVParser.defaultParser.parseCSVRow(sqlParamsString, true);
      }
     
      SQLResult result = SQLUtils.getResultFromQuery(conn, query, sqlParams, false);
     
      // if dataType is defined in the config file, use that value.
      // otherwise, derive it from the sql result.
      if (Strings.isEmpty(dataType))
      {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.