SQLiteDatabase compileStatement - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for SQLiteDatabase compileStatement method.

This code example shows how to use the following methods:close, beginTransaction, compileStatement, endTransaction, isOpen
	} 
 
	public DataManager(Context context, boolean useDebugDb) {
		this.context = context;
		this.useDebugDb = useDebugDb;
	} 
 
	private boolean isOpenDb() { 
		return (db != null && db.isOpen());
	} 
 
	private boolean closeDb() { 
		if (isOpenDb()) { 
			try { 
				db.close();
				 
				db = null;
				rpgCharacterDao = null;
				 
				return true; 

7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:compileStatement, execSQL
		String sql = "SELECT in1,in2,ideal1 FROM xor ORDER BY rowid";
		String dbName = "encog-test.db";
		AndroidSqliteCODEC androidCodec = new AndroidSqliteCODEC(this.getContext(), dbName, sql, 2, 1);
		SQLiteDatabase db = androidCodec.getDatabase();
		 
		db.execSQL("delete from xor");
		 
		SQLiteStatement insertStmt = db.compileStatement("INSERT INTO xor(in1,in2,ideal1) VALUES(0,0,0)");
		insertStmt.executeInsert();
		insertStmt = db.compileStatement("INSERT INTO xor(in1,in2,ideal1) VALUES(1,0,1)");
		insertStmt.executeInsert();
		insertStmt = db.compileStatement("INSERT INTO xor(in1,in2,ideal1) VALUES(0,1,1)");
		insertStmt.executeInsert();
		insertStmt = db.compileStatement("INSERT INTO xor(in1,in2,ideal1) VALUES(1,1,0)");
		insertStmt.executeInsert();
		 
		CodecMLDataSet data = new CodecMLDataSet(androidCodec);
		 
		XOR.testXORDataSet((MLDataSet)data);
		 
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:compileStatement
  /*package*/ void insertRaw(SQLiteDatabase database, ContentValues contentValues) {
    database.insert(TABLE_NAME, null, contentValues);
  } 
 
  /*package*/ SQLiteStatement createInsertStatement(SQLiteDatabase database) {
    return database.compileStatement("INSERT INTO " + TABLE_NAME + " (" + ADDRESS + ", " +
                                                                      PERSON + ", " +
                                                                      DATE_SENT + ", " +
                                                                      DATE_RECEIVED  + ", " +
                                                                      PROTOCOL + ", " +
                                                                      READ + ", " +
                                                                      STATUS + ", " +
                                                                      TYPE + ", " +
                                                                      REPLY_PATH_PRESENT + ", " +
                                                                      SUBJECT + ", " +
                                                                      BODY + ", " +
                                                                      SERVICE_CENTER +
                                                                      ", THREAD_ID) " + 
                                     " VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"); 
  } 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:close, beginTransaction, compileStatement, endTransaction
		 
		SQLiteDatabase db = getReadableDatabase();
		 
		String sql = "UPDATE targetLists SET listName = ?, listDescription = ? where _id = ?";
		 
		SQLiteStatement sqlStatement = db.compileStatement(sql);
			sqlStatement.bindString(1, listName);
			sqlStatement.bindString(2, listDescription);
			sqlStatement.bindLong(3, id);
		 
		db.beginTransaction();
		try 
		{ 
			sqlStatement.execute();
			db.setTransactionSuccessful();
			success = true;
		} 
		catch (SQLException ex)
		{ 
			ex.printStackTrace();

6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:close, beginTransaction, compileStatement, endTransaction, setTransactionSuccessful
	public boolean addEyepieceData(String type, String focalLength){
		boolean success = false;
		 
		SQLiteDatabase db = getReadableDatabase();
		 
		SQLiteStatement sqlStatement = db.compileStatement("INSERT INTO eyepieces (type, focalLength) VALUES (?, ?)");
			sqlStatement.bindString(1, type);
			sqlStatement.bindString(2, focalLength);
		 
		db.beginTransaction();
		try 
		{ 
			sqlStatement.execute();
			db.setTransactionSuccessful();
			success = true;
		} 
		catch (SQLException ex)
		{ 
			ex.printStackTrace();
		} 

6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:compileStatement
This code example shows how to use the following methods:compileStatement, execSQL
        statement.close();
    } 
 
    @MediumTest 
    public void testSimpleQuery() throws Exception { 
        mDatabase.execSQL("CREATE TABLE test (num INTEGER NOT NULL, str TEXT NOT NULL);");
        mDatabase.execSQL("INSERT INTO test VALUES (1234, 'hello');");
        SQLiteStatement statement1 =
                mDatabase.compileStatement("SELECT num FROM test WHERE str = ?");
        SQLiteStatement statement2 =
                mDatabase.compileStatement("SELECT str FROM test WHERE num = ?");
 
        try { 
            statement1.bindString(1, "hello");
            long value = statement1.simpleQueryForLong();
            assertEquals(1234, value);
 
            statement1.bindString(1, "world");
            statement1.simpleQueryForLong();
            fail("shouldn't get here");
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:close, compileStatement
		 
		String sql = "INSERT INTO tip (tip_creator, symbol, target_price, reason) VALUES (?, ?, ?, ?)";
		 
		StockDatabase dbHelper = new StockDatabase(this.getApplicationContext());
		SQLiteDatabase db = dbHelper.openDatabase();
		SQLiteStatement stmt = db.compileStatement(sql);
		stmt.bindString(1, "USERNAME");
		stmt.bindString(2, symbol);
		stmt.bindDouble(3, targetPrice);
		stmt.bindString(4, reason);
		stmt.execute();
		stmt.close();
		 
		db.close();
		 
		tvTipStatus.setText("Tip saved!");
	} 
} 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:compileStatement
		database.close();
	} 
	 
	public long insert(BaseDBObject baseDBObject)
	{ 
		SQLiteStatement statement = database.compileStatement(baseDBObject.getInsertStatement());     	                    
		 
		baseDBObject.bindInsert(statement);
		 
		long lastId = statement.executeInsert(); 
		 
		statement.close(); 
	 
		return lastId;
	} 
	 
	public void update(BaseDBObject baseDBObject)
	{ 
		SQLiteStatement statement = database.compileStatement(baseDBObject.getUpdateStatement());     	                    
		 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:beginTransaction, compileStatement, endTransaction, query, setTransactionSuccessful
			sql = "insert into options (option,value) values ('" + option + "',?)";
		else 
			sql = "update options set value = ? where option = '" + option + "'";
 
		SQLiteDatabase lootDB = Database.getDatabase();
		lootDB.beginTransaction();
 
		SQLiteStatement stmt = lootDB.compileStatement(sql);
		stmt.bindBlob(1, value);
		 
		try 
		{ 
			stmt.execute();
			lootDB.setTransactionSuccessful();
		} 
		catch ( SQLException e )
		{ 
			return false; 
		} 
		finally 

5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java

Related SQLiteDatabase compileStatement Questions & Answers:

compileStatement Method Overview
Compiles an SQL statement into a reusable pre-compiled statement object.
See Code Examples for other Android SQLiteDatabase Methods: