Package com.j256.ormlite.support

Examples of com.j256.ormlite.support.DatabaseConnection.compileStatement()


    }
    DatabaseConnection connection = connectionSource.getReadOnlyConnection();
    CompiledStatement compiledStatement = null;
    try {
      compiledStatement =
          connection.compileStatement(query, StatementType.SELECT, noFieldTypes,
              DatabaseConnection.DEFAULT_RESULT_FLAGS);
      assignStatementArguments(compiledStatement, arguments);
      RawResultsImpl<Object[]> rawResults =
          new RawResultsImpl<Object[]>(connectionSource, connection, query, Object[].class,
              compiledStatement, new ObjectArrayRowMapper(columnTypes), objectCache);
View Full Code Here


    final ConnectionSource connectionSource = createMock(ConnectionSource.class);
    expect(connectionSource.getDatabaseType()).andReturn(databaseType).anyTimes();
    DatabaseConnection conn = createMock(DatabaseConnection.class);
    expect(connectionSource.getReadWriteConnection()).andReturn(conn);
    final CompiledStatement stmt = createMock(CompiledStatement.class);
    expect(conn.compileStatement(isA(String.class), isA(StatementType.class), isA(FieldType[].class), anyInt())).andAnswer(
        new IAnswer<CompiledStatement>() {
          private int stmtC = 0;
          public CompiledStatement answer() {
            Object[] args = EasyMock.getCurrentArguments();
            assertNotNull(args);
View Full Code Here

    final ConnectionSource connectionSource = createMock(ConnectionSource.class);
    expect(connectionSource.getDatabaseType()).andReturn(databaseType).anyTimes();
    DatabaseConnection conn = createMock(DatabaseConnection.class);
    expect(connectionSource.getReadWriteConnection()).andReturn(conn);
    final CompiledStatement stmt = createMock(CompiledStatement.class);
    expect(conn.compileStatement(isA(String.class), isA(StatementType.class), isA(FieldType[].class), anyInt())).andAnswer(
        new IAnswer<CompiledStatement>() {
          private int stmtC = 0;
          public CompiledStatement answer() {
            Object[] args = EasyMock.getCurrentArguments();
            assertNotNull(args);
View Full Code Here

    final ConnectionSource connectionSource = createMock(ConnectionSource.class);
    expect(connectionSource.getDatabaseType()).andReturn(databaseType).anyTimes();
    DatabaseConnection conn = createMock(DatabaseConnection.class);
    expect(connectionSource.getReadWriteConnection()).andReturn(conn);
    final CompiledStatement stmt = createMock(CompiledStatement.class);
    expect(conn.compileStatement(isA(String.class), isA(StatementType.class), isA(FieldType[].class), anyInt())).andAnswer(
        new IAnswer<CompiledStatement>() {
          private int stmtC = 0;
          public CompiledStatement answer() {
            Object[] args = EasyMock.getCurrentArguments();
            assertNotNull(args);
View Full Code Here

    DatabaseConnection conn = createMock(DatabaseConnection.class);
    CompiledStatement stmt = createMock(CompiledStatement.class);
    DatabaseResults results = null;
    final AtomicInteger rowC = new AtomicInteger(1);
    if (throwExecute) {
      expect(conn.compileStatement(isA(String.class), isA(StatementType.class), isA(FieldType[].class), anyInt())).andThrow(
          new SQLException("you asked us to!!"));
    } else {
      expect(conn.compileStatement(isA(String.class), isA(StatementType.class), isA(FieldType[].class), anyInt())).andReturn(
          stmt);
      expect(stmt.runExecute()).andReturn(rowN);
View Full Code Here

    final AtomicInteger rowC = new AtomicInteger(1);
    if (throwExecute) {
      expect(conn.compileStatement(isA(String.class), isA(StatementType.class), isA(FieldType[].class), anyInt())).andThrow(
          new SQLException("you asked us to!!"));
    } else {
      expect(conn.compileStatement(isA(String.class), isA(StatementType.class), isA(FieldType[].class), anyInt())).andReturn(
          stmt);
      expect(stmt.runExecute()).andReturn(rowN);
      stmt.close();
      if (queryAfter != null) {
        expect(
View Full Code Here

          stmt);
      expect(stmt.runExecute()).andReturn(rowN);
      stmt.close();
      if (queryAfter != null) {
        expect(
            conn.compileStatement(isA(String.class), isA(StatementType.class), isA(FieldType[].class),
                anyInt())).andReturn(stmt);
        results = createMock(DatabaseResults.class);
        expect(results.first()).andReturn(false);
        expect(stmt.runQuery(null)).andReturn(results);
        stmt.close();
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.