当前位置: 首页>>代码示例>>Java>>正文


Java SQLiteStatement.bindString方法代码示例

本文整理汇总了Java中net.sqlcipher.database.SQLiteStatement.bindString方法的典型用法代码示例。如果您正苦于以下问题:Java SQLiteStatement.bindString方法的具体用法?Java SQLiteStatement.bindString怎么用?Java SQLiteStatement.bindString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.sqlcipher.database.SQLiteStatement的用法示例。


在下文中一共展示了SQLiteStatement.bindString方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: bindValues

import net.sqlcipher.database.SQLiteStatement; //导入方法依赖的package包/类
@Override protected final void bindValues(SQLiteStatement stmt, User entity) {
  stmt.clearBindings();
  stmt.bindLong(1, entity.getId());

  String name = entity.getName();
  if (name != null) {
    stmt.bindString(2, name);
  }
  stmt.bindLong(3, entity.getAge());
}
 
开发者ID:liuguoquan727,项目名称:android-study,代码行数:11,代码来源:UserDao.java

示例2: bulkKeyStore

import net.sqlcipher.database.SQLiteStatement; //导入方法依赖的package包/类
private void bulkKeyStore(int c, String dbid, String values[]) {
    if(database !=null && database.isOpen()) {
        SQLiteStatement statement =
                database.compileStatement("INSERT INTO " +
                        TABLE_KEYS + " VALUES (null, ?, ?, ?, ?);");

        database.beginTransaction();

        while (c < (values.length - 1)) {
            statement.clearBindings();
            statement.bindString(1, values[c]);
            statement.bindString(2, dbid);
            statement.bindString(3, values[c + 1]);
            statement.bindString(4, values[c + 2]);
            statement.execute();
            c = c + 3;
        }

        database.setTransactionSuccessful();
        database.endTransaction();


        //disable adding contact if over
        Cursor contactCount = database.rawQuery("SELECT * FROM " + TABLE_CONTACTS, null);
        int max_contacts = context.getResources().getInteger(R.integer.config_max_contacts);

        if (contactCount.getCount() >= max_contacts) {
            prefs.edit().putBoolean(CONST.PREFS_CONTACTADD, false).apply();
        }
        contactCount.close();
    }
}
 
开发者ID:gtom1984,项目名称:Eulen,代码行数:33,代码来源:EulenDatabase.java

示例3: bindString

import net.sqlcipher.database.SQLiteStatement; //导入方法依赖的package包/类
private void bindString(SQLiteStatement stmt, int index, String value) {
    if (value == null) {
        stmt.bindNull(index);
    }
    else {
        stmt.bindString(index, value);
    }
}
 
开发者ID:SilentCircle,项目名称:silent-contacts-android,代码行数:9,代码来源:ScContactsDatabaseHelper.java

示例4: insertNormalizedNameLookup

import net.sqlcipher.database.SQLiteStatement; //导入方法依赖的package包/类
private void insertNormalizedNameLookup(SQLiteStatement stmt, long rawContactId, long dataId, int lookupType,
        String normalizedName) {

    stmt.bindLong(1, rawContactId);
    stmt.bindLong(2, dataId);
    stmt.bindLong(3, lookupType);
    stmt.bindString(4, normalizedName);
    stmt.executeInsert();
}
 
开发者ID:SilentCircle,项目名称:silent-contacts-android,代码行数:10,代码来源:ScContactsDatabaseHelper.java

示例5: deleteByKeyInsideSynchronized

import net.sqlcipher.database.SQLiteStatement; //导入方法依赖的package包/类
private void deleteByKeyInsideSynchronized(K key, SQLiteStatement stmt) {
    if (key instanceof Long) {
        stmt.bindLong(1, (Long) key);
    } else if (key == null) {
        throw new DaoException("Cannot delete entity, key is null");
    } else {
        stmt.bindString(1, key.toString());
    }
    stmt.execute();
}
 
开发者ID:itsmechlark,项目名称:greendao-cipher,代码行数:11,代码来源:AbstractDao.java

示例6: updateInsideSynchronized

import net.sqlcipher.database.SQLiteStatement; //导入方法依赖的package包/类
protected void updateInsideSynchronized(T entity, SQLiteStatement stmt, boolean lock) {
    // To do? Check if it's worth not to bind PKs here (performance).
    bindValues(stmt, entity);
    int index = config.allColumns.length + 1;
    K key = getKey(entity);
    if (key instanceof Long) {
        stmt.bindLong(index, (Long) key);
    } else if (key == null) {
        throw new DaoException("Cannot update entity without key - was it inserted before?");
    } else {
        stmt.bindString(index, key.toString());
    }
    stmt.execute();
    attachEntity(key, entity, lock);
}
 
开发者ID:itsmechlark,项目名称:greendao-cipher,代码行数:16,代码来源:AbstractDao.java

示例7: bindArgs

import net.sqlcipher.database.SQLiteStatement; //导入方法依赖的package包/类
private void bindArgs(SQLiteStatement stmt, Object[] args, FieldType[] argFieldTypes) throws SQLException {
	if (args == null) {
		return;
	}
	for (int i = 0; i < args.length; i++) {
		Object arg = args[i];
		if (arg == null) {
			stmt.bindNull(i + 1);
		} else {
			SqlType sqlType = argFieldTypes[i].getSqlType();
			switch (sqlType) {
				case STRING :
				case LONG_STRING :
				case CHAR :
					stmt.bindString(i + 1, arg.toString());
					break;
				case BOOLEAN :
				case BYTE :
				case SHORT :
				case INTEGER :
				case LONG :
					stmt.bindLong(i + 1, ((Number) arg).longValue());
					break;
				case FLOAT :
				case DOUBLE :
					stmt.bindDouble(i + 1, ((Number) arg).doubleValue());
					break;
				case BYTE_ARRAY :
				case SERIALIZABLE :
					stmt.bindBlob(i + 1, (byte[]) arg);
					break;
				case DATE :
					// this is mapped to a STRING under Android
				case BLOB :
					// this is only for derby serializable
				case BIG_DECIMAL :
					// this should be handled as a STRING
					throw new SQLException("Invalid Android type: " + sqlType);
				case UNKNOWN :
				default :
					throw new SQLException("Unknown sql argument type: " + sqlType);
			}
		}
	}
}
 
开发者ID:d-tarasov,项目名称:ormlite-android-sqlcipher,代码行数:46,代码来源:AndroidDatabaseConnection.java


注:本文中的net.sqlcipher.database.SQLiteStatement.bindString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。