开发者

Html forms to SQL build helper

开发者_StackOverflow社区

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜