本文整理匯總了TypeScript中@ionic-native/sqlite.SQLite類的典型用法代碼示例。如果您正苦於以下問題:TypeScript SQLite類的具體用法?TypeScript SQLite怎麽用?TypeScript SQLite使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了SQLite類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: VALUES
objMs.forEach(itemM => {
let sql = `INSERT INTO ` + TB_SQLITE.tb_health +
`(
healthid, healthname, detailhealth
) VALUES(
?, ?, ?
)`;
//console.log(sql);
let paramSql = [
itemM.healthid, itemM.healthname, itemM.detailhealth
];
this.db.create(ConectionDBName.connectionDB).then(
(connection: SQLiteObject) => {
connection.executeSql(sql, paramSql).then(
(result) => {
SQLiteHandle.recordBeWrite++;
//console.log('==== Insert table tb_health successfully.');
}
, (error) => {
console.log('!!!!!!!!!!!!!!!!!!!!!!!! ==> Insert table tb_health error. ' + error);
}
)
}
, (error) => {
reject(error);
});
});
示例2: IN
(res) => {
let valArray: Array<string> = new Array<string>();
objMs.forEach(itemM => {
valArray.push("'" + itemM.quotationno + "'");
});
let sqlParameList: string = valArray.join(",");
let sql = "DELETE FROM " + TB_SQLITE.tb_quotationrider;
sql += " WHERE quotationno IN (" + sqlParameList + ")";
//console.log('SQL command = xxxxxxxxxxxxx ' + sql);
this.db.create(ConectionDBName.connectionDB).then(
(connection: SQLiteObject) => {
connection.executeSql(sql, []).then(
(result) => {
//console.log("===== deleteByQuoNo Quotationrider success.");
resolve(res);
}
, (error) => {
console.log("!!!!!!!!!!!!!!!!!!!!!!!! ==> deleteByQuoNo ERROR Quotationrider " + error);
reject(error);
}
)
}
, (error) => {
console.log(error);
reject(error);
}
)
},
示例3: Number
objM.forEach(itemM => {
let paramSql = [
itemM.quotationno, itemM.customerid, itemM.ridertype, itemM.sum, itemM.premium,
itemM.createdatetime, itemM.lastmodify, itemM.lastsync, itemM.agentid
];
this.db.create(ConectionDBName.connectionDB).then(
(connection: SQLiteObject) => {
connection.executeSql(sql, paramSql).then(
(result) => {
let num: number = SQLiteHandle.recordBeWrite;
SQLiteHandle.recordBeWrite = Number(num + 1);
}
, (error) => {
console.log('==== Insert table Quotationrider error. ' + itemM.agentid + error);
}
)
}
, (error) => {
reject(error);
}
).catch((error) => {
reject(error);
});
});
示例4: reject
(res) => {
let objMs: Array<PlanTypeDetailM> = params;
let paramSQL = [];
if (objMs != null && objMs.length > 0) {
paramSQL = [objMs[0].typecode];
}
else {
reject("[objM[0].typecode] is null");
}
let sql = `DELETE FROM ` + TB_SQLITE.tb_plantypedetail + ` WHERE typecode=?`;
console.log(sql);
this.db.create(ConectionDBName.connectionDB).then(
(connection: SQLiteObject) => {
connection.executeSql(sql, paramSQL).then(
(result) => {
//console.log("===== Delete tb_plantypedetail success.");
resolve(res);
}
, (error) => {
console.log("!!!!!!!!!!!!!!!!!!!!!!!! ==> Delete tb_plantypedetail error." + error + " : " + error.message);
reject(error);
}
)
}
, (error) => {
console.log(error);
reject(error);
}
)
},
示例5: reject
(res) => {
let riderDetailM: Array<RiderDetailM> = objMs;
let paramSQL = [];
let sql = `DELETE FROM ` + TB_SQLITE.tb_riderdetail + ` WHERE plancode=?`;
if (riderDetailM != null && riderDetailM.length > 0) {
paramSQL = [riderDetailM[0].plancode];
}
else {
reject("riderDetailM[0].plancode is null.");
}
console.log(sql);
this.db.create(ConectionDBName.connectionDB).then(
(connection: SQLiteObject) => {
connection.executeSql(sql, []).then(
(result) => {
console.log("===== Delete tb_riderdetail success.");
resolve(res);
}
, (error) => {
console.log("===== Delete tb_riderdetail error." + error + " : " + error.message);
reject(error);
}
)
}
, (error) => {
console.log(error);
reject(error);
}
)
},
示例6: KEY
() => {
this.db.create(ConectionDBName.connectionDB)
.then(
(connection: SQLiteObject) => {
let sql: string = `CREATE TABLE IF NOT EXISTS ` + TB_SQLITE.tb_packagecoverage2 +
`(
plancode TEXT, pan TEXT, accdsum TEXT, gsum TEXT, lifesum TEXT,
rpsum TEXT, srsum TEXT, tr44sum TEXT,
PRIMARY KEY (plancode, pan)
);`;
connection.executeSql(sql, []).then(
(result) => {
//console.log("Create table tb_packagecoverage2 successfully.");
resolve(result);
}
, (error) => {
console.log("!!!!!!!!!!!!!!!!!!!!!!!! ==> Create table tb_packagecoverage2 error." + JSON.stringify(error));
console.log(error);
reject(error);
}
)
}
, (error) => {
console.log(error);
reject(error);
}
).catch((error) => {
console.log(error);
reject(error);
})
}
示例7: ResponseModel
(res) => {
let responseM: ResponseModel = new ResponseModel();
let sql: string = "SELECT COUNT(*) as total FROM " + TB_SQLITE.tb_plantypedetail;
//console.log(sql);
this.db.create(ConectionDBName.connectionDB).then(
(connection: SQLiteObject) => {
connection.executeSql(sql, []).then(
(result) => {
// console.log("===== Select count success size " + result.rows.length);
responseM.size = result.rows.item(0).total;
responseM.status = 0;
resolve(responseM);
}
, (error) => {
console.log("==> Select count tb_plantypedetail error " + JSON.stringify(error));
reject(error);
}
)
}
, (error) => {
console.log(error);
reject(error);
}
)
},
示例8: KEY
() => {
this.db.create(ConectionDBName.connectionDB)
.then(
(connection: SQLiteObject) => {
let sql: string = `CREATE TABLE IF NOT EXISTS ` + TB_SQLITE.tb_subdistrict +
`(
id TEXT, name TEXT, amphur TEXT,
PRIMARY KEY (id)
);`;
//console.log(sql);
connection.executeSql(sql, []).then(
(result) => {
// console.log("==> Create table " + TB_SQLITE.tb_subdistrict + " successfully.");
resolve(result);
}
, (error) => {
console.log("==> Create table " + TB_SQLITE.tb_subdistrict + " error." + JSON.stringify(error));
reject(error);
}
)
}
, (error) => {
console.log(error);
reject(error);
}
).catch((error) => {
console.log(error);
reject(error);
})
}
示例9: KEY
() => {
this.db.create(ConectionDBName.connectionDB)
.then(
(connection: SQLiteObject) => {
let sql: string = `CREATE TABLE IF NOT EXISTS ` + TB_SQLITE.tb_taxsumcondition +
`(
plancode TEXT, sex TEXT, minage INTEGER, maxage INTEGER, minsum REAL,
maxsum REAL, age INTEGER, sum INTEGER,
PRIMARY KEY (plancode, sex, minage, maxage, minsum, maxsum)
);`;
connection.executeSql(sql, []).then(
(result) => {
//console.log("Create table " + TB_SQLITE.tb_taxsumcondition + " successfully.");
resolve(result);
}
, (error) => {
console.log("!!!!!!!!!!!!!!!!!!!!!!!! ==> Create table tb_taxsumcondition error." + JSON.stringify(error));
console.log(error);
reject(error);
}
)
}
, (error) => {
console.log(error);
reject(error);
}
).catch((error) => {
console.log(error);
reject(error);
})
}
示例10: Date
(res) => {
try {
let sql = "UPDATE " + TB_SQLITE.tb_quotation;
sql += " SET ";
sql += "lastsync='" + DateUtil.date2str(new Date()) + "'";
//console.log(sql);
this.db.create(ConectionDBName.connectionDB).then(
(connection: SQLiteObject) => {
connection.executeSql(sql, []).then(
(result) => {
//console.log("===== Update LastSync tb_quatation success.");
resolve(res);
}
, (error) => {
console.log("!!!!!!!!!!!!!!!!!!!!!!!! ==> Update LastSync tb_quatation error. " + error);
reject(error);
}
)
}
, (error) => {
console.log(error);
reject(error);
}
)
}
catch (error) {
console.log(error);
reject(error);
}
},