本文整理汇总了TypeScript中@ionic-native/sqlite.SQLite.create方法的典型用法代码示例。如果您正苦于以下问题:TypeScript SQLite.create方法的具体用法?TypeScript SQLite.create怎么用?TypeScript SQLite.create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@ionic-native/sqlite.SQLite
的用法示例。
在下文中一共展示了SQLite.create方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: KEY
() => {
this.db.create(ConectionDBName.connectionDB)
.then(
(connection: SQLiteObject) => {
let sql: string = "CREATE TABLE IF NOT EXISTS " + TB_SQLITE.tb_application;
sql += "(";
sql += "quotationno TEXT, customerid TEXT, applicationno TEXT, agentid TEXT, status TEXT, ";
sql += "type TEXT, createdatetime TEXT, lastmodify TEXT, lastsync TEXT, ";
sql += " PRIMARY KEY (quotationno, applicationno)";
sql += ");";
connection.executeSql(sql, []).then(
(result) => {
//console.log("Create table " + TB_SQLITE.tb_application + " successfully.");
resolve(result);
}
, (error) => {
console.log("!!!!!!!!!!!!!!!!!!!!!!!! ==> Create table error." + JSON.stringify(error));
console.log(error);
reject(error);
}
)
}
, (error) => {
console.log(error);
reject(error);
}
).catch((error) => {
console.log(error);
reject(error);
})
}
示例2: Promise
return new Promise((resolve, reject) => {
this.sqlite.create(ConectionDBName.connectionDB)
.then((connection: SQLiteObject) => {
let sql: string = `CREATE TABLE IF NOT EXISTS ` + TB_SQLITE.tb_actionlog +
`( seq char(36) default (lower(hex(randomblob(4))) || '-' || lower(hex(randomblob(2))) || '-4' || substr(lower(hex(randomblob(2))),2) || '-' || substr('89ab',abs(random()) % 4 + 1, 1) || substr(lower(hex(randomblob(2))),2) || '-' || lower(hex(randomblob(6)))) ,
agentid TEXT, deviceRefNo TEXT, page TEXT, object TEXT, type TEXT,
logdate DATETIME, PRIMARY KEY (seq, agentid));`;
connection.executeSql(sql, [])
.then(
(result) => {
//console.log("======== Create table tb_actionlog successfully.");
resolve(result);
}
, (error) => {
console.log("!!!!!!!!!!!!!!!!!!!!!!!! ==> Create table tb_actionlog error. " + JSON.stringify(error));
reject(error);
}
)
})
.catch((error) => {
console.log(error);
reject(error);
})
});
示例3: KEY
() => {
this.db.create(ConectionDBName.connectionDB)
.then(
(connection: SQLiteObject) => {
let sql: string = `CREATE TABLE IF NOT EXISTS ` + TB_SQLITE.tb_rider +
`(
ridercodeen TEXT, ridercode TEXT, ridername TEXT, ridertype TEXT, effectivedate TEXT,
expiredate TEXT, maxage TEXT, maxsum TEXT, minage TEXT, minsum TEXT,
ridermaxsum TEXT, riderminsum TEXT, riderstep TEXT, status TEXT,
PRIMARY KEY (ridercodeen)
);`;
connection.executeSql(sql, []).then(
(result) => {
console.log("Create table " + TB_SQLITE.tb_rider + " successfully.");
resolve(result);
}
, (error) => {
console.log("Create table " + TB_SQLITE.tb_rider + " error.");
console.log(error);
reject(error);
}
)
}
, (error) => {
console.log(error);
reject(error);
}
).catch((error) => {
console.log(error);
reject(error);
})
}
示例4: KEY
() => {
this.db.create(ConectionDBName.connectionDB)
.then(
(connection: SQLiteObject) => {
let sql: string = `CREATE TABLE IF NOT EXISTS ` + TB_SQLITE.tb_quotationguardian +
`(
quotationno TEXT, customerid TEXT, prename TEXT, firstname TEXT, lastname TEXT,
sex TEXT, birthdate TEXT, age TEXT, createdatetime TEXT, lastmodify TEXT,
lastsync TEXT, agentid TEXT,
PRIMARY KEY (quotationno, customerid)
);`;
connection.executeSql(sql, []).then(
(result) => {
//console.log("Create table " + TB_SQLITE.tb_quotationguardian + " successfully.");
resolve(result);
}
, (error) => {
console.log("!!!!!!!!!!!!!!!!!!!!!!!! ==> Create table tb_quotationguardian error." + JSON.stringify(error));
reject(error);
}
)
}
, (error) => {
console.log(error);
reject(error);
}
).catch((error) => {
console.log(error);
reject(error);
})
}
示例5: KEY
() => {
this.db.create(ConectionDBName.connectionDB)
.then(
(connection: SQLiteObject) => {
let sql: string = `CREATE TABLE IF NOT EXISTS ` + TB_SQLITE.tb_packagedetail +
`(
plancode TEXT, occupationtype INTEGER, minage INTEGER, maxage INTEGER, okpackage TEXT,
age INTEGER,
PRIMARY KEY (plancode, occupationtype, maxage, minage)
);`;
connection.executeSql(sql, []).then(
(result) => {
//console.log("Create table " + TB_SQLITE.tb_packagedetail + " successfully.");
resolve(result);
}
, (error) => {
console.log("!!!!!!!!!!!!!!!!!!!!!!!! ==> Create table tb_packagedetail error.");
console.log(error);
reject(error);
}
)
}
, (error) => {
console.log(error);
reject(error);
}
).catch((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_planrider +
`(
plancode TEXT, ridercode TEXT, ridertype TEXT, ridername TEXT, fullname TEXT,
minage TEXT, maxage TEXT, minsum TEXT, maxsum TEXT, riderminsum TEXT,
ridermaxsum TEXT, riderstep TEXT, status TEXT, gender TEXT, sum TEXT,
age TEXT, issuedate TEXT, hiddenrider TEXT,
PRIMARY KEY (plancode, ridercode)
);`;
connection.executeSql(sql, []).then(
(result) => {
//console.log("Create table " + TB_SQLITE.tb_planrider + " successfully.");
resolve(result);
}
, (error) => {
console.log("!!!!!!!!!!!!!!!!!!!!!!!! ==> Create table tb_planrider error." + JSON.stringify(error));
reject(error);
}
)
}
, (error) => {
console.log(error);
reject(error);
}
).catch((error) => {
console.log(error);
reject(error);
})
}
示例7: KEY
() => {
this.db.create(ConectionDBName.connectionDB)
.then(
(connection: SQLiteObject) => {
let sql: string = `CREATE TABLE IF NOT EXISTS ` + TB_SQLITE.tb_district +
`(
id TEXT, name TEXT, province TEXT, type TEXT,
PRIMARY KEY (id)
);`;
connection.executeSql(sql, []).then(
(result) => {
//console.log("==> Create table " + TB_SQLITE.tb_district + " successfully.");
resolve(result);
}
, (error) => {
console.log("==> Create table " + TB_SQLITE.tb_district + " error." + JSON.stringify(error));
console.log(error);
reject(error);
}
)
}
, (error) => {
console.log(error);
reject(error);
}
).catch((error) => {
console.log(error);
reject(error);
})
}
示例8: reject
(res) => {
let planDetailMs: Array<PlanDetailM> = objMs;
let paramSQL = [];
if (planDetailMs != null && planDetailMs.length > 0) {
paramSQL = [planDetailMs[0].plancode];
}
else {
reject("planDetailMs[0].plancode is null.");
}
let sql = `DELETE FROM ` + TB_SQLITE.tb_plandetail + ` WHERE plancode=?`;
//console.log(sql);
this.db.create(ConectionDBName.connectionDB).then(
(connection: SQLiteObject) => {
connection.executeSql(sql, []).then(
(result) => {
//console.log("===== Delete tb_plandetail success.");
resolve(res);
}
, (error) => {
console.log("!!!!!!!!!!!!!!!!!!!!!!!! ==> Delete tb_plandetail error." + JSON.stringify(error));
reject(error);
}
)
}
, (error) => {
console.log(error);
reject(error);
}
)
},
示例9: 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);
});
});
示例10: resolve
(res) => {
let objM: RequestModel = reqM;
let objMs: Array<QuotationGuardianM> = objM.param;
let paramSQL = [objMs[0].quotationno];
let sql = `DELETE FROM ` + TB_SQLITE.tb_quotationguardian + ` WHERE quotationno=?`;
//console.log(sql);
this.db.create(ConectionDBName.connectionDB).then(
(connection: SQLiteObject) => {
connection.executeSql(sql, paramSQL).then(
(result) => {
console.log("===== Delete tb_quotationguardian success.");
resolve(result);
}
, (error) => {
console.log("!!!!!!!!!!!!!!!!!!!!!!!! ==> Delete tb_quotationguardian error." + JSON.stringify(error));
reject(error);
}
)
}
, (error) => {
console.log(error);
reject(error);
}
)
},