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


TypeScript sqlite3.verbose函數代碼示例

本文整理匯總了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);
  });
})
開發者ID:CMUBigLab,項目名稱:cmuNodeFbot,代碼行數:26,代碼來源:place_beacon_task.ts

示例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,
    });
  }
}
開發者ID:AugurProject,項目名稱:augur_node,代碼行數:22,代碼來源:check-and-initialize-augur-db.ts

示例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 => {
開發者ID:Jeremy-F,項目名稱:DefinitelyTyped,代碼行數:31,代碼來源:sqlite3-tests.ts

示例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();
開發者ID:danelkhen,項目名稱:desktopbrowser,代碼行數:19,代碼來源:testsqlite.ts

示例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 以下に見つかりません。");
開發者ID:data9824,項目名稱:SavannaTalk,代碼行數:31,代碼來源:main.ts

示例6: constructor

 constructor() {
   sqlite3.verbose();
   this.db = new sqlite3.Database(`${AppConfig.dataPath}${path.sep}videoDB`);
 }
開發者ID:frankhale,項目名稱:toby,代碼行數:4,代碼來源:db.ts


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