MCPcopy Index your code
hub / github.com/nodejs/node / main

Function main

benchmark/sqlite/sqlite-prepare-select-all-options.js:16–51  ·  view source on GitHub ↗
(conf)

Source from the content-addressed store, hash-verified

14});
15
16function main(conf) {
17 const optionsObj = conf.options === 'none' ? {} : conf.options.split('|').reduce((acc, key) => {
18 acc[key] = true;
19 return acc;
20 }, {});
21
22 const db = new sqlite.DatabaseSync(':memory:', optionsObj);
23
24 db.exec(
25 'CREATE TABLE foo (text_column TEXT, integer_column INTEGER, real_column REAL, blob_column BLOB)',
26 );
27
28 const fooInsertStatement = db.prepare(
29 'INSERT INTO foo (text_column, integer_column, real_column, blob_column) VALUES (?, ?, ?, ?)',
30 );
31
32 for (let i = 0; i < conf.tableSeedSize; i++) {
33 fooInsertStatement.run(
34 crypto.randomUUID(),
35 Math.floor(Math.random() * 100),
36 Math.random(),
37 Buffer.from('example blob data'),
38 );
39 }
40
41 let i;
42 let deadCodeElimination;
43
44 const stmt = db.prepare(conf.statement);
45
46 bench.start();
47 for (i = 0; i < conf.n; i += 1) deadCodeElimination = stmt.all();
48 bench.end(conf.n);
49
50 assert.ok(deadCodeElimination !== undefined);
51}

Callers

nothing calls this directly

Calls 11

reduceMethod · 0.80
randomMethod · 0.80
allMethod · 0.80
splitMethod · 0.45
execMethod · 0.45
prepareMethod · 0.45
runMethod · 0.45
fromMethod · 0.45
startMethod · 0.45
endMethod · 0.45
okMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…