Html forms to SQL build helper
Is there any lib (javascript, python, perl, java) which will help me to build html forms, and then after submit convert it to SQL language?
I mean if i have int field in db, i want to automatic builf form and with int validation and after submiting it will create sql like AND filed_name=value
. or SET field in db build to checkboxes and convert it to SQL WHERE myset = 'Travel,Sports'
and so on... :)
There are potential problems with something like that. First you are putting yourself in danger of SQL injection by allowing field content to be directly added to a SQL command/query. It would be better to have it use stored procedures or at least parse it through a filter/function of some kind.
Second, every database has it's own quirks, so you'd need to still adjust the auto-build features to match the database and version you are using for syntax and type. Plus anything else like whether a bit or boolean should be represented by a checkbox, or a yes/no dropdown, or a radio button.
By the time you get done you'd probably be happier just building a database tier that you can pass your information into and handle how you like.
精彩评论