Closed WonderCsabo closed 6 years ago
its because it gets the statements when the parameters are less, thus not closing them. makes sense. for now you can patch this with:
public class ModelSaverFix<TModel> extends ModelSaver<TModel> {
@Override
public synchronized boolean save(@NonNull TModel model, @NonNull DatabaseWrapper wrapper) {
boolean exists = getModelAdapter().exists(model, wrapper);
if (exists) {
exists = update(model, wrapper);
}
if (!exists) {
exists = insert(model, wrapper) > INSERT_FAILED;
}
if (exists) {
NotifyDistributor.get().notifyModelChanged(model, getModelAdapter(), BaseModel.Action.SAVE);
}
// return successful store into db.
return exists;
}
}
then in TableConfig.Builder
specify it as the modelAdapterModelSaver()
parameter.
in develop
, try it out with commit 7d0d039f1a
instead of version 4.2.2 until 4.2.3 is released.
Thanks for the quick fix and for offering a workaround! I look forward to the new release. 🙂
On Dec 19, 2017 21:08, "Andrew Grosner" notifications@github.com wrote:
its because it gets the statements when the parameters are less, thus not closing them. makes sense. for now you can patch this with:
public class ModelSaverFix
extends ModelSaver { @Override public synchronized boolean save(@NonNull TModel model, @NonNull DatabaseWrapper wrapper) { boolean exists = getModelAdapter().exists(model, wrapper); if (exists) { exists = update(model, wrapper, getModelAdapter().getUpdateStatement(wrapper)); } if (!exists) { exists = insert(model, getModelAdapter().getInsertStatement(wrapper), wrapper) > INSERT_FAILED; } if (exists) { NotifyDistributor.get().notifyModelChanged(model, getModelAdapter(), BaseModel.Action.SAVE); } // return successful store into db. return exists; }
}
then in TableConfig specify it as the modelSaver() parameter.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Raizlabs/DBFlow/issues/1496#issuecomment-352871958, or mute the thread https://github.com/notifications/unsubscribe-auth/AAdU5Sm7zA5tVikOeUveB7YhVND8YVE6ks5tCBengaJpZM4RG5iW .
We are using DBFlow 4.2.1 and SQLCipher 3.5.7.
When we are saving model objects, these warning messages pop up.
We are passing the
databaseWrapper
to thesave()
method.