original_string: private function varIsDBResource($var, $db = "mysql")
      {
          if ($db == "pgsql") {
              $db = "pg";
          }
          if ($db == "sybase-db" || $db == "sybase-ct") {
              $db = "sybase";
          }
          $arrFields = ["name", "type", "flags"];
          $numrows = call_user_func($db . "_num_rows", $var);
          $numfields = call_user_func($db . "_num_fields", $var);
          $this->makeTableHeader("resource", $db . " result", $numfields + 1);
          echo "<tr><td class=\"dBug_resourceKey\">&nbsp;</td>";
          $field = [];
          for ($i = 0; $i < $numfields; $i++) {
              $field_header = $field_name = "";
              for ($j = 0; $j < count($arrFields); $j++) {
                  $db_func = $db . "_field_" . $arrFields[$j];
                  if (function_exists($db_func)) {
                      $fheader = call_user_func($db_func, $var, $i) . " ";
                      if ($j == 0) {
                          $field_name = $fheader;
                      } else {
                          $field_header .= $fheader;
                      }
                  }
              }
              $field[$i] = call_user_func($db . "_fetch_field", $var, $i);
              echo "<td class=\"dBug_resourceKey\" title=\"" . $field_header . "\">" . $field_name . "</td>";
          }
          echo "</tr>";
          for ($i = 0; $i < $numrows; $i++) {
              $row = call_user_func($db . "_fetch_array", $var, constant(strtoupper($db) . "_ASSOC"));
              echo "<tr>\n";
              echo "<td class=\"dBug_resourceKey\">" . ($i + 1) . "</td>";
              for ($k = 0; $k < $numfields; $k++) {
                  $fieldrow = $row[($field[$k]->name)];
                  $fieldrow = ($fieldrow == "") ? "[empty string]" : $fieldrow;
                  echo "<td>" . $fieldrow . "</td>\n";
              }
              echo "</tr>\n";
          }
          echo "</table>";
          if ($numrows > 0) {
              call_user_func($db . "_data_seek", $var, 0);
          }
      }
code: private function varIsDBResource($var, $db = "mysql")
      {
          if ($db == "pgsql") {
              $db = "pg";
          }
          if ($db == "sybase-db" || $db == "sybase-ct") {
              $db = "sybase";
          }
          $arrFields = ["name", "type", "flags"];
          $numrows = call_user_func($db . "_num_rows", $var);
          $numfields = call_user_func($db . "_num_fields", $var);
          $this->makeTableHeader("resource", $db . " result", $numfields + 1);
          echo "<tr><td class=\"dBug_resourceKey\">&nbsp;</td>";
          $field = [];
          for ($i = 0; $i < $numfields; $i++) {
              $field_header = $field_name = "";
              for ($j = 0; $j < count($arrFields); $j++) {
                  $db_func = $db . "_field_" . $arrFields[$j];
                  if (function_exists($db_func)) {
                      $fheader = call_user_func($db_func, $var, $i) . " ";
                      if ($j == 0) {
                          $field_name = $fheader;
                      } else {
                          $field_header .= $fheader;
                      }
                  }
              }
              $field[$i] = call_user_func($db . "_fetch_field", $var, $i);
              echo "<td class=\"dBug_resourceKey\" title=\"" . $field_header . "\">" . $field_name . "</td>";
          }
          echo "</tr>";
          for ($i = 0; $i < $numrows; $i++) {
              $row = call_user_func($db . "_fetch_array", $var, constant(strtoupper($db) . "_ASSOC"));
              echo "<tr>\n";
              echo "<td class=\"dBug_resourceKey\">" . ($i + 1) . "</td>";
              for ($k = 0; $k < $numfields; $k++) {
                  $fieldrow = $row[($field[$k]->name)];
                  $fieldrow = ($fieldrow == "") ? "[empty string]" : $fieldrow;
                  echo "<td>" . $fieldrow . "</td>\n";
              }
              echo "</tr>\n";
          }
          echo "</table>";
          if ($numrows > 0) {
              call_user_func($db . "_data_seek", $var, 0);
          }
      }
code_tokens: private function varIsDBResource ( $ var , $ db = "mysql" ) { if ( $ db == "pgsql" ) { $ db = "pg" ; } if ( $ db == "sybase-db" || $ db == "sybase-ct" ) { $ db = "sybase" ; } $ arrFields = [ "name" , "type" , "flags" ] ; $ numrows = call_user_func ( $ db . "_num_rows" , $ var ) ; $ numfields = call_user_func ( $ db . "_num_fields" , $ var ) ; $ this -> makeTableHeader ( "resource" , $ db . " result" , $ numfields + 1 ) ; echo "<tr><td class=\"dBug_resourceKey\">&nbsp;</td>" ; $ field = [ ] ; for ( $ i = 0 ; $ i < $ numfields ; $ i ++ ) { $ field_header = $ field_name = "" ; for ( $ j = 0 ; $ j < count ( $ arrFields ) ; $ j ++ ) { $ db_func = $ db . "_field_" . $ arrFields [ $ j ] ; if ( function_exists ( $ db_func ) ) { $ fheader = call_user_func ( $ db_func , $ var , $ i ) . " " ; if ( $ j == 0 ) { $ field_name = $ fheader ; } else { $ field_header .= $ fheader ; } } } $ field [ $ i ] = call_user_func ( $ db . "_fetch_field" , $ var , $ i ) ; echo "<td class=\"dBug_resourceKey\" title=\"" . $ field_header . "\">" . $ field_name . "</td>" ; } echo "</tr>" ; for ( $ i = 0 ; $ i < $ numrows ; $ i ++ ) { $ row = call_user_func ( $ db . "_fetch_array" , $ var , constant ( strtoupper ( $ db ) . "_ASSOC" ) ) ; echo "<tr>\n" ; echo "<td class=\"dBug_resourceKey\">" . ( $ i + 1 ) . "</td>" ; for ( $ k = 0 ; $ k < $ numfields ; $ k ++ ) { $ fieldrow = $ row [ ( $ field [ $ k ] -> name ) ] ; $ fieldrow = ( $ fieldrow == "" ) ? "[empty string]" : $ fieldrow ; echo "<td>" . $ fieldrow . "</td>\n" ; } echo "</tr>\n" ; } echo "</table>" ; if ( $ numrows > 0 ) { call_user_func ( $ db . "_data_seek" , $ var , 0 ) ; } }
docstring: if variable is a database resource type
docstring_tokens: if variable is a database resource type