Spaces:
Sleeping
Sleeping
| 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(); | |