Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 10 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(3)
我认为没有这样的工具。
请阅读:
sql 编码约定
http://drupal.org/writing-secure-code
i assume there's no such tools.
Just read:
sql coding conventions
http://drupal.org/writing-secure-code
这可能会节省一些时间,具体取决于您尝试使用 SQL 执行的操作。
http://drupal.org/project/views
This might save some time, depending on what you are trying to do with SQL.
http://drupal.org/project/views
普通的非 Drupal SQL 仍然可以在 db_query 中工作...这不是最佳实践,因为数据库 API 无法重新调整 SQL 以在任何支持的环境中工作,并且不能利用 Drupal 的 SQL 注入保护,除其他事项外。
但它仍然有效。
如果您打算在已知环境中使用 SQL(例如,已经在使用这些命令的系统),我会说暂时按原样使用它们,并随着新代码的出现逐渐将它们转换为 Drupal 标准。发达。
(当然,如果此代码要分发到其他环境,您将需要投入汗水并转换字符串,或者编写一个工具来执行此操作)
Plain 'ol non-Drupal SQL will still work in db_query ... it's just not a best practice since the database API can't retool the SQL to work in any supported environment, and doesn't take advantage of Drupal's SQL injection protections, among other things.
But it still works.
If you're going to use the SQL in a known environment (e.g. a system where these commands are already in use), I'd say just use them as they are for now and gradually convert them over to Drupal standards as new code is developed.
(Of course, if this code is meant to be distributed to other environments, you'll want to put in sweat equity and convert the strings, or write a tool to do so)