KDF iterations not changing in SQLCipher when creating a new database and exporting data

Hi all,

I am trying to export data from a plain SQLite database to an encrypted SQLCipher database with a specified number of KDF iterations. I have created an empty encrypted database and attached it to the plain database using the following code:

QString dbPathNameEnc = "databases/en.db";
QSqlDatabase encryptedDb = QSqlDatabase::addDatabase("SQLITECIPHER", "en");
encryptedDb.setDatabaseName(dbPathNameEnc);

if (!encryptedDb.open()) {
    qDebug() << "en not open";
    return false;
}

if(!password.isEmpty())
{
    QSqlQuery encquery(QSqlDatabase::database("en"));
    if(!encquery.exec("pragma key = '" + password +"';"))
    {
        qDebug() << "can't set password en";
        return false;
    }

    QSqlQuery kdfquery(QSqlDatabase::database("en"));
    if(!kdfquery.exec("PRAGMA kdf_iter = '10000';"))
    {
        qDebug() << "can't set kdf_iter";
        return false;
    }
}

QSqlQuery attachQuery(QSqlDatabase::database(currentUser));
if (!attachQuery.exec("ATTACH DATABASE '" + dbPathNameEnc + "' AS en KEY '" + password + "';"))
{
    qDebug() << "attach failed: " << attachQuery.lastError().text();
    return false;
}

QSqlQuery exportQuery(QSqlDatabase::database(currentUser));
if (!exportQuery.exec("SELECT sqlcipher_export('en');"))
{
    qDebug() << "export failed: " << exportQuery.lastError().text();
    return false;
}

After that I disable the encrypted database and close the normal database.
When I check an encrypted database using DB Browser, the program does not require changing the number of iterations, and the default value of 256000 is used. I cannot set more than 10000, the application freezes if the value is large. If I later programmatically log in to this database with a value of 10000 iterations, then the database will not open. But at a value of 256000, it opens. That is, you cannot change iterations in an empty database? Can anyone suggest what might be causing this issue?

i solved the problem with this