Package android.database.sqlite

Examples of android.database.sqlite.SQLiteStatement


    return insert(statement, args, argFieldTypes, null);
  }

  public int insert(String statement, Object[] args, FieldType[] argFieldTypes, GeneratedKeyHolder keyHolder)
      throws SQLException {
    SQLiteStatement stmt = null;
    try {
      stmt = db.compileStatement(statement);
      bindArgs(stmt, args, argFieldTypes);
      long rowId = stmt.executeInsert();
      if (keyHolder != null) {
        keyHolder.addKey(rowId);
      }
      return 1;
    } catch (android.database.SQLException e) {
      throw SqlExceptionUtil.create("inserting to database failed: " + statement, e);
    } finally {
      if (stmt != null) {
        stmt.close();
      }
    }
  }
View Full Code Here


      }
    }
  }

  public int update(String statement, Object[] args, FieldType[] argFieldTypes) throws SQLException {
    SQLiteStatement stmt = null;
    try {
      stmt = db.compileStatement(statement);
      bindArgs(stmt, args, argFieldTypes);
      stmt.execute();
      return 1;
    } catch (android.database.SQLException e) {
      throw SqlExceptionUtil.create("updating database failed: " + statement, e);
    } finally {
      if (stmt != null) {
        stmt.close();
      }
    }
  }
View Full Code Here

      }
    }
  }

  public long queryForLong(String statement) throws SQLException {
    SQLiteStatement stmt = null;
    try {
      stmt = db.compileStatement(statement);
      return stmt.simpleQueryForLong();
    } catch (android.database.SQLException e) {
      throw SqlExceptionUtil.create("queryForLong from database failed: " + statement, e);
    } finally {
      if (stmt != null) {
        stmt.close();
      }
    }
  }
View Full Code Here

TOP

Related Classes of android.database.sqlite.SQLiteStatement

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.