const mysql = require('mysql2/promise'); const pool = mysql.createPool({ host: '127.0.0.1', user: 'root', password: 'root', port: 3306 }); async function run() { console.log('Testing Retro Furni query (WITH LATIN1 CAST, WHERE %%)...'); const start = Date.now(); try { const searchPattern = '%%'; const [rows] = await pool.query(` SELECT i.id, i.item_name as sprite_name, i.public_name, i.type, i.width, i.length, c.cost_credits as price, c.page_id FROM habbo_retro.items_base i LEFT JOIN habbo_retro.catalog_items c ON c.item_ids = CAST(i.id AS CHAR CHARACTER SET latin1) WHERE i.public_name LIKE ? OR i.item_name LIKE ? ORDER BY i.id DESC LIMIT 500 `, [searchPattern, searchPattern]); const duration = Date.now() - start; console.log(`Success: ${rows.length} rows in ${duration}ms`); } catch (err) { console.error('Error:', err.message); } process.exit(); } run();