当前位置: 首页>>代码示例>>PHP>>正文


PHP Statement::bind方法代码示例

本文整理汇总了PHP中Statement::bind方法的典型用法代码示例。如果您正苦于以下问题:PHP Statement::bind方法的具体用法?PHP Statement::bind怎么用?PHP Statement::bind使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Statement的用法示例。


在下文中一共展示了Statement::bind方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getDiameter

 /**
  * Get the <a href="http://en.wikipedia.org/wiki/Eccentricity_%28graph_theory%29">diameter</a> of a graph.
  *
  * This will throw if the list cannot be fetched from the server
  * This does not support 'batchsize', 'limit' and 'count'.<br><br>
  *
  * @throws Exception
  *
  * @param mixed      $graph        - graph name as a string or instance of Graph
  *
  * @param bool|array $options      - an array of optional parameters:
  * <ul><br>
  * <li><b>direction</b> - The direction of the edges as a string.
  * Possible values are *outbound*, *inbound* and *any* (default).</li>
  *	<li><b>algorithm</b> - The algorithm to calculate the shortest paths. If both start and end vertex examples are empty
  * <a href="http://en.wikipedia.org/wiki/Floyd%E2%80%93Warshall_algorithm">Floyd-Warshall</a> is used, otherwise the
  * default is <a "href=http://en.wikipedia.org/wiki/Dijkstra's_algorithm">Dijkstra</a>.
  * <li><b>weight</b> - The name of the attribute of the edges containing the length as a string.
  * <li><b>defaultWeight</b> - Only used with the option *weight*. If an edge does not have the attribute named as
  * defined in option *weight* this default.
  * </ul>
  *
  *
  * @return double
  */
 public function getDiameter($graph, $options = array())
 {
     if ($graph instanceof Graph) {
         $graph = $graph->getKey();
     }
     $options['objectType'] = 'figure';
     $data = array_merge($options, $this->getCursorOptions($options));
     $statement = new Statement($this->getConnection(), array("query" => ''));
     $statement->setResultType($options['objectType']);
     $aql = "RETURN GRAPH_DIAMETER(@graphName, @options) ";
     if (isset($options['direction'])) {
         if ($options['direction'] === "in") {
             $options['direction'] = "inbound";
         }
         if ($options['direction'] === "out") {
             $options['direction'] = "outbound";
         }
     }
     $statement->bind('graphName', $graph);
     $statement->bind('options', $options);
     $statement->setQuery($aql);
     $a = $statement->execute()->getAll();
     return $a[0];
 }
开发者ID:TomSearch,项目名称:arangodb-php-docs,代码行数:49,代码来源:GraphHandler.php


注:本文中的Statement::bind方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。