Dynamic View Creation as opposed to Dynamic SQL

  • I'm working on the re-write of an application that allows administrative users to create custom filters for their users using a queryBuilder.  The queryBuilder only allows the administrative users to manipulate a portion of the WHERE clause and they have no control over columns returned.  End users of the application (non-administrators) have the ability to further filter data based on timeframe, search terms or even changing the sort order.  The list of pre-defined custom filters created by administrators are displayed to end users as a way for them to quickly slice the data based on what the administrator feels is important while of course allowing each end user to apply further filter criteria.

    In the past I completed this by essentially storing the WHERE clause generated by the administrator in a table and used Dynamic SQL at run time to generate the query using that stored where clause.  I'm re-designing the application was thinking that perhaps it would be better to create a new database View for each of the filters created by administrators instead of storing just the where clause.  So my thought is that when an administrator creates a new filter that my application would create a new db View that reflects all the criteria as defined by the administrator using a queryBuilder.  Again, the administrator has no control over the columns returned, but merely criteria in the where clause. 

    I'm looking for other expert opinions regarding my idea of dynamically creating database views when administrators create custom data filters. I can of course do things the same way as I did in the past and store the compiled WHERE clause generated using a queryBuilder UI; however, I was thinking that perhaps there may be some benefit to dynamically creating a custom view instead.

    Please share your opinion if you have one.

    Thanks!

  • See :

    https://xkcd.com/327/

    This does explain fairly well some of the riscs with your solution.
    Ben

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply