Examples of runQuery()


Examples of com.ateam.webstore.dao.HelperDAO.runQuery()

    return null;
  }
   
  public Collection<Object> runAnyQuery(String queryText) {
    HelperDAO repository = new HelperDAO();
    Collection<Object> results = repository.runQuery(queryText); // array of arrays for all multi-columns queries
    Collection<Object> res = new ArrayList<Object>();
    for (Object result : results) {
      if(result != null) {
        if(result.getClass().isArray()) {
          return results; // multi-columns query
View Full Code Here

Examples of com.j256.ormlite.support.CompiledStatement.runQuery()

   * Return the first object that matches the {@link PreparedStmt} or null if none.
   */
  public T queryForFirst(DatabaseConnection databaseConnection, PreparedStmt<T> preparedStmt) throws SQLException {
    CompiledStatement stmt = preparedStmt.compile(databaseConnection);
    try {
      DatabaseResults results = stmt.runQuery();
      if (results.next()) {
        logger.debug("query-for-first of '{}' returned at least 1 result", preparedStmt.getStatement());
        return preparedStmt.mapRow(results);
      } else {
        logger.debug("query-for-first of '{}' returned at 0 results", preparedStmt.getStatement());
View Full Code Here

Examples of com.j256.ormlite.support.CompiledStatement.runQuery()

    // now execute any test queries which test the newly created table
    for (String query : queriesAfter) {
      CompiledStatement compiledStmt = null;
      try {
        compiledStmt = connection.compileStatement(query, StatementType.EXECUTE, noFieldTypes);
        DatabaseResults results = compiledStmt.runQuery();
        int rowC = 0;
        // count the results
        while (results.next()) {
          rowC++;
        }
View Full Code Here

Examples of com.j256.ormlite.support.CompiledStatement.runQuery()

    assertEquals(1, dao.create(foo));
    DatabaseConnection conn = connectionSource.getReadOnlyConnection();
    CompiledStatement stmt = null;
    try {
      stmt = conn.compileStatement("select * from " + TABLE_NAME, StatementType.SELECT, noFieldTypes);
      DatabaseResults results = stmt.runQuery();
      assertTrue(results.next());
      FieldType fieldType =
          FieldType.createFieldType(connectionSource, TABLE_NAME,
              clazz.getDeclaredField(SERIALIZABLE_COLUMN), clazz);
      assertNull(DataType.SERIALIZABLE.getDataPersister().resultToJava(fieldType, results,
View Full Code Here

Examples of com.j256.ormlite.support.CompiledStatement.runQuery()

    assertEquals(1, dao.create(foo));
    DatabaseConnection conn = connectionSource.getReadOnlyConnection();
    CompiledStatement stmt = null;
    try {
      stmt = conn.compileStatement("select * from " + TABLE_NAME, StatementType.SELECT, noFieldTypes);
      DatabaseResults results = stmt.runQuery();
      assertTrue(results.next());
      FieldType fieldType =
          FieldType.createFieldType(connectionSource, TABLE_NAME,
              LocalSerializable.class.getDeclaredField(SERIALIZABLE_COLUMN), LocalSerializable.class);
      DataType.SERIALIZABLE.getDataPersister().resultToJava(fieldType, results, results.findColumn(BYTE_COLUMN));
View Full Code Here

Examples of com.j256.ormlite.support.CompiledStatement.runQuery()

    assertEquals(1, dao.create(foo));
    DatabaseConnection conn = connectionSource.getReadOnlyConnection();
    CompiledStatement stmt = null;
    try {
      stmt = conn.compileStatement("select * from " + TABLE_NAME, StatementType.SELECT, noFieldTypes);
      DatabaseResults results = stmt.runQuery();
      assertTrue(results.next());
      assertEquals(val.toString(),
          DataType.ENUM_STRING.getDataPersister()
              .resultToJava(null, results, results.findColumn(ENUM_COLUMN)));
    } finally {
View Full Code Here

Examples of com.j256.ormlite.support.CompiledStatement.runQuery()

    assertEquals(1, dao.create(foo));
    DatabaseConnection conn = connectionSource.getReadOnlyConnection();
    CompiledStatement stmt = null;
    try {
      stmt = conn.compileStatement("select * from " + TABLE_NAME, StatementType.SELECT, noFieldTypes);
      DatabaseResults results = stmt.runQuery();
      assertTrue(results.next());
      assertEquals(
          val.ordinal(),
          DataType.ENUM_INTEGER.getDataPersister().resultToJava(null, results,
              results.findColumn(ENUM_COLUMN)));
View Full Code Here

Examples of com.j256.ormlite.support.CompiledStatement.runQuery()

    DataPersister dataPersister = dataType.getDataPersister();
    DatabaseConnection conn = connectionSource.getReadOnlyConnection();
    CompiledStatement stmt = null;
    try {
      stmt = conn.compileStatement("select * from " + TABLE_NAME, StatementType.SELECT, noFieldTypes);
      DatabaseResults results = stmt.runQuery();
      assertTrue(results.next());
      int colNum = results.findColumn(columnName);
      FieldType fieldType =
          FieldType.createFieldType(connectionSource, TABLE_NAME, clazz.getDeclaredField(columnName), clazz);
      if (javaVal instanceof byte[]) {
View Full Code Here

Examples of com.j256.ormlite.support.CompiledStatement.runQuery()

    DatabaseConnection conn = connectionSource.getReadOnlyConnection();
    CompiledStatement stmt = null;
    try {
      stmt = conn.compileStatement("select * from " + TABLE_NAME, StatementType.SELECT, new FieldType[0]);

      DatabaseResults results = stmt.runQuery();
      while (results.next()) {
        LocalFoo foo2 = rowMapper.mapRow(results);
        assertEquals(foo1.id, foo2.id);
      }
    } finally {
View Full Code Here

Examples of com.j256.ormlite.support.CompiledStatement.runQuery()

    assertEquals(1, dao.create(foo));
    DatabaseConnection conn = connectionSource.getReadOnlyConnection();
    CompiledStatement stmt = null;
    try {
      stmt = conn.compileStatement("select * from " + TABLE_NAME, StatementType.SELECT, noFieldTypes);
      DatabaseResults results = stmt.runQuery();
      assertTrue(results.next());
      int colNum = results.findColumn(STRING_COLUMN);
      DataType.DATE_STRING.getDataPersister().resultToJava(null, results, colNum);
    } finally {
      if (stmt != null) {
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.