DEV Community

Cover image for MySQL Editor in NodeJS ~ Part Four
Andrew Bone
Andrew Bone

Posted on • Updated on

MySQL Editor in NodeJS ~ Part Four

MySQL Editor in NodeJS

This week it doesn't feel like I got a lot done, I had to backtrack a little to prevent there being issues later on but I also but in the query box and now see a table of results.

If you'd like to follow along with my journey here is my post index.

GitHub logo ignis-pwa / nodetree

A MySQL Browser written in NodeJS

nodetree

A MySQL Browser written in NodeJS

Read about this project on dev.to

Try out the demo the password is demopassword




Backtracking

In my concept, and indeed in my last iteration, there is a file that holds all the config for connecting to a server. This includes the default database to connect to.

The problem was with my query code, when I connected to a database I would look at the config file to get the database's name. The database name would be updated whenever you changed the database you were looking at. If there was only one user or one session on the go this wouldn't ba a problem but as soon a there are multiple sessions we have a problem.

For example if user A connects to test_site and runs DELETE * FROM users WHERE username LIKE "a%" and at the same time user B connects to live_site, well, you can see the problem.

Unpicking all that and making it work with multiple sessions took up a little bit of time.

Visual Changes

I didn't really have to make any visual changes this week, I did add the table view and query box but I just continued to use the same design spec as before. Here's a gif.

Loading tables

Next steps

We're getting close to the end of the project there are only 2 features left to implement and then, of course, I'll have to do some polishing and bug hunting.

  • functional query box (code in place just need to implement)
  • add the ability to edit fields
  • polish and bug hunt

I know adding the ability to edit fields looks like quite a big step but I think it should really be simple. I plan on working on the next 2 steps next week/time then it would great if any of you felt like helping me look for bugs.

Signing off

That's another post done, as I said it doesn't feel like I made much progress this week but each step forward is still a step in the right direction. Thank you so much for reading.

🦄❤

Discussion (0)