0

数か月前、私の仕事では、標準の php mysql_query() 関数を追加のオプションと機能でラップする社内関数をデプロイしました。サンプル機能は、オン/オフできる便利なデバッグ ツールです。

私は、クエリ ハンドラがどれほど人気が​​あり、どのような機能をクエリ ハンドラに組み込むのが好きなのか疑問に思っていました。

4

2 に答える 2

1

同様の理由で、 MDB2Zend_DbDoctrineなどの DBAL を使用しています。主に、さまざまなデータベースをサポートしているという事実ではなく、提供されるすべてのショートカットを利用できるようにするためです。

例:

<?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)) {
      ...
    }
  }
}
?>

対 (Zend_Db):

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

私見、より直感的です。

于 2008-09-24T18:35:36.330 に答える
0

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.

于 2009-03-30T03:41:43.717 に答える