本文整理汇总了TypeScript中sqlite3.verbose函数的典型用法代码示例。如果您正苦于以下问题:TypeScript verbose函数的具体用法?TypeScript verbose怎么用?TypeScript verbose使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了verbose函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: describe
describe("place beacon task", function() {
// webHookURL points to where yout bot is currently listening
// choose a port for the test framework to listen on
const botPort = 3000;
const testingPort = 3100;
const webHookURL = `http://localhost:${botPort}/fb-webhook`;
const tester = new BotTester.default(testingPort, webHookURL);
sqlite3.verbose();
const db = new sqlite3.Database(process.env.DATABASE_URL);
before(function(){
app.startListening();
// start your own bot here or having it running already in the background
// redirect all Facebook Requests to and not https://graph.facebook.com/v2.6
return tester.startListening();
});
it("should give the user a new task", function(){
const theScript = new BotTester.Script("1", "999");
theScript.sendTextMessage("hi"); // mock user sending "hi"
theScript.expectTextResponses([ // either response is valid
"Hey!",
"Welcome",
]);
return tester.runScript(theScript);
});
})
示例2: createKnex
function createKnex(networkId: string, dbPath: string): Knex {
logger.info(dbPath);
if (process.env.DATABASE_URL) {
// Be careful about non-serializable transactions. We expect database writes to be processed from the blockchain, serially, in block order.
return Knex({
client: "pg",
connection: process.env.DATABASE_URL,
postProcessResponse: postProcessDatabaseResults,
});
} else {
sqlite3.verbose();
return Knex({
client: "sqlite3",
connection: {
filename: dbPath,
},
acquireConnectionTimeout: 5 * 60 * 1000,
useNullAsDefault: true,
postProcessResponse: postProcessDatabaseResults,
});
}
}
示例3: createDb
import * as sqlite from 'sqlite3';
const sqlite3 = sqlite.verbose();
let db: sqlite.Database = new sqlite3.Database('chain.sqlite3', () => {});
function createDb() {
console.log("createDb chain");
db = new sqlite3.Database('chain.sqlite3', createTable);
db.configure("busyTimeout", 1000);
}
function createTable() {
console.log("createTable lorem");
db.run("CREATE TABLE IF NOT EXISTS lorem (info TEXT)", insertRows);
}
function insertRows() {
console.log("insertRows Ipsum i");
const stmt = db.prepare("INSERT INTO lorem VALUES (?)");
for (let i = 0; i < 10; i++) {
stmt.run("Ipsum " + i);
}
stmt.finalize(readAllRows);
}
function readAllRows() {
console.log("readAllRows lorem");
db.all("SELECT rowid AS id, info FROM lorem", (err, rows) => {
rows.forEach(row => {
示例4: verbose
import { verbose, Database } from 'sqlite3';
verbose();
let db = new Database(':memory:');
db.serialize(() => {
db.run("CREATE TABLE lorem (info TEXT)");
var stmt = db.prepare("INSERT INTO lorem VALUES (?)");
for (var i = 0; i < 10; i++) {
stmt.run("Ipsum " + i);
}
stmt.finalize();
db.each("SELECT rowid AS id, info FROM lorem", (err, row) => {
console.log(row.id + ": " + row.info);
});
});
db.close();
示例5: Buffer
let textBuffer: Buffer = new Buffer(text, 'utf8');
let headerBuffer: Buffer = new Buffer(15);
headerBuffer.writeUInt16LE(0x0001, 0); // command
headerBuffer.writeUInt16LE(0xFFFF, 2); // speed
headerBuffer.writeUInt16LE(0xFFFF, 4); // tone
headerBuffer.writeUInt16LE(0xFFFF, 6); // volume
headerBuffer.writeUInt16LE(0x0000, 8); // voice
headerBuffer.writeUInt8(0x00, 10); // charset
headerBuffer.writeUInt32LE(textBuffer.length, 11); // length
client.write(headerBuffer.toString('binary') + textBuffer.toString('binary'), 'binary', () => {
client.destroy();
});
});
}
sqlite3.verbose();
if (process.platform === "darwin") {
nodobjc.import('Foundation');
nodobjc.import('Cocoa');
}
if (process.platform === "darwin") {
let flashPlayerDll: string = findFile("/Applications//Google Chrome.app/Contents/Versions", "PepperFlashPlayer");
if (flashPlayerDll === undefined) {
dialog.showErrorBox("エラー", "PepperFlashPlayer が /Applications//Google Chrome.app/Contents/Versions 以下に見つかりません。");
app.quit();
}
app.commandLine.appendSwitch('ppapi-flash-path', flashPlayerDll);
} else {
let flashPlayerDll: string = findFile("C:/Program Files (x86)/Google/Chrome", "pepflashplayer.dll");
if (flashPlayerDll === undefined) {
dialog.showErrorBox("エラー", "pepflashplayer.dll が C:/Program Files (x86)/Google/Chrome 以下に見つかりません。");
示例6: constructor
constructor() {
sqlite3.verbose();
this.db = new sqlite3.Database(`${AppConfig.dataPath}${path.sep}videoDB`);
}