• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java SQLiteException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



SQLiteException类属于net.sqlcipher.database包,在下文中一共展示了SQLiteException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: checkDataBase

import net.sqlcipher.database.SQLiteException; //导入依赖的package包/类
private boolean checkDataBase() {

		SQLiteDatabase checkDB = null;

		try {
			String myPath = DB_PATH + DB_NAME;
			// checkDB = SQLiteDatabase.openDatabase(myPath,Password, null,
			// SQLiteDatabase.OPEN_READONLY);

			checkDB = SQLiteDatabase.openDatabase(myPath, null,
					SQLiteDatabase.NO_LOCALIZED_COLLATORS);
		} catch (SQLiteException e) {
			Logger.log(Log.DEBUG, tag,
					"Data base does not exist " + e.toString());
		}

		if (checkDB != null) {
			checkDB.close();
		}

		return checkDB != null;
	}
 
开发者ID:SEA2015-GROUP7,项目名称:projectTetViet,代码行数:23,代码来源:DataBaseManager.java


示例2: execute

import net.sqlcipher.database.SQLiteException; //导入依赖的package包/类
@Override
public boolean execute(String sql, int autoGeneratedKeys) throws SQLException {
    SQLiteStatement statement = null;
    try {
        statement = connection.getDatabase().compileStatement(sql);
        if (autoGeneratedKeys == RETURN_GENERATED_KEYS) {
            long rowId = statement.executeInsert();
            insertResult = new SingleResultSet(this, rowId);
            return true;
        } else {
            statement.execute();
        }
    } catch (SQLiteException e) {
        SqlCipherConnection.throwSQLException(e);
    } finally {
        if (statement != null) {
            statement.close();
        }
    }
    return false;
}
 
开发者ID:requery,项目名称:requery,代码行数:22,代码来源:SqlCipherStatement.java


示例3: executeUpdate

import net.sqlcipher.database.SQLiteException; //导入依赖的package包/类
@Override
public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException {
    SQLiteStatement statement = null;
    try {
        statement = connection.getDatabase().compileStatement(sql);
        if (autoGeneratedKeys == RETURN_GENERATED_KEYS) {
            long rowId = statement.executeInsert();
            insertResult = new SingleResultSet(this, rowId);
            return 1;
        } else {
            return updateCount = statement.executeUpdateDelete();
        }
    } catch (SQLiteException e) {
        SqlCipherConnection.throwSQLException(e);
    } finally {
        if (statement != null) {
            statement.close();
        }
    }
    return 0;
}
 
开发者ID:requery,项目名称:requery,代码行数:22,代码来源:SqlCipherStatement.java


示例4: queryMemory

import net.sqlcipher.database.SQLiteException; //导入依赖的package包/类
@Override
protected <R> R queryMemory(Function<Cursor, R> function, String query) throws SQLException {
    try {
        final SQLiteDatabase database =
            SQLiteDatabase.openOrCreateDatabase(":memory:", "", null);
        Cursor cursor = database.rawQuery(query, null);
        return function.apply(closeWithCursor(new Closeable() {
            @Override
            public void close() throws IOException {
                database.close();
            }
        }, cursor));
    } catch (SQLiteException e) {
        throw new SQLException(e);
    }
}
 
开发者ID:requery,项目名称:requery,代码行数:17,代码来源:SqlCipherMetaData.java


示例5: getDaoFormValue

import net.sqlcipher.database.SQLiteException; //导入依赖的package包/类
public Dao<FormValue, String> getDaoFormValue() {
    if (daoFormValue == null) {
        try {
            TableUtils.createTableIfNotExists(getOrmHelper().getConnectionSource(), FormValue.class);
            daoFormValue = getOrmHelper().getDao(FormValue.class);
            long count = getDaoForm().countOf();
            if (count < 1) {
                getForms(true);
            } else if (count < 2) {
                getForms(false);
            }
        } catch (SQLiteException | SQLException e) {
            Timber.e(e);
        }
    }
    return daoFormValue;
}
 
开发者ID:securityfirst,项目名称:Umbrella_android,代码行数:18,代码来源:Global.java


示例6: getDaoFeedSource

import net.sqlcipher.database.SQLiteException; //导入依赖的package包/类
public Dao<FeedSource, String> getDaoFeedSource() {
    if (daoFeedSource == null) {
        try {
            TableUtils.createTableIfNotExists(getOrmHelper().getConnectionSource(), FeedSource.class);
            daoFeedSource = getOrmHelper().getDao(FeedSource.class);
            if (daoFeedSource.countOf() < 1) {
                daoFeedSource.create(new FeedSource("ReliefWeb", 0));
                daoFeedSource.create(new FeedSource("UN", 1));
                daoFeedSource.create(new FeedSource("FCO", 2));
                daoFeedSource.create(new FeedSource("CDC", 3));
                daoFeedSource.create(new FeedSource("Global Disaster and Alert Coordination System", 4));
                daoFeedSource.create(new FeedSource("US State Department Country Warnings", 5));
            }
        } catch (SQLiteException | SQLException e) {
            Timber.e(e);
        }
    }
    return daoFeedSource;
}
 
开发者ID:securityfirst,项目名称:Umbrella_android,代码行数:20,代码来源:Global.java


示例7: getSelectedFeedSources

import net.sqlcipher.database.SQLiteException; //导入依赖的package包/类
public ArrayList<Integer> getSelectedFeedSources() {
    final CharSequence[] items = {"ReliefWeb", "UN", "FCO", "CDC", "Global Disaster and Alert Coordination System", "US State Department Country Warnings"};
    final ArrayList<Integer> selectedItems = new ArrayList<>();
    List<Registry> selections;
    try {
        selections = getDaoRegistry().queryForEq(Registry.FIELD_NAME, "feed_sources");
        for (int i = 0; i < items.length; i++) {
            for (Registry reg : selections) {
                if (reg.getValue().equals(String.valueOf(i))) {
                    selectedItems.add(i);
                    break;
                }
            }
        }
    } catch (SQLiteException | SQLException e) {
        Timber.e(e);
    }
    return selectedItems;
}
 
开发者ID:securityfirst,项目名称:Umbrella_android,代码行数:20,代码来源:Global.java


示例8: readExceptionFromParcel

import net.sqlcipher.database.SQLiteException; //导入依赖的package包/类
private static final void readExceptionFromParcel(Parcel reply, String msg, int code) {
    switch (code) {
        case 2:
            throw new IllegalArgumentException(msg);
        case 3:
            throw new UnsupportedOperationException(msg);
        case 4:
            throw new SQLiteAbortException(msg);
        case 5:
            throw new SQLiteConstraintException(msg);
        case 6:
            throw new SQLiteDatabaseCorruptException(msg);
        case 7:
            throw new SQLiteFullException(msg);
        case 8:
            throw new SQLiteDiskIOException(msg);
        case 9:
            throw new SQLiteException(msg);
        default:
            reply.readException(code, msg);
    }
}
 
开发者ID:itsmechlark,项目名称:greendao-cipher,代码行数:23,代码来源:DatabaseUtils.java


示例9: dumpCurrentRow

import net.sqlcipher.database.SQLiteException; //导入依赖的package包/类
/**
 * Prints the contents of a Cursor's current row to a PrintSteam.
 *
 * @param cursor the cursor to print
 * @param stream the stream to print to
 */
public static void dumpCurrentRow(Cursor cursor, PrintStream stream) {
    String[] cols = cursor.getColumnNames();
    stream.println("" + cursor.getPosition() + " {");
    int length = cols.length;
    for (int i = 0; i< length; i++) {
        String value;
        try {
            value = cursor.getString(i);
        } catch (SQLiteException e) {
            // assume that if the getString threw this exception then the column is not
            // representable by a string, e.g. it is a BLOB.
            value = "<unprintable>";
        }
        stream.println("   " + cols[i] + '=' + value);
    }
    stream.println("}");
}
 
开发者ID:itsmechlark,项目名称:greendao-cipher,代码行数:24,代码来源:DatabaseUtils.java


示例10: execSQL

import net.sqlcipher.database.SQLiteException; //导入依赖的package包/类
@Override
protected void execSQL(String sql) throws SQLException {
    try {
        db.execSQL(sql);
    } catch (SQLiteException e) {
        throwSQLException(e);
    }
}
 
开发者ID:requery,项目名称:requery,代码行数:9,代码来源:SqlCipherConnection.java


示例11: executeQuery

import net.sqlcipher.database.SQLiteException; //导入依赖的package包/类
@Override
public ResultSet executeQuery(String sql) throws SQLException {
    try {
        @SuppressLint("Recycle") // released with the queryResult
        Cursor cursor = connection.getDatabase().rawQuery(sql, null);
        return queryResult = new CursorResultSet(this, cursor, true);
    } catch (SQLiteException e) {
        SqlCipherConnection.throwSQLException(e);
    }
    return null;
}
 
开发者ID:requery,项目名称:requery,代码行数:12,代码来源:SqlCipherStatement.java


示例12: execute

import net.sqlcipher.database.SQLiteException; //导入依赖的package包/类
@Override
public boolean execute() throws SQLException {
    try {
        statement.execute();
    } catch (SQLiteException e) {
        SqlCipherConnection.throwSQLException(e);
    }
    return false;
}
 
开发者ID:requery,项目名称:requery,代码行数:10,代码来源:SqlCipherPreparedStatement.java


示例13: executeQuery

import net.sqlcipher.database.SQLiteException; //导入依赖的package包/类
@Override
public ResultSet executeQuery() throws SQLException {
    try {
        String[] args = bindingsToArray();
        cursor = connection.getDatabase().rawQuery(getSql(), args);
        return queryResult = new CursorResultSet(this, cursor, false);
    } catch (SQLiteException e) {
        SqlCipherConnection.throwSQLException(e);
    }
    return null;
}
 
开发者ID:requery,项目名称:requery,代码行数:12,代码来源:SqlCipherPreparedStatement.java


示例14: changePassword

import net.sqlcipher.database.SQLiteException; //导入依赖的package包/类
/**
 * Change encrypted database password
 *
 * @param oldDbPassword Password current being used to access password in current session.
 *                      To restore state and continue with session.
 * @param oldPassword   Old password given by user via form to validate
 * @param newPassword   New password for database
 * @return              True if password changed successfully, else false
 */
private boolean changePassword(String oldDbPassword, String oldPassword, String newPassword) {
    DatabaseHandler db = SealnoteApplication.getDatabase();

    // Recycle old password, set new one and check if given old password
    // is correct
    db.recycle();
    try {
        db.setPassword(oldPassword);
        db.update();
    } catch (SQLiteException e) {
        db.recycle();

        // If timeout has occurred the old password will be null
        // and we don't have to put database to original state
        if (oldDbPassword != null && !oldDbPassword.equals("")) {
            db.setPassword(oldDbPassword);
            db.update();
        }
        return false;
    }

    // make query to change database key
    String query = String.format("PRAGMA rekey = %s", DatabaseUtils.sqlEscapeString(newPassword));
    db.getWritableDatabase().execSQL(query);
    db.getWritableDatabase().close();

    // Recycle old password and state, and set new password in handler
    db.recycle();
    SealnoteApplication.getDatabase().setPassword(newPassword);
    db.update();

    return true;
}
 
开发者ID:vishesh,项目名称:sealnote,代码行数:43,代码来源:PasswordPreference.java


示例15: checkDatabasePassword

import net.sqlcipher.database.SQLiteException; //导入依赖的package包/类
/**
 * Public check database password
 */
public static boolean checkDatabasePassword(Context context, File file, String password) {
    try {
        SQLiteDatabase database = new SQLiteDatabase(file.getPath(),
                password.toCharArray(), null, 0);
        database.close();
    } catch (SQLiteException e) {
        return false;
    }
    return true;
}
 
开发者ID:vishesh,项目名称:sealnote,代码行数:14,代码来源:BackupUtils.java


示例16: submitPassword

import net.sqlcipher.database.SQLiteException; //导入依赖的package包/类
private void submitPassword(AlertDialog alertDialog) {
    final MainActivity ctx = (MainActivity) getActivity();
    EditText passwordInput = (EditText) alertDialog.findViewById(R.id.passwordInput);
    String password = passwordInput.getText().toString();

    try {
        MainActivity.cardDao.setKey(password);

        // An SQLiteException wasn't raised at this point, so the db is authenticated.
        MainActivity.isDatabaseAuthenticated = true;

        // Refresh view pager with cards.
        ctx.refreshViewPager();

        // Select shown payment card.
        ctx.selectShownCardForPayment();

        // Dismiss dialog.
        ctx.toastMessage(ctx.getString(R.string.authenticated));
        dismiss();
    } catch (SQLiteException e) {
        ctx.vibrator.vibrate(new long[] {0, 125, 125, 125}, -1);
        ctx.toastMessage(ctx.getString(R.string.invalid_password));
        passwordInput.setText("");
    }

}
 
开发者ID:jthuraisamy,项目名称:MasterTap,代码行数:28,代码来源:EnterPasswordDialog.java


示例17: rawQuery

import net.sqlcipher.database.SQLiteException; //导入依赖的package包/类
@Override
public Cursor rawQuery(String sql, String[] values) throws java.sql.SQLException {
    try {
        return new AndroidSQLiteCursor(this.database.rawQuery(sql, values));
    } catch (SQLiteException e) {
        throw new java.sql.SQLException(e);
    }
}
 
开发者ID:cloudant,项目名称:sync-android,代码行数:9,代码来源:AndroidSQLCipherSQLite.java


示例18: getWritableDatabase

import net.sqlcipher.database.SQLiteException; //导入依赖的package包/类
@Override
public SQLiteDatabase getWritableDatabase(String key) {
    try {
        return super.getWritableDatabase(key);
    } catch (SQLiteException sqle) {
        DbUtil.trySqlCipherDbUpdate(key, mContext, GLOBAL_DB_LOCATOR);
        return super.getWritableDatabase(key);
    }
}
 
开发者ID:dimagi,项目名称:commcare-android,代码行数:10,代码来源:DatabaseGlobalOpenHelper.java


示例19: getWritableDatabase

import net.sqlcipher.database.SQLiteException; //导入依赖的package包/类
@Override
public SQLiteDatabase getWritableDatabase(String key) {
    try {
        return super.getWritableDatabase(key);
    } catch (SQLiteException sqle) {
        DbUtil.trySqlCipherDbUpdate(key, context, getDbName(mAppId));
        return super.getWritableDatabase(key);
    }
}
 
开发者ID:dimagi,项目名称:commcare-android,代码行数:10,代码来源:DatabaseAppOpenHelper.java


示例20: getWritableDatabase

import net.sqlcipher.database.SQLiteException; //导入依赖的package包/类
@Override
public SQLiteDatabase getWritableDatabase(String key) {
    fileMigrationKeySeed = key.getBytes();

    try {
        return super.getWritableDatabase(key);
    } catch (SQLiteException sqle) {
        DbUtil.trySqlCipherDbUpdate(key, context, getDbName(mUserId));
        return super.getWritableDatabase(key);
    }
}
 
开发者ID:dimagi,项目名称:commcare-android,代码行数:12,代码来源:DatabaseUserOpenHelper.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ConfigurableMimeFileTypeMap类代码示例发布时间:2022-05-22
下一篇:
Java SignatureAttribute类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap