Package com.j256.ormlite.support

Examples of com.j256.ormlite.support.CompiledStatement


    if (arguments.length > 0) {
      // need to do the (Object) cast to force args to be a single object
      logger.trace("query arguments: {}", (Object) arguments);
    }
    DatabaseConnection connection = connectionSource.getReadOnlyConnection();
    CompiledStatement compiledStatement = null;
    try {
      compiledStatement =
          connection.compileStatement(query, StatementType.SELECT, noFieldTypes,
              DatabaseConnection.DEFAULT_RESULT_FLAGS);
      assignStatementArguments(compiledStatement, arguments);
View Full Code Here


    if (arguments.length > 0) {
      // need to do the (Object) cast to force args to be a single object
      logger.trace("query arguments: {}", (Object) arguments);
    }
    DatabaseConnection connection = connectionSource.getReadOnlyConnection();
    CompiledStatement compiledStatement = null;
    try {
      compiledStatement =
          connection.compileStatement(query, StatementType.SELECT, noFieldTypes,
              DatabaseConnection.DEFAULT_RESULT_FLAGS);
      assignStatementArguments(compiledStatement, arguments);
View Full Code Here

    if (arguments.length > 0) {
      // need to do the (Object) cast to force args to be a single object
      logger.trace("query arguments: {}", (Object) arguments);
    }
    DatabaseConnection connection = connectionSource.getReadOnlyConnection();
    CompiledStatement compiledStatement = null;
    try {
      compiledStatement =
          connection.compileStatement(query, StatementType.SELECT, noFieldTypes,
              DatabaseConnection.DEFAULT_RESULT_FLAGS);
      assignStatementArguments(compiledStatement, arguments);
View Full Code Here

    if (arguments.length > 0) {
      // need to do the (Object) cast to force args to be a single object
      logger.trace("query arguments: {}", (Object) arguments);
    }
    DatabaseConnection connection = connectionSource.getReadOnlyConnection();
    CompiledStatement compiledStatement = null;
    try {
      compiledStatement =
          connection.compileStatement(query, StatementType.SELECT, noFieldTypes,
              DatabaseConnection.DEFAULT_RESULT_FLAGS);
      assignStatementArguments(compiledStatement, arguments);
View Full Code Here

    logger.debug("running raw update statement: {}", statement);
    if (arguments.length > 0) {
      // need to do the (Object) cast to force args to be a single object
      logger.trace("update arguments: {}", (Object) arguments);
    }
    CompiledStatement compiledStatement =
        connection.compileStatement(statement, StatementType.UPDATE, noFieldTypes,
            DatabaseConnection.DEFAULT_RESULT_FLAGS);
    try {
      assignStatementArguments(compiledStatement, arguments);
      return compiledStatement.runUpdate();
    } finally {
      IOUtils.closeThrowSqlException(compiledStatement, "compiled statement");
    }
  }
View Full Code Here

    logger.debug("running raw execute statement: {}", statement);
    if (arguments.length > 0) {
      // need to do the (Object) cast to force args to be a single object
      logger.trace("execute arguments: {}", (Object) arguments);
    }
    CompiledStatement compiledStatement =
        connection.compileStatement(statement, StatementType.EXECUTE, noFieldTypes,
            DatabaseConnection.DEFAULT_RESULT_FLAGS);
    try {
      assignStatementArguments(compiledStatement, arguments);
      return compiledStatement.runExecute();
    } finally {
      IOUtils.closeThrowSqlException(compiledStatement, "compiled statement");
    }
  }
View Full Code Here

  /**
   * Update rows in the database.
   */
  public int update(DatabaseConnection databaseConnection, PreparedUpdate<T> preparedUpdate) throws SQLException {
    CompiledStatement compiledStatement = preparedUpdate.compile(databaseConnection, StatementType.UPDATE);
    try {
      int result = compiledStatement.runUpdate();
      if (dao != null && !localIsInBatchMode.get()) {
        dao.notifyChanges();
      }
      return result;
    } finally {
View Full Code Here

  /**
   * Delete rows that match the prepared statement.
   */
  public int delete(DatabaseConnection databaseConnection, PreparedDelete<T> preparedDelete) throws SQLException {
    CompiledStatement compiledStatement = preparedDelete.compile(databaseConnection, StatementType.DELETE);
    try {
      int result = compiledStatement.runUpdate();
      if (dao != null && !localIsInBatchMode.get()) {
        dao.notifyChanges();
      }
      return result;
    } finally {
View Full Code Here

    assertNull(dao.findForeignFieldType(Void.class));
    assertEquals(1, dao.countOf());
    assertEquals(1, dao.countOf(dao.queryBuilder().setCountOf(true).prepare()));
    PreparedQuery<Foo> prepared = dao.queryBuilder().prepare();
    DatabaseConnection conn = connectionSource.getReadOnlyConnection();
    CompiledStatement compiled = null;
    try {
      compiled = prepared.compile(conn, StatementType.SELECT);
      DatabaseResults results = compiled.runQuery(null);
      assertTrue(results.next());
      Foo result = dao.mapSelectStarRow(results);
      assertEquals(foo.id, result.id);
      GenericRowMapper<Foo> mapper = dao.getSelectStarRowMapper();
      result = mapper.mapRow(results);
      assertEquals(foo.id, result.id);
    } finally {
      if (compiled != null) {
        compiled.close();
      }
      connectionSource.releaseConnection(conn);
    }
    assertTrue(dao.idExists(foo.id));
    Foo result = dao.queryForFirst(prepared);
View Full Code Here

    if (this.type != type) {
      throw new SQLException("Could not compile this " + this.type
          + " statement since the caller is expecting a " + type
          + " statement.  Check your QueryBuilder methods.");
    }
    CompiledStatement stmt = databaseConnection.compileStatement(statement, type, argFieldTypes, resultFlags);
    // this may return null if the stmt had to be closed
    return assignStatementArguments(stmt);
  }
View Full Code Here

TOP

Related Classes of com.j256.ormlite.support.CompiledStatement

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.