File size: 788 Bytes
2dddd1f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
const sqlite3 = require('sqlite3');
const path = require('path');

const dbPath = path.resolve(__dirname, 'database.sqlite');
const db = new sqlite3.Database(dbPath);

console.log('Reading database:', dbPath);

db.serialize(() => {
  db.serialize(() => {
  db.all('SELECT * FROM wallets', (err, rows) => {
    if (err) {
      console.error('Error reading wallets:', err);
      return;
    }
    console.log('--- WALLETS ---');
    rows.forEach(r => {
      console.log(`|${r.name}| (Length: ${r.name.length})`);
    });
    console.log(JSON.stringify(rows, null, 2));
    console.log('---------------');
  });

  db.all('SELECT count(*) as count FROM transactions', (err, rows) => {
    if (err) return;
    console.log('Transactions count:', rows[0].count);
  });
});
});

db.close();