Examples of compileStatement()


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

    foo.ourEnum = val;
    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)));
View Full Code Here

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

    foo.ourEnum = val;
    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,
View Full Code Here

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

      boolean isComparable, boolean isConvertableId) throws Exception {
    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);
View Full Code Here

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

            new ArgumentHolder[0], null, StatementType.SELECT);

    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);
View Full Code Here

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

    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))).andAnswer(
        new IAnswer<CompiledStatement>() {
          private int stmtC = 0;
          public CompiledStatement answer() throws Throwable {
            Object[] args = EasyMock.getCurrentArguments();
            assertNotNull(args);
View Full Code Here

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

    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))).andAnswer(
        new IAnswer<CompiledStatement>() {
          private int stmtC = 0;
          public CompiledStatement answer() throws Throwable {
            Object[] args = EasyMock.getCurrentArguments();
            assertNotNull(args);
View Full Code Here

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

    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))).andThrow(
          new SQLException("you asked us to!!"));
    } else {
      expect(conn.compileStatement(isA(String.class), isA(StatementType.class), isA(FieldType[].class))).andReturn(
          stmt);
      expect(stmt.runUpdate()).andReturn(rowN);
View Full Code Here

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

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

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

      expect(conn.compileStatement(isA(String.class), isA(StatementType.class), isA(FieldType[].class))).andReturn(
          stmt);
      expect(stmt.runUpdate()).andReturn(rowN);
      stmt.close();
      if (queryAfter != null) {
        expect(conn.compileStatement(isA(String.class), isA(StatementType.class), isA(FieldType[].class))).andReturn(
            stmt);
        results = createMock(DatabaseResults.class);
        expect(results.next()).andReturn(false);
        expect(stmt.runQuery()).andReturn(results);
        stmt.close();
View Full Code Here

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

    assertEquals(1, dao.create(foo));
    DatabaseConnection conn = connectionSource.getReadOnlyConnection();
    CompiledStatement stmt = null;
    try {
      stmt =
          conn.compileStatement("select * from " + TABLE_NAME, StatementType.SELECT, noFieldTypes,
              DatabaseConnection.DEFAULT_RESULT_FLAGS);
      DatabaseResults results = stmt.runQuery(null);
      assertTrue(results.next());
      assertEquals(
          val.ordinal(),
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.