[英]Couldn't find module alloy/sync/enc.db when using SQLite Database Encryption Module
I tried using the module SQLite Database Encryption Module I downloaded from Appcelerator Platform, which is only available for pro seat. 我尝试使用从Appcelerator Platform下载的模块SQLite Database Encryption Module,该模块仅适用于专业人士。
I added this to my models 我将此添加到我的模型中
try {
require('appcelerator.encrypteddatabase');
var dbType = "enc.db";
} catch(e) {
var dbType = "sql";
}
And at the adapter 并在适配器
adapter : {
type : dbType,
collection_name : "somename",
idAttribute : "someid",
migration : "20161105200100"
}
When I run the project I get this error as there is no enc.db type for adapter. 当我运行项目时,由于没有适配器的enc.db类型,因此会出现此错误。
Anyone having similar issue while using this module? 任何人在使用此模块时遇到类似问题?
EDIT: 编辑:
Titanium SDK version : 5.5.1.GA Module version : 1.3.3 Titanium SDK版本:5.5.1.GA模块版本:1.3.3
Tested on : iphone 5s, version 10.2.1 simulator iphone 7 plus, version 10.1 经过测试:iPhone 5s,版本10.2.1模拟器iPhone 7 Plus,版本10.1
To use the platform encrypted module I use: 要使用平台加密模块,我使用:
In alloy.js
在alloy.js
// Use encrypteddatabase if the module is included, else use sql.
try {
require('appcelerator.encrypteddatabase');
Alloy.Globals.dbEncrypted = 'enc.db';
} catch (e) {
console.error('appcelerator.encrypteddatabase module is not available', e);
}
Alloy.Globals.dbType = 'sql';
In models/myModel.js
在models/myModel.js
var dbType = Alloy.Globals.dbEncrypted || Alloy.Globals.dbType || 'sql';
...
config: {
columns: {
id: 'TEXT PRIMARY KEY',
firstName: 'TEXT',
lastName: 'TEXT'
},
adapter: {
type: dbType,
collection_name: 'myModel',
idAttribute: 'id',
db_name: 'myModel.' + dbType
}
}
The db_name
is generated specifically for this model in my case (since I have a combination of encrypted and non-encrypted databases but you might as well use something like db_name: 'myModel'
在我的情况下, db_name
是专门为此模型生成的(因为我拥有加密和未加密的数据库的组合,但是您也可以使用类似db_name: 'myModel'
东西db_name: 'myModel'
Ti SDK Version 5.2.2.GA
and Module Version 1.1.4
Ti SDK版本5.2.2.GA
和模块版本1.1.4
Everything works fine on my end. 一切都对我有利。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.