Tencent / wcdb

WCDB is a cross-platform database framework developed by WeChat.
Other
10.61k stars 1.39k forks source link

When wcdb updated,how can I use old function? #1112

Closed cangbing2003 closed 3 weeks ago

cangbing2003 commented 1 month ago

The language of WCDB

Java

The version of WCDB

e.g. v new 2.1.4 old 1.0.8

The platform of WCDB

e.g. Android

The installation of WCDB

e.g. Maven,

What's the issue?

Post the outputs or screenshots for errors. 在老的代码里面,使用的是SQLiteDatabase来操作的数据库,例如:database.rawQuery, database.setTransactionSuccessful database.endTransaction database.execSQL 等等,但是升级了wcdb到2.1.4,以后,在执行database.execSQL的时候,会碰到没有任何返回,切当前执行线程一直被阻塞的情况,请问,升级到2.1.4以后,如何能够继续使用SQLiteDatabase来操作数据库呢?有什么需要注意的地方呢? Explain what you want by example or code in English.

### Tasks
Qiuwen-chen commented 1 month ago

Can you give a demo project to reproduce this problem?

cangbing2003 commented 1 month ago

Can you give a demo project to reproduce this problem? if (sqlInfo.getBindArgs() != null) { database.execSQL(sqlInfo.getSql(), sqlInfo.getBindArgsAsArray()); } else { database.execSQL(sqlInfo.getSql()); }

I use database like this.

        result = SQLiteDatabase.openDatabase(dbFile.getAbsolutePath(), config.getDbKey().getBytes(), null);
        result.getInnerDB().enableAutoBackup(true);
        result.getInnerDB().setAutoCheckpointEnable(true);
        result.getInnerDB().setConfig("opimDbConfig", new Database.Config() {
            @Override
            public void onInvocation(@NonNull Handle handle) throws WCDBException {
                StatementPragma pragma = new StatementPragma();
                pragma.pragma(Pragma.journalMode).toValue("wal");
                pragma.pragma(Pragma.threads).toValue(8);
                handle.execute(pragma);
            }
        });

I create db like this

Qiuwen-chen commented 1 month ago

I need a complete project.