Creating tables dynamically at runtime

前端 未结 5 1830
情话喂你
情话喂你 2021-01-18 23:11

Is creating a table dynamically at runtime based on a user\'s interactions a good or bad thing for a web-app? (I\'m talking java, but question probably applies to more).

5条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-18 23:44

    I am guessing you are doing something like this:

    table_username(
    id, 
    userfield1, 
    userfield2, 
    ect...
    )
    

    One alternative would be to create a static table like so:

    table_userfields(
    id
    userid
    fieldname
    fieldvalue
    )
    

    Only problem is that field value would probably have to be a large varchar.

    But your approach is not wrong, it depends on your especific needs.

提交回复
热议问题