您使用查询处理程序吗? 如果是这样,它为您执行什么任务?

发布于 2024-07-07 04:28:04 字数 138 浏览 16 评论 0原文

几个月前,我的工作部署了一个内部函数,该函数包装了标准的 php、mysql_query() 函数以及附加选项和功能。 一个示例功能是一些我们可以打开/关闭的方便的调试工具。

我想知道查询处理程序有多受欢迎以及人们喜欢在其中构建哪些功能。

Several months ago my work deployed an in-house function that wraps the standard, php, mysql_query() function with additional options and abilities. A sample feature would be some handy debugging tools we can turn on/off.

I was wondering how popular query handlers are and what features people like to build into them.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

凡尘雨 2024-07-14 04:28:04

我使用像 MDB2Zend_Db出于类似的原因,学说。 主要是为了能够利用它提供的所有快捷方式,而不是因为它支持不同的数据库。

例如,旧的:

<?php
$query  = "SELECT * FROM table";
$result = mysql_query($query);
if (!$result) {
  echo mysql_error();
} else {
  if (mysql_num_rows($result) > 0) {
    while ($row = mysql_fetch_obj($result)) {
      ...
    }
  }
}
?>

Versus (Zend_Db):

<?php
try {
  $result = $db->fetchAll("SELECT * FROM table");
  foreach($result as $row) {
    ...
  }
} catch (Zend_Exception $e) {
  echo $e->getMessage();
}
?>

恕我直言,更直观。

I use a DBAL like MDB2, Zend_Db or Doctrine for similar reason. Primarily to be able to utilize all the shortcuts it offers, not so much for the fact that it supports different databases.

E.g., old:

<?php
$query  = "SELECT * FROM table";
$result = mysql_query($query);
if (!$result) {
  echo mysql_error();
} else {
  if (mysql_num_rows($result) > 0) {
    while ($row = mysql_fetch_obj($result)) {
      ...
    }
  }
}
?>

Versus (Zend_Db):

<?php
try {
  $result = $db->fetchAll("SELECT * FROM table");
  foreach($result as $row) {
    ...
  }
} catch (Zend_Exception $e) {
  echo $e->getMessage();
}
?>

IMHO, more intuitive.

九八野马 2024-07-14 04:28:04

我们也在我的办公室实施了类似的措施。 事实证明,它所提供的相关处理功能是一种非常宝贵的工具。 错误跟踪、预格式化输出,它还可以作为 MsSQL 和 MySQL 之间的“AL”。

除了上述功能之外,我认为拥有一些低资源密集型性能监控或跟踪会很酷。 对于更大或更复杂的数据集,查询可能非常重要,并且能够实时(或发布)监控该查询将有助于大型网站所需的任何优化。

只是我的两分钱。

We implemented something similar at my office too. It's proven to be an invaluable to tool for the associated handling features it offers. Error tracking, pre-formatted output and it also works as an 'AL' between MsSQL and MySQL.

Aside from the above features I think it'd be cool to have some low-resource intensive performance monitoring or tracking. For larger or more complicated data sets the queries can be quite weighty and being able to monitor that real-time (or post) would be helpful for any optimization needed on larger-scale websites.

Just my two cents.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文