UNPKG

@simonecoelhosfo/optimizely-mcp-server

Version:

Optimizely MCP Server for AI assistants with integrated CLI tools

38 lines 1.33 kB
// Example conversion to Node.js built-in SQLite // This shows the key changes needed - copy this pattern to your SQLiteEngine.ts import { DatabaseSync } from 'node:sqlite'; export class SQLiteEngine { db = null; config; constructor(config) { this.config = { backupDir: './data/backups', ...config }; } async initialize() { // Open database this.db = new DatabaseSync(this.config.path); // Set pragmas using exec() instead of pragma() this.db.exec('PRAGMA journal_mode = WAL'); this.db.exec('PRAGMA busy_timeout = 30000'); this.db.exec('PRAGMA synchronous = NORMAL'); // Prepare statements differently const stmt = this.db.prepare('SELECT * FROM entities WHERE id = ?'); const result = stmt.get(123); // get() for single row const results = stmt.all(123); // all() for multiple rows // Run statements this.db.exec('CREATE TABLE IF NOT EXISTS test (id INTEGER PRIMARY KEY)'); // Transactions this.db.exec('BEGIN'); try { // ... operations this.db.exec('COMMIT'); } catch (error) { this.db.exec('ROLLBACK'); throw error; } } } //# sourceMappingURL=SQLiteEngine-builtin.js.map