You are about to implement dynamically generated bulletin boards. I'm asking you this question because I'm curious about how other people implement it.
Method 1: Push into one table. ==> This method is not possible because the number of bulletin boards may increase.
Method 2: The column structure is the same and only the table name is different, so it is dynamically generated. ==> I'm thinking about this method, but I received the table name as a string in myBatis Isn't there a security issue with how to run the query?
I'm thinking about number two. If you know any other way or better way, Please share it with me.database java
About Method 1: What you're trying to make is kind of like forum. If you look at the forum implementation created by others, there's usually a table named "table" and there's a table named "post," which creates a lot of structures where one post material can belong to one table material. I don't know how many bulletin boards will be created, but most of the time, this configuration will allow users to create bulletin boards and write on each bulletin board.
About Method 2: I don't think it's a good idea to use
CREATE TABLE IF NOT EXISTS just because the user entered something. I would recommend that you don't do if you find out how to inject user input into the query statement. (From security to security, there are a number of issues. For example, there is no way to meet the customer's request to write letters - emojis, etc. that should not be used as table names.)
© 2022 OneMinuteCode. All rights reserved.