Signum
Signum
DTDrizzle Team
Created by Signum on 8/25/2024 in #help
Working with the result of db.execute() (mysql2)
(TypeScript newbie here.) In my (SvelteKit) application I want to (health) check if certain database tables exist when the user visits the main page. What I tried:
const [ rows, fields] = await db.execute(
sql`SELECT table_name FROM information_schema.tables;`)

return {
tables: rows.map((x) => x.table_name).filter((x) => x.startsWith('virtual_'))
};
const [ rows, fields] = await db.execute(
sql`SELECT table_name FROM information_schema.tables;`)

return {
tables: rows.map((x) => x.table_name).filter((x) => x.startsWith('virtual_'))
};
But my rows.map() seems wrong. I get "Property 'map' does not exist on type 'ResultSetHeader'.". How would I properly work with the "rows" object?
1 replies