Package com.j256.ormlite.support

Examples of com.j256.ormlite.support.DatabaseResults


  /**
   * Add a '<=' clause so the column must be less-than or equals-to the value.
   */
  public Where<T, ID> le(String columnName, Object value) throws SQLException {
    addClause(new SimpleComparison(columnName, findColumnFieldType(columnName), value,
        SimpleComparison.LESS_THAN_EQUAL_TO_OPERATION));
    return this;
  }
View Full Code Here


  /**
   * Add a '&lt;' clause so the column must be less-than the value.
   */
  public Where<T, ID> lt(String columnName, Object value) throws SQLException {
    addClause(new SimpleComparison(columnName, findColumnFieldType(columnName), value,
        SimpleComparison.LESS_THAN_OPERATION));
    return this;
  }
View Full Code Here

  /**
   * Add a LIKE clause so the column must mach the value using '%' patterns.
   */
  public Where<T, ID> like(String columnName, Object value) throws SQLException {
    addClause(new SimpleComparison(columnName, findColumnFieldType(columnName), value,
        SimpleComparison.LIKE_OPERATION));
    return this;
  }
View Full Code Here

  /**
   * Add a '&lt;&gt;' clause so the column must be not-equal-to the value.
   */
  public Where<T, ID> ne(String columnName, Object value) throws SQLException {
    addClause(new SimpleComparison(columnName, findColumnFieldType(columnName), value,
        SimpleComparison.NOT_EQUAL_TO_OPERATION));
    return this;
  }
View Full Code Here

   */
  public Where<T, ID> idEq(ID id) throws SQLException {
    if (idColumnName == null) {
      throw new SQLException("Object has no id column specified");
    }
    addClause(new SimpleComparison(idColumnName, idFieldType, id, SimpleComparison.EQUAL_TO_OPERATION));
    return this;
  }
View Full Code Here

   */
  public <OD> Where<T, ID> idEq(Dao<OD, ?> dataDao, OD data) throws SQLException {
    if (idColumnName == null) {
      throw new SQLException("Object has no id column specified");
    }
    addClause(new SimpleComparison(idColumnName, idFieldType, dataDao.extractId(data),
        SimpleComparison.EQUAL_TO_OPERATION));
    return this;
  }
View Full Code Here

      throw SqlExceptionUtil.create("problems rolling back transaction", e);
    }
  }

  public CompiledStatement compileStatement(String statement, StatementType type, FieldType[] argFieldTypes) {
    CompiledStatement stmt = new AndroidCompiledStatement(statement, db, type);
    return stmt;
  }
View Full Code Here

  /**
   * Satisfies the {@link SQLiteOpenHelper#onCreate(SQLiteDatabase)} interface method.
   */
  @Override
  public final void onCreate(SQLiteDatabase db) {
    ConnectionSource cs = getConnectionSource();
    /*
     * The method is called by Android database helper's get-database calls when Android detects that we need to
     * create or update the database. So we have to use the database argument and save a connection to it on the
     * AndroidConnectionSource, otherwise it will go recursive if the subclass calls getConnectionSource().
     */
    DatabaseConnection conn = cs.getSpecialConnection();
    boolean clearSpecial = false;
    if (conn == null) {
      conn = new AndroidDatabaseConnection(db, true);
      try {
        cs.saveSpecialConnection(conn);
        clearSpecial = true;
      } catch (SQLException e) {
        throw new IllegalStateException("Could not save special connection", e);
      }
    }
    try {
      onCreate(db, cs);
    } finally {
      if (clearSpecial) {
        cs.clearSpecialConnection(conn);
      }
    }
  }
View Full Code Here

  /**
   * Satisfies the {@link SQLiteOpenHelper#onUpgrade(SQLiteDatabase, int, int)} interface method.
   */
  @Override
  public final void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
    ConnectionSource cs = getConnectionSource();
    /*
     * The method is called by Android database helper's get-database calls when Android detects that we need to
     * create or update the database. So we have to use the database argument and save a connection to it on the
     * AndroidConnectionSource, otherwise it will go recursive if the subclass calls getConnectionSource().
     */
    DatabaseConnection conn = cs.getSpecialConnection();
    boolean clearSpecial = false;
    if (conn == null) {
      conn = new AndroidDatabaseConnection(db, true);
      try {
        cs.saveSpecialConnection(conn);
        clearSpecial = true;
      } catch (SQLException e) {
        throw new IllegalStateException("Could not save special connection", e);
      }
    }
    try {
      onUpgrade(db, cs, oldVersion, newVersion);
    } finally {
      if (clearSpecial) {
        cs.clearSpecialConnection(conn);
      }
    }
  }
View Full Code Here

     */
    return getReadWriteConnection();
  }

  public DatabaseConnection getReadWriteConnection() throws SQLException {
    DatabaseConnection conn = getSavedConnection();
    if (conn != null) {
      return conn;
    }
    if (connection == null) {
      connection = new AndroidDatabaseConnection(helper.getWritableDatabase(), true);
View Full Code Here

TOP

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

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.