當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript sqlite.SQLite類代碼示例

本文整理匯總了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);
                            });

                        });
開發者ID:warozz,項目名稱:D3VMobiz,代碼行數:30,代碼來源:health-service.ts

示例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);
                    }
                )
               
            },
開發者ID:warozz,項目名稱:D3VMobiz,代碼行數:35,代碼來源:quotationrider-service.ts

示例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);
                                });
                            });
開發者ID:warozz,項目名稱:D3VMobiz,代碼行數:26,代碼來源:quotationrider-service.ts

示例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);
                        }
                    )
                },
開發者ID:warozz,項目名稱:D3VMobiz,代碼行數:33,代碼來源:plantype-detail-service.ts

示例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);
                        }
                    )
                },
開發者ID:warozz,項目名稱:D3VMobiz,代碼行數:33,代碼來源:riderdetail-service.ts

示例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);
                        })
                }
開發者ID:warozz,項目名稱:D3VMobiz,代碼行數:32,代碼來源:package-coverage2-servicel.ts

示例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);
                        }
                    )
                },
開發者ID:warozz,項目名稱:D3VMobiz,代碼行數:28,代碼來源:plantype-detail-service.ts

示例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); 
                        })
                }
開發者ID:warozz,項目名稱:D3VMobiz,代碼行數:32,代碼來源:subdistrict-service.ts

示例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);
                        })
                }
開發者ID:warozz,項目名稱:D3VMobiz,代碼行數:32,代碼來源:tax-sumcondition-service.ts

示例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);
                    }
                },
開發者ID:warozz,項目名稱:D3VMobiz,代碼行數:31,代碼來源:quotation-service.ts


注:本文中的@ionic-native/sqlite.SQLite類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。